├── Images
├── ColorPicker.png
└── ColorPickerIcon.png
├── Source
└── Color Picker Solution
│ ├── LIFX Demo
│ ├── Assets
│ │ ├── lifx.png
│ │ ├── Error.png
│ │ ├── StoreLogo.png
│ │ ├── Warning.png
│ │ ├── Information.png
│ │ ├── LargeTile.scale-100.png
│ │ ├── LargeTile.scale-125.png
│ │ ├── LargeTile.scale-150.png
│ │ ├── LargeTile.scale-200.png
│ │ ├── LargeTile.scale-400.png
│ │ ├── SmallTile.scale-100.png
│ │ ├── SmallTile.scale-125.png
│ │ ├── SmallTile.scale-150.png
│ │ ├── SmallTile.scale-200.png
│ │ ├── SmallTile.scale-400.png
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── SplashScreen.scale-100.png
│ │ ├── SplashScreen.scale-125.png
│ │ ├── SplashScreen.scale-150.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── SplashScreen.scale-400.png
│ │ ├── Square44x44Logo.scale-100.png
│ │ ├── Square44x44Logo.scale-125.png
│ │ ├── Square44x44Logo.scale-150.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-400.png
│ │ ├── Wide310x150Logo.scale-100.png
│ │ ├── Wide310x150Logo.scale-125.png
│ │ ├── Wide310x150Logo.scale-150.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ ├── Wide310x150Logo.scale-400.png
│ │ ├── Square150x150Logo.scale-100.png
│ │ ├── Square150x150Logo.scale-125.png
│ │ ├── Square150x150Logo.scale-150.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square150x150Logo.scale-400.png
│ │ ├── Square44x44Logo.targetsize-16.png
│ │ ├── Square44x44Logo.targetsize-24.png
│ │ ├── Square44x44Logo.targetsize-32.png
│ │ ├── Square44x44Logo.targetsize-48.png
│ │ ├── Square44x44Logo.targetsize-256.png
│ │ ├── Square44x44Logo.altform-unplated_targetsize-16.png
│ │ ├── Square44x44Logo.altform-unplated_targetsize-32.png
│ │ ├── Square44x44Logo.altform-unplated_targetsize-48.png
│ │ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ │ └── Square44x44Logo.altform-unplated_targetsize-256.png
│ ├── Styles
│ │ └── Colors.xaml
│ ├── Views
│ │ ├── LifxListPage.xaml.cs
│ │ ├── MainPage.xaml.cs
│ │ ├── LifxControllerPage.xaml.cs
│ │ ├── LifxListPage.xaml
│ │ ├── MainPage.xaml
│ │ └── LifxControllerPage.xaml
│ ├── ViewModels
│ │ ├── WhiteItem.cs
│ │ ├── MainPageViewModel.cs
│ │ ├── LifxViewModelBase.cs
│ │ ├── LifxListPageViewModel.cs
│ │ ├── LifxControllerPageViewModel.cs
│ │ └── LifxItem.cs
│ ├── Events
│ │ ├── RefreshEventArgs.cs
│ │ ├── SelectedItemEventArgs.cs
│ │ ├── Events.cs
│ │ ├── MessageEventArgs.cs
│ │ ├── ApplicationClosingEventArgs.cs
│ │ └── ApplicationReadyEventArgs.cs
│ ├── Common
│ │ ├── MagicString.cs
│ │ ├── CollectionExtensions.cs
│ │ └── TaskExtensions.cs
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── Default.rd.xml
│ ├── App.xaml
│ ├── Converters
│ │ ├── NullToBooleanConverter.cs
│ │ ├── DoubleToStringPercentConverter.cs
│ │ ├── BooleanToVisibilityConverter.cs
│ │ ├── NotBooleanToVisibilityConverter.cs
│ │ └── DoubleToPercentConverter.cs
│ ├── Package.appxmanifest
│ ├── Models
│ │ ├── LifxColor.cs
│ │ └── ApiRateLimiter.cs
│ ├── App.xaml.cs
│ ├── Strings
│ │ └── en-US
│ │ │ └── Resources.resw
│ └── LIFX Demo.csproj
│ ├── Color Picker Control
│ ├── Assets
│ │ ├── light.png
│ │ └── ControlRadialGradient.png
│ ├── Porrey.Controls.ColorPicker.1.2.1.nupkg
│ ├── Themes
│ │ ├── Generic.xaml
│ │ ├── IndicatorArrow.xaml
│ │ ├── TogglePowerSwitch.xaml
│ │ └── ColorPickerWheel.xaml
│ ├── Properties
│ │ ├── AssemblyInfo.cs
│ │ └── ColorPicker.rd.xml
│ ├── Models
│ │ └── ValueChangedEventArgs.cs
│ ├── Converters
│ │ └── DoubleToCornerRadiusConverter.cs
│ ├── Extensions
│ │ └── GeometryExtensions.cs
│ ├── IndicatorArrow.cs
│ ├── TogglePowerSwitch.cs
│ └── Color Picker Control.csproj
│ ├── Color Picker Demo
│ ├── Assets
│ │ ├── StoreLogo.png
│ │ ├── SplashScreen.scale-200.png
│ │ ├── LockScreenLogo.scale-200.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Wide310x150Logo.scale-200.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ └── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── App.xaml
│ ├── Properties
│ │ ├── Default.rd.xml
│ │ └── AssemblyInfo.cs
│ ├── App.xaml.cs
│ ├── Converters
│ │ ├── DoubleToStringPercentConverter.cs
│ │ ├── DoubleToPercentConverter.cs
│ │ └── PercentToDoubleConverter.cs
│ ├── Package.appxmanifest
│ ├── MainPage.xaml.cs
│ └── Color Picker Demo.csproj
│ └── Color Picker Solution.sln
├── README.md
└── .gitignore
/Images/ColorPicker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Images/ColorPicker.png
--------------------------------------------------------------------------------
/Images/ColorPickerIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Images/ColorPickerIcon.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/lifx.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/lifx.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Error.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Warning.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Information.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Information.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Assets/light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Control/Assets/light.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LargeTile.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SmallTile.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/SplashScreen.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Wide310x150Logo.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-125.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-150.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square150x150Logo.scale-400.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-16.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-24.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-32.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-48.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-256.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Assets/ControlRadialGradient.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Control/Assets/ControlRadialGradient.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Porrey.Controls.ColorPicker.1.2.1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Control/Porrey.Controls.ColorPicker.1.2.1.nupkg
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/LIFX Demo/Assets/Square44x44Logo.altform-unplated_targetsize-256.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/porrey/Color-Picker/HEAD/Source/Color Picker Solution/Color Picker Demo/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Themes/Generic.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Styles/Colors.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | White
6 | Black
7 | Black
8 | #353535
9 | #454545
10 | Black
11 | LightGray
12 | Black
13 |
14 | #353535
15 |
16 |
18 |
19 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Themes/IndicatorArrow.xaml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
25 |
26 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/LifxListPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using Windows.UI.Xaml.Controls;
20 |
21 | namespace LifxDemo.Views
22 | {
23 | public sealed partial class LifxListPage : Page
24 | {
25 | public LifxListPage()
26 | {
27 | this.InitializeComponent();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using Prism.Windows.Mvvm;
20 |
21 | namespace LifxDemo.Views
22 | {
23 | public partial class MainPage : SessionStateAwarePage
24 | {
25 | public MainPage()
26 | {
27 | this.InitializeComponent();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Hue/Wheel Color Picker Control
2 |
3 | A hue based, touch enabled color picker control for your Windows 10 UWP applications. This projects has a full LIFX demonstration app.
4 |
5 | See [Hackster.io Article](https://www.hackster.io/porrey/windows-10-uwp-color-picker-8c3b06 "Hackster.io Article") for full details.
6 |
7 | 
8 |
9 | ## Features
10 | The control has these features:
11 |
12 | * Full hue based rotation
13 | * Supports inertia
14 | * Scalable
15 | * Content based control (place other controls in the center)
16 | * Selectable color
17 | * HSB color based
18 | * Provides conversion to RGB
19 | * Works on Windows 10 IoT Core (tested on Raspberry Pi 3/4)
20 | * The following video is a demonstration of the control on Windows 10.
21 |
22 | ### Video of Feature Demonstration
23 | [](http://www.youtube.com/watch?v=y6iE9uPL-uM "Features Demonstration")
24 |
25 | ### Video of LIFX Demo
26 | [](http://www.youtube.com/watch?v=ACeZdnQISxU "LIFX Demonstration")
27 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/WhiteItem.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using Windows.UI.Xaml.Media;
20 |
21 | namespace LifxDemo.ViewModels
22 | {
23 | public class WhiteItem
24 | {
25 | public string Name { get; set; }
26 | public SolidColorBrush Color {get; set;}
27 | public ushort Kelvin { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/RefreshEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 |
21 | namespace LifxDemo.Events
22 | {
23 | public class RefreshEventArgs : EventArgs
24 | {
25 | public RefreshEventArgs(bool rediscover)
26 | {
27 | this.Rediscover = rediscover;
28 | }
29 |
30 | public bool Rediscover { get; private set; }
31 | }
32 | }
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Common/MagicString.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | namespace LifxDemo.Common
20 | {
21 | public static class MagicString
22 | {
23 | public static class Page
24 | {
25 | public const string Main = "Main";
26 | }
27 |
28 | public static class Resource
29 | {
30 | public const string LifxApplicationError = "LifxApplicationError";
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("LIFX Demo")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Daniel M. Porrey")]
12 | [assembly: AssemblyProduct("LIFX Demo")]
13 | [assembly: AssemblyCopyright("Copyright © 2018-2022 Daniel Porrey")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.2.0.0")]
28 | [assembly: AssemblyFileVersion("1.2.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/SelectedItemEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using LifxDemo.ViewModels;
20 | using System;
21 |
22 | namespace LifxDemo.Events
23 | {
24 | public class SelectedItemEventArgs : EventArgs
25 | {
26 | public SelectedItemEventArgs(LifxItem lifxBulb)
27 | {
28 | this.LifxBulb = lifxBulb;
29 | }
30 |
31 | public LifxItem LifxBulb { get; private set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Hue Wheel Color Picker")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Daniel M. Porrey")]
12 | [assembly: AssemblyProduct("ColorPicker")]
13 | [assembly: AssemblyCopyright("Copyright © 2018-2022 Daniel Porrey")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.2.2.0")]
28 | [assembly: AssemblyFileVersion("1.2.2.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Models/ValueChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 |
21 | namespace Porrey.Controls.ColorPicker
22 | {
23 | public class ValueChangedEventArgs : EventArgs
24 | {
25 | public ValueChangedEventArgs(T previousValue, T newValue)
26 | {
27 | this.PreviousValue = previousValue;
28 | this.NewValue = newValue;
29 | }
30 |
31 | public T PreviousValue { get; private set; }
32 | public T NewValue { get; private set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/Events.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using Prism.Events;
20 |
21 | namespace LifxDemo.Events
22 | {
23 | public class ApplicationReadyEvent : PubSubEvent { }
24 | public class ApplicationClosingEvent : PubSubEvent { }
25 | public class SelectedItemEvent : PubSubEvent { }
26 | public class MessageEvent : PubSubEvent { }
27 | public class RefreshEvent : PubSubEvent { }
28 | }
29 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ColorPickerDemo.Properties")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Daniel M. Porrey")]
12 | [assembly: AssemblyProduct("ColorPicker")]
13 | [assembly: AssemblyCopyright("Copyright © 2018-2022 Daniel Porrey")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("1979b2c2-6877-4a91-82ee-05a3513c11b2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | [assembly: AssemblyVersion("1.2.0.0")]
33 | [assembly: AssemblyFileVersion("1.2.0.0")]
34 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/LifxControllerPage.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System.Linq;
20 | using Windows.UI.Xaml.Controls;
21 |
22 | namespace LifxDemo.Views
23 | {
24 | public sealed partial class LifxControllerPage : Page
25 | {
26 | public LifxControllerPage()
27 | {
28 | this.InitializeComponent();
29 | }
30 |
31 | private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
32 | {
33 | object item = e.AddedItems.FirstOrDefault();
34 |
35 | if (item != null)
36 | {
37 | if (sender is ListView lv)
38 | {
39 | lv.ScrollIntoView(item);
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Converters/NullToBooleanConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace LifxDemo.Converters
23 | {
24 | public sealed class NullToBooleanConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | bool returnValue = false;
29 |
30 | if (value != null)
31 | {
32 | returnValue = true;
33 | }
34 |
35 | return returnValue;
36 | }
37 |
38 | public object ConvertBack(object value, Type targetType, object parameter, string language)
39 | {
40 | throw new NotSupportedException();
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/MessageEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 |
21 | namespace LifxDemo.Events
22 | {
23 | public enum MessageEventType
24 | {
25 | None,
26 | Information,
27 | Warning,
28 | Error
29 | }
30 |
31 | public class MessageEventArgs : EventArgs
32 | {
33 | public MessageEventArgs(MessageEventType type, string message)
34 | {
35 | this.Type = type;
36 | this.Message = message;
37 | }
38 |
39 | public MessageEventArgs(Exception ex)
40 | {
41 | this.Type = MessageEventType.Error;
42 | this.Message = ex.Message;
43 | }
44 |
45 | public string Message { get; private set; }
46 | public MessageEventType Type { get; private set; }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/ApplicationClosingEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | using System.Collections.Generic;
19 | using Prism.Uno.Navigation;
20 |
21 | namespace LifxDemo.Events
22 | {
23 | public class ApplicationClosingEventArgs
24 | {
25 | public ApplicationClosingEventArgs(NavigatingFromEventArgs navigatedToEventArgs, Dictionary viewModelState, bool suspending)
26 | {
27 | this.NavigatedToEventArgs = navigatedToEventArgs;
28 | this.ViewModelState = viewModelState;
29 | this.Suspending = suspending;
30 | }
31 |
32 | public NavigatingFromEventArgs NavigatedToEventArgs { get; private set; }
33 | public Dictionary ViewModelState { get; private set; }
34 | public bool Suspending { get; private set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Events/ApplicationReadyEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System.Collections.Generic;
20 | using Windows.UI.Core;
21 |
22 | namespace LifxDemo.Events
23 | {
24 | public class ApplicationReadyEventArgs
25 | {
26 | public ApplicationReadyEventArgs(CoreDispatcher dispatcher, NavigatedToEventArgs navigatedToEventArgs, Dictionary viewModelState)
27 | {
28 | this.Dispatcher = dispatcher;
29 | this.NavigatedToEventArgs = navigatedToEventArgs;
30 | this.ViewModelState = viewModelState;
31 | }
32 |
33 | public CoreDispatcher Dispatcher { get; private set; }
34 | public NavigatedToEventArgs NavigatedToEventArgs { get; private set; }
35 | public Dictionary ViewModelState { get; private set; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Windows.ApplicationModel;
3 | using Windows.ApplicationModel.Activation;
4 | using Windows.UI.Xaml;
5 | using Windows.UI.Xaml.Controls;
6 | using Windows.UI.Xaml.Navigation;
7 |
8 | namespace ColorPickerDemo
9 | {
10 | sealed partial class App : Application
11 | {
12 | public App()
13 | {
14 | this.InitializeComponent();
15 | }
16 |
17 | protected override void OnLaunched(LaunchActivatedEventArgs e)
18 | {
19 | Frame rootFrame = Window.Current.Content as Frame;
20 |
21 | if (rootFrame == null)
22 | {
23 | rootFrame = new Frame();
24 |
25 | rootFrame.NavigationFailed += this.OnNavigationFailed;
26 |
27 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
28 | {
29 | //TODO: Load state from previously suspended application
30 | }
31 |
32 | Window.Current.Content = rootFrame;
33 | }
34 |
35 | if (e.PrelaunchActivated == false)
36 | {
37 | if (rootFrame.Content == null)
38 | {
39 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
40 | }
41 |
42 | Window.Current.Activate();
43 | }
44 | }
45 |
46 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
47 | {
48 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Converters/DoubleToStringPercentConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace LifxDemo.Converters
23 | {
24 | public class DoubleToStringPercentConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | string returnValue = "0%";
29 |
30 | if (value is double doubleValue)
31 | {
32 | if (doubleValue < 0) doubleValue = 0;
33 | if (doubleValue > 1.0) doubleValue = 1.0;
34 |
35 | returnValue = doubleValue.ToString("0%");
36 | }
37 |
38 | return returnValue;
39 | }
40 |
41 | public object ConvertBack(object value, Type targetType, object parameter, string language)
42 | {
43 | throw new NotSupportedException();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Converters/DoubleToStringPercentConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace ColorPickerDemo.Converters
23 | {
24 | public class DoubleToStringPercentConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | string returnValue = "0%";
29 |
30 | if (value is double doubleValue)
31 | {
32 | if (doubleValue < 0) doubleValue = 0;
33 | if (doubleValue > 1.0) doubleValue = 1.0;
34 |
35 | returnValue = doubleValue.ToString("0%");
36 | }
37 |
38 | return returnValue;
39 | }
40 |
41 | public object ConvertBack(object value, Type targetType, object parameter, string language)
42 | {
43 | throw new NotSupportedException();
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Color Picker Demo
7 | Daniel
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Converters/DoubleToCornerRadiusConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml;
21 | using Windows.UI.Xaml.Data;
22 |
23 | namespace Porrey.Controls.ColorPicker.Converters
24 | {
25 | public class DoubleToCornerRadiusConverter : IValueConverter
26 | {
27 | public object Convert(object value, Type targetType, object parameter, string language)
28 | {
29 | CornerRadius returnValue = new CornerRadius(0);
30 |
31 | if (value is double doubleValue)
32 | {
33 | if (!double.IsNaN(doubleValue))
34 | {
35 | returnValue = new CornerRadius(doubleValue);
36 | }
37 | }
38 |
39 | return returnValue;
40 | }
41 |
42 | public object ConvertBack(object value, Type targetType, object parameter, string language)
43 | {
44 | throw new NotSupportedException();
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Converters/BooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml;
21 | using Windows.UI.Xaml.Data;
22 |
23 | namespace LifxDemo.Converters
24 | {
25 | ///
26 | /// Value converter that translates true to and false to
27 | /// .
28 | ///
29 | public sealed class BooleanToVisibilityConverter : IValueConverter
30 | {
31 | public object Convert(object value, Type targetType, object parameter, string language)
32 | {
33 | return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
34 | }
35 |
36 | public object ConvertBack(object value, Type targetType, object parameter, string language)
37 | {
38 | return value is Visibility && (Visibility)value == Visibility.Visible;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Properties/ColorPicker.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Converters/NotBooleanToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml;
21 | using Windows.UI.Xaml.Data;
22 |
23 | namespace LifxDemo.Converters
24 | {
25 | ///
26 | /// Value converter that translates true to and false to
27 | /// .
28 | ///
29 | public sealed class NotBooleanToVisibilityConverter : IValueConverter
30 | {
31 | public object Convert(object value, Type targetType, object parameter, string language)
32 | {
33 | return (value is bool && (bool)value) ? Visibility.Collapsed : Visibility.Visible;
34 | }
35 |
36 | public object ConvertBack(object value, Type targetType, object parameter, string language)
37 | {
38 | return value is Visibility && (Visibility)value == Visibility.Collapsed;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Converters/DoubleToPercentConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace LifxDemo.Converters
23 | {
24 | public class DoubleToPercentConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | double returnValue = 0;
29 |
30 | if (value is double doubleValue)
31 | {
32 | if (doubleValue < 0) doubleValue = 0;
33 | if (doubleValue > 1.0) doubleValue = 1.0;
34 |
35 | returnValue = 100.0 * doubleValue;
36 | }
37 |
38 | return returnValue;
39 | }
40 |
41 | public object ConvertBack(object value, Type targetType, object parameter, string language)
42 | {
43 | double returnValue = 0;
44 |
45 | if (value is double doubleValue)
46 | {
47 | if (doubleValue < 0) doubleValue = 0;
48 | if (doubleValue > 100) doubleValue = 100;
49 |
50 | returnValue = doubleValue / 100.0;
51 | }
52 |
53 | return returnValue;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Converters/DoubleToPercentConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace ColorPickerDemo.Converters
23 | {
24 | public class DoubleToPercentConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | double returnValue = 0;
29 |
30 | if (value is double doubleValue)
31 | {
32 | if (doubleValue < 0) doubleValue = 0;
33 | if (doubleValue > 1.0) doubleValue = 1.0;
34 |
35 | returnValue = 100.0 * doubleValue;
36 | }
37 |
38 | return returnValue;
39 | }
40 |
41 | public object ConvertBack(object value, Type targetType, object parameter, string language)
42 | {
43 | double returnValue = 0;
44 |
45 | if (value is double doubleValue)
46 | {
47 | if (doubleValue < 0) doubleValue = 0;
48 | if (doubleValue > 100) doubleValue = 100;
49 |
50 | returnValue = doubleValue / 100.0;
51 | }
52 |
53 | return returnValue;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Converters/PercentToDoubleConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI.Xaml.Data;
21 |
22 | namespace ColorPickerDemo.Converters
23 | {
24 | public class PercentToDoubleConverter : IValueConverter
25 | {
26 | public object Convert(object value, Type targetType, object parameter, string language)
27 | {
28 | double returnValue = 0;
29 |
30 | if (value is double doubleValue)
31 | {
32 | if (doubleValue < 0) doubleValue = 0;
33 | if (doubleValue > 100) doubleValue = 100;
34 |
35 | returnValue = doubleValue / 100.0;
36 | }
37 |
38 | return returnValue;
39 | }
40 |
41 | public object ConvertBack(object value, Type targetType, object parameter, string language)
42 | {
43 | double returnValue = 0;
44 |
45 | if (value is double doubleValue)
46 | {
47 | if (doubleValue < 0) doubleValue = 0;
48 | if (doubleValue > 1.0) doubleValue = 1.0;
49 |
50 | returnValue = 100.0 * doubleValue;
51 | }
52 |
53 | return returnValue;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | LIFX Demo
7 | Daniel
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Common/CollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System.Collections.Generic;
20 | using System.Linq;
21 |
22 | namespace System.Collections.ObjectModel
23 | {
24 | public static class CollectionExtensions
25 | {
26 | public static ObservableCollection ToObservableCollection(this IEnumerable items)
27 | {
28 | ObservableCollection returnValue = new ObservableCollection();
29 |
30 | foreach (T item in items)
31 | {
32 | returnValue.Add(item);
33 | }
34 |
35 | return returnValue;
36 | }
37 |
38 | public static ObservableCollection ToObservableCollection(this IQueryable items)
39 | {
40 | ObservableCollection returnValue = new ObservableCollection();
41 |
42 | foreach (T item in items)
43 | {
44 | returnValue.Add(item);
45 | }
46 |
47 | return returnValue;
48 | }
49 |
50 | public static void AddRange(this ObservableCollection target, IEnumerable source)
51 | {
52 | foreach (T item in source)
53 | {
54 | target.Add(item);
55 | }
56 | }
57 |
58 | public static void AddRange(this ObservableCollection target, IQueryable source)
59 | {
60 | foreach (T item in source)
61 | {
62 | target.Add(item);
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Common/TaskExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Linq.Expressions;
21 | using System.Threading.Tasks;
22 | using Windows.ApplicationModel.Core;
23 | using Windows.UI.Core;
24 |
25 | namespace LifxDemo.Common
26 | {
27 | ///
28 | /// Defines extension methods for objects of type Task
29 | ///
30 | public static class MyTaskExtensions
31 | {
32 | ///
33 | /// Waits for an async method to complete and returns the result.
34 | ///
35 | /// The type of the result.
36 | /// The Task object that is awaited.
37 | /// Returns the result of the completed task.
38 | public static T WaitForResult(this Task task)
39 | {
40 | task.Wait();
41 | return task.Result;
42 | }
43 |
44 | public static void RunAsync(this Task task)
45 | {
46 | task.ContinueWith(t => { if (t.Exception != null) throw t.Exception; });
47 | }
48 |
49 | public static async Task RunOnUiThread(this DispatchedHandler agileCallback)
50 | {
51 | CoreApplicationView view = CoreApplication.MainView; ;
52 |
53 | if (view == null)
54 | {
55 | try
56 | {
57 | view = CoreApplication.GetCurrentView();
58 | }
59 | catch
60 | {
61 | view = null;
62 | }
63 | }
64 |
65 | if (view != null)
66 | {
67 | if (view.CoreWindow != null)
68 | {
69 | if (view.CoreWindow.Dispatcher != null)
70 | {
71 | await view.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, agileCallback);
72 | }
73 | else
74 | {
75 | // ***
76 | // *** Run on the current thread since there is no dispatcher.
77 | // ***
78 | agileCallback.Invoke();
79 | }
80 | }
81 | else
82 | {
83 | // ***
84 | // *** Run on the current thread since there is no core window.
85 | // ***
86 | agileCallback.Invoke();
87 | }
88 | }
89 | else
90 | {
91 | // ***
92 | // *** Run on the current thread since there is no current view.
93 | // ***
94 | agileCallback.Invoke();
95 | }
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/LifxListPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
15 |
16 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
46 |
47 |
55 |
56 |
65 |
66 |
75 |
76 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Models/LifxColor.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using Microsoft.Toolkit.Uwp;
20 | using Windows.UI;
21 | using Windows.UI.Xaml.Media;
22 |
23 | namespace LifxDemo.Models
24 | {
25 | public class Lifx
26 | {
27 | public static class Rgb
28 | {
29 | public static Color FromLifx(ushort hue, ushort saturation, ushort brightness)
30 | {
31 | Color returnValue = Colors.White;
32 |
33 | double h = Lifx.Hue.FromLifx(hue);
34 | double s = Lifx.Saturation.FromLifx(saturation);
35 | double v = Lifx.Brightness.FromLifx(brightness);
36 | returnValue = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.FromHsv(h, s, v);
37 |
38 | return returnValue;
39 | }
40 |
41 | public static SolidColorBrush CreateSolidColorBrush(ushort hue, ushort saturation, ushort brightness)
42 | {
43 | Color color = Lifx.Rgb.FromLifx(hue, saturation, brightness);
44 | return new SolidColorBrush(color);
45 | }
46 | }
47 |
48 | public static class Hue
49 | {
50 | public static ushort FromLifx(ushort hue)
51 | {
52 | return (ushort)((hue / 65535.0) * 360);
53 | }
54 |
55 | public static ushort ToLifx(ushort hue)
56 | {
57 | return (ushort)(hue / 360.0 * 65535.0);
58 | }
59 |
60 | public static ushort FromColor(Color color)
61 | {
62 | HsvColor hsv = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.ToHsv(color);
63 | return Lifx.Hue.ToLifx((ushort)hsv.H);
64 | }
65 | }
66 |
67 | public static class Brightness
68 | {
69 | public static double FromLifx(ushort brightness)
70 | {
71 | return (double)(brightness / 65535.0);
72 | }
73 |
74 | public static ushort ToLifx(double brightness)
75 | {
76 | return (ushort)(brightness * 65535.0);
77 | }
78 |
79 | public static ushort FromColor(Color color)
80 | {
81 | HsvColor hsv = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.ToHsv(color);
82 | return Lifx.Brightness.ToLifx((ushort)hsv.V);
83 | }
84 | }
85 |
86 | public static class Saturation
87 | {
88 | public static double FromLifx(ushort saturation)
89 | {
90 | return (double)(saturation / 65535.0);
91 | }
92 |
93 | public static ushort ToLifx(double saturation)
94 | {
95 | return (ushort)(saturation * 65535.0);
96 | }
97 |
98 | public static ushort FromColor(Color color)
99 | {
100 | HsvColor hsv = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.ToHsv(color);
101 | return Lifx.Saturation.ToLifx((ushort)hsv.S);
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/MainPageViewModel.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System.Collections.Generic;
20 | using LifxDemo.Events;
21 | using Prism.Commands;
22 | using Prism.Events;
23 |
24 | namespace LifxDemo.ViewModels
25 | {
26 | public class MainPageViewModel : LifxViewModelBase
27 | {
28 | private SubscriptionToken _token = null;
29 |
30 | public MainPageViewModel()
31 | : base(false)
32 | {
33 | }
34 |
35 | public DelegateCommand RefreshCommand { get; set; }
36 | public DelegateCommand DiscoverCommand { get; set; }
37 |
38 | protected override void OnRegisterCommands()
39 | {
40 | this.RefreshCommand = this.RegisterCommand(this.OnRefreshCommand, this.OnCanRefreshCommand);
41 | this.DiscoverCommand = this.RegisterCommand(this.OnDiscoverCommand, this.OnCanDiscoverCommand);
42 | base.OnRegisterCommands();
43 | }
44 |
45 | public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary viewModelState)
46 | {
47 | base.OnNavigatedTo(e, viewModelState);
48 |
49 | _token = this.EventAggregator.GetEvent().Subscribe((args) => this.OnMessageEvent(args));
50 | }
51 |
52 | public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary viewModelState, bool suspending)
53 | {
54 | base.OnNavigatingFrom(e, viewModelState, suspending);
55 |
56 | if (_token != null)
57 | {
58 | this.EventAggregator.GetEvent().Unsubscribe(_token);
59 | }
60 | }
61 |
62 | protected void OnRefreshCommand()
63 | {
64 | this.EventAggregator.GetEvent().Publish(new RefreshEventArgs(false));
65 | }
66 |
67 | protected bool OnCanRefreshCommand()
68 | {
69 | return this.NotIsActive;
70 | }
71 |
72 | protected void OnDiscoverCommand()
73 | {
74 | this.EventAggregator.GetEvent().Publish(new RefreshEventArgs(true));
75 | }
76 |
77 | protected bool OnCanDiscoverCommand()
78 | {
79 | return this.NotIsActive;
80 | }
81 |
82 | protected void OnMessageEvent(MessageEventArgs e)
83 | {
84 | this.CurrentMessageType = e.Type;
85 | this.CurrentMessage = e.Message;
86 |
87 | this.RaisePropertyChanged(nameof(this.CurrentMessage));
88 | this.RaisePropertyChanged(nameof(this.ShowInformationIcon));
89 | this.RaisePropertyChanged(nameof(this.ShowWarningIcon));
90 | this.RaisePropertyChanged(nameof(this.ShowErrorIcon));
91 | this.RaisePropertyChanged(nameof(this.ShowMessage));
92 | }
93 |
94 | public string CurrentMessage { get; set; } = string.Empty;
95 | public bool ShowMessage => !string.IsNullOrEmpty(this.CurrentMessage);
96 | public MessageEventType CurrentMessageType { get; set; } = MessageEventType.None;
97 | public bool ShowInformationIcon => this.CurrentMessageType == MessageEventType.Information;
98 | public bool ShowWarningIcon => this.CurrentMessageType == MessageEventType.Warning;
99 | public bool ShowErrorIcon => this.CurrentMessageType == MessageEventType.Error;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using LifxDemo.Common;
20 | using Microsoft.Practices.Unity;
21 | using Prism.Unity.Windows;
22 | using Prism.Windows.AppModel;
23 | using System.Threading.Tasks;
24 | using Windows.ApplicationModel.Activation;
25 | using Windows.ApplicationModel.Resources;
26 | using Windows.UI;
27 | using Windows.UI.ViewManagement;
28 | using Windows.UI.Xaml;
29 |
30 | namespace LifxDemo
31 | {
32 | public partial class App : PrismUnityApplication
33 | {
34 | protected async override Task OnInitializeAsync(IActivatedEventArgs args)
35 | {
36 | await this.OnInitializeTitleBar();
37 | await this.OnRegisterTypes(this.Container);
38 | await base.OnInitializeAsync(args);
39 |
40 | this.UnhandledException += this.App_UnhandledException;
41 | }
42 |
43 | private void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
44 | {
45 |
46 | }
47 |
48 | protected override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
49 | {
50 | this.NavigationService.Navigate(MagicString.Page.Main, null);
51 | return Task.FromResult(0);
52 | }
53 |
54 | private Task OnInitializeTitleBar()
55 | {
56 | ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
57 |
58 | titleBar.BackgroundColor = (Color)Application.Current.Resources["TitleBarBackgroundColor"];
59 | titleBar.ForegroundColor = (Color)Application.Current.Resources["TitleBarForegroundColor"];
60 | titleBar.ButtonBackgroundColor = (Color)Application.Current.Resources["TitleBarButtonBackgroundColor"];
61 | titleBar.ButtonForegroundColor = (Color)Application.Current.Resources["TitleBarForegroundColor"];
62 | titleBar.InactiveBackgroundColor = (Color)Application.Current.Resources["TitleBarInactiveBackgroundColor"];
63 | titleBar.InactiveForegroundColor = (Color)Application.Current.Resources["TitleBarInactiveForegroundColor"];
64 | titleBar.ButtonInactiveBackgroundColor = (Color)Application.Current.Resources["TitleBarButtonInactiveBackgroundColor"];
65 | titleBar.ButtonInactiveForegroundColor = (Color)Application.Current.Resources["TitleBarInactiveForegroundColor"];
66 | titleBar.ButtonHoverBackgroundColor = (Color)Application.Current.Resources["TitleBarButtonHoverBackgroundColor"];
67 | titleBar.ButtonHoverForegroundColor = (Color)Application.Current.Resources["TitleBarForegroundColor"];
68 | titleBar.ButtonPressedBackgroundColor = (Color)Application.Current.Resources["TitleBarButtonPressedBackgroundColor"];
69 | titleBar.ButtonPressedForegroundColor = (Color)Application.Current.Resources["TitleBarForegroundColor"];
70 |
71 | return Task.FromResult(0);
72 | }
73 |
74 | private Task OnRegisterTypes(IUnityContainer container)
75 | {
76 | // ***
77 | // *** System/applications instances.
78 | // ***
79 | container.RegisterInstance(this.NavigationService);
80 | container.RegisterInstance(this.SessionStateService);
81 | container.RegisterInstance(this.EventAggregator);
82 | container.RegisterInstance(new ResourceLoaderAdapter(new ResourceLoader()));
83 |
84 | return Task.FromResult(0);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
56 |
57 |
58 |
59 |
63 |
64 |
65 |
66 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
82 |
83 |
88 |
89 |
94 |
95 |
105 |
106 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Extensions/GeometryExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.Foundation;
21 | using Windows.UI.Xaml;
22 |
23 | namespace Porrey.Controls.ColorPicker
24 | {
25 | public static class GeometryExtensions
26 | {
27 | ///
28 | /// Gets the point of a FrameworkElement on which the element
29 | /// rotates.
30 | ///
31 | /// A FrameworkElement object.
32 | /// A Point representing the center point on which the object rotates.
33 | public static Point Center(this FrameworkElement element)
34 | {
35 | return new Point(element.ActualWidth * element.RenderTransformOrigin.X, element.ActualHeight * element.RenderTransformOrigin.Y);
36 | }
37 |
38 | ///
39 | /// Returns a point translated around the specified origin point.
40 | ///
41 | /// The point to be translated.
42 | /// The origin point.
43 | /// The translated point.
44 | public static Point TranslateFromOrigin(this Point point, Point origin)
45 | {
46 | return new Point(point.X - origin.X, origin.Y - point.Y);
47 | }
48 |
49 | ///
50 | /// Applies the Math.Atan2 method to a point.
51 | ///
52 | /// The point to which Math.Atan2 is applied.
53 | /// The result of the Math.Atan2 method.
54 | public static double Atan2(this Point point)
55 | {
56 | return Math.Atan2(point.X, point.Y);
57 | }
58 |
59 | ///
60 | /// Converts and angle in Radians to Degrees.
61 | ///
62 | /// The angle to be converted.
63 | /// The angle converted to degrees.
64 | public static double ToDegrees(this double radians)
65 | {
66 | return radians * 180.0 / Math.PI;
67 | }
68 |
69 | ///
70 | /// Gets the angle of a line segment in Radians.
71 | ///
72 | /// The first point in the line segment.
73 | /// The second point in the line segment.
74 | /// The angle of the line segment in radians.
75 | public static double GetAngle(this Point from, Point to)
76 | {
77 | double returnValue = 0;
78 |
79 | // ***
80 | // *** Translate the "to" point using the "from" point as the origin.
81 | // ***
82 | Point p = to.TranslateFromOrigin(from);
83 |
84 | // ***
85 | // *** Use Atan2 to get angles between 0 and 180 (Quadrants I and IV) and
86 | // *** 0 and -180 (quadrants II and III).
87 | // ***
88 | returnValue = p.Atan2();
89 |
90 | return returnValue;
91 | }
92 |
93 | ///
94 | /// Converts an angle in Degrees to a Rotation value that can be
95 | /// applied to the RotateTransform.
96 | ///
97 | /// An angle in degrees.
98 | /// A rotation value between 0 and 360 where 0 represents
99 | /// an item that is not rotated.
100 | public static double ToRotation(this double angleDegrees)
101 | {
102 | return 360 - angleDegrees;
103 | }
104 |
105 | public static int GetHueFromRotation(this double rotationDegrees)
106 | {
107 | int returnValue = 0;
108 | double angle = -1 * (rotationDegrees % 360);
109 |
110 | if (angle < 0)
111 | {
112 | returnValue = (int)(360 + angle) + 1;
113 | }
114 | else
115 | {
116 | returnValue = (int)angle + 1;
117 | }
118 |
119 | return returnValue;
120 | }
121 |
122 | public static double GetRotationFromHue(this int hue)
123 | {
124 | return 360.0 - hue;
125 | }
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/IndicatorArrow.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.Foundation;
21 | using Windows.UI;
22 | using Windows.UI.Xaml;
23 | using Windows.UI.Xaml.Controls;
24 | using Windows.UI.Xaml.Media;
25 | using Windows.UI.Xaml.Shapes;
26 |
27 | namespace Porrey.Controls.ColorPicker
28 | {
29 | public class IndicatorArrow : Control
30 | {
31 | public static readonly DependencyProperty OutlineBrushProperty = DependencyProperty.Register("OutlineBrush", typeof(SolidColorBrush), typeof(IndicatorArrow), new PropertyMetadata(new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)), new PropertyChangedCallback(OnOutlineBrushPropertyChanged)));
32 | public static readonly DependencyProperty OutlineThicknessProperty = DependencyProperty.Register("OutlineThickness", typeof(double), typeof(IndicatorArrow), new PropertyMetadata(3, new PropertyChangedCallback(OnOutlineThicknessPropertyChanged)));
33 |
34 | public event EventHandler> OutlineBrushChanged = null;
35 | public event EventHandler> OutlineThicknessChanged = null;
36 |
37 | public IndicatorArrow()
38 | {
39 | this.DefaultStyleKey = typeof(IndicatorArrow);
40 | this.SizeChanged += this.IndicatorArrow_SizeChanged;
41 | }
42 |
43 | public SolidColorBrush OutlineBrush
44 | {
45 | get
46 | {
47 | return (SolidColorBrush)this.GetValue(OutlineBrushProperty);
48 | }
49 | set
50 | {
51 | this.SetValue(OutlineBrushProperty, value);
52 | }
53 | }
54 |
55 | public double OutlineThickness
56 | {
57 | get
58 | {
59 | return (double)this.GetValue(OutlineThicknessProperty);
60 | }
61 | set
62 | {
63 | this.SetValue(OutlineThicknessProperty, value);
64 | }
65 | }
66 |
67 | protected override void OnApplyTemplate()
68 | {
69 | base.OnApplyTemplate();
70 |
71 | if (this.GetTemplateChild("PART_Triangle") is Polygon triangle)
72 | {
73 | this.Triangle = triangle;
74 | }
75 | }
76 |
77 | private void IndicatorArrow_SizeChanged(object sender, SizeChangedEventArgs e)
78 | {
79 | this.Triangle.Points.Clear();
80 | this.Triangle.Points.Add(new Point(0, 0));
81 | this.Triangle.Points.Add(new Point(this.ActualWidth, 0));
82 | this.Triangle.Points.Add(new Point(this.ActualWidth / 2.0, this.ActualHeight));
83 | }
84 |
85 | protected Polygon Triangle { get; set; }
86 |
87 | private static void OnOutlineBrushPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
88 | {
89 | if (d is IndicatorArrow instance)
90 | {
91 | instance.RaiseOutlineBrushChangedEvent((SolidColorBrush)e.OldValue, (SolidColorBrush)e.NewValue);
92 | }
93 | }
94 |
95 | private static void OnOutlineThicknessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
96 | {
97 | if (d is IndicatorArrow instance)
98 | {
99 | instance.RaiseOutlineThicknessChangedEvent(Convert.ToDouble(e.OldValue), Convert.ToDouble(e.NewValue));
100 | }
101 | }
102 |
103 | protected virtual void RaiseOutlineBrushChangedEvent(SolidColorBrush previousValue, SolidColorBrush newValue)
104 | {
105 | ValueChangedEventArgs e = new ValueChangedEventArgs(previousValue, newValue);
106 | this.OnOutlineBrushChangedEvent(this, e);
107 | this.OutlineBrushChanged?.Invoke(this, e);
108 | }
109 |
110 | protected virtual void OnOutlineBrushChangedEvent(object sender, ValueChangedEventArgs e)
111 | {
112 | }
113 |
114 | protected virtual void RaiseOutlineThicknessChangedEvent(double previousValue, double newValue)
115 | {
116 | ValueChangedEventArgs e = new ValueChangedEventArgs(previousValue, newValue);
117 | this.OnOutlineThicknessChangedEvent(this, e);
118 | this.OutlineThicknessChanged?.Invoke(this, e);
119 | }
120 |
121 | protected virtual void OnOutlineThicknessChangedEvent(object sender, ValueChangedEventArgs e)
122 | {
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 | using System.Threading.Tasks;
4 | using Porrey.Controls.ColorPicker;
5 | using Windows.UI;
6 | using Windows.UI.Xaml;
7 | using Windows.UI.Xaml.Controls;
8 | using Windows.UI.Xaml.Media;
9 |
10 | namespace ColorPickerDemo
11 | {
12 | public partial class MainPage : Page, INotifyPropertyChanged
13 | {
14 | public event PropertyChangedEventHandler PropertyChanged = null;
15 |
16 | public MainPage()
17 | {
18 | this.InitializeComponent();
19 | this.ColorPicker.HueChanged += this.ColorPicker_HueChanged;
20 | }
21 |
22 | private void ColorPicker_HueChanged(object sender, ValueChangedEventArgs e)
23 | {
24 | this.PowerSwitch.Hue = e.NewValue;
25 | }
26 |
27 | protected void RaisedPropertyChangedEvent([CallerMemberName] string propertyName = null)
28 | {
29 | this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
30 | }
31 |
32 | private void Button_Click(object sender, RoutedEventArgs e)
33 | {
34 | this.ColorPicker.ResetColor();
35 | }
36 |
37 | private void ColorPicker_SelectedColorChanged(object sender, ValueChangedEventArgs e)
38 | {
39 | this.RaisedPropertyChangedEvent(nameof(this.SelectedColor));
40 | this.RaisedPropertyChangedEvent(nameof(this.Red));
41 | this.RaisedPropertyChangedEvent(nameof(this.RedPercent));
42 | this.RaisedPropertyChangedEvent(nameof(this.Green));
43 | this.RaisedPropertyChangedEvent(nameof(this.GreenPercent));
44 | this.RaisedPropertyChangedEvent(nameof(this.Blue));
45 | this.RaisedPropertyChangedEvent(nameof(this.BluePercent));
46 | this.RaisedPropertyChangedEvent(nameof(this.HueFontColor));
47 | this.RaisedPropertyChangedEvent(nameof(this.RedFontColor));
48 | this.RaisedPropertyChangedEvent(nameof(this.GreenFontColor));
49 | this.RaisedPropertyChangedEvent(nameof(this.BlueFontColor));
50 | }
51 |
52 | public SolidColorBrush SelectedColor => this.ColorPicker.SelectedColor;
53 | public SolidColorBrush Red => new SolidColorBrush(Color.FromArgb(255, this.SelectedColor.Color.R, 0, 0));
54 | public SolidColorBrush Green => this.SelectedColor != null ? new SolidColorBrush(Color.FromArgb(255, 0, this.SelectedColor.Color.G, 0)) : new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
55 | public SolidColorBrush Blue => this.SelectedColor != null ? new SolidColorBrush(Color.FromArgb(255, 0, 0, this.SelectedColor.Color.B)) : new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
56 |
57 | public double RedPercent => this.Red.Color.R / 255.0;
58 | public double GreenPercent => this.Green.Color.G / 255.0;
59 | public double BluePercent => this.Blue.Color.B / 255.0;
60 |
61 | public SolidColorBrush HueFontColor
62 | {
63 | get
64 | {
65 | Color returnValue = Colors.White;
66 |
67 | // ***
68 | // *** Get the three color values weighted. The total
69 | // *** sum of the three colors below will be 255.
70 | // ***
71 | double r = this.SelectedColor.Color.R * 0.333;
72 | double g = this.SelectedColor.Color.G * 0.533;
73 | double b = this.SelectedColor.Color.B * 0.134;
74 |
75 | // ***
76 | // *** Color sum: the larger the value the "brighter" the
77 | // *** color. Inversely, the lower the number the darker
78 | // *** the color.
79 | // ***
80 | double sum = r + g + b;
81 |
82 | // ***
83 | // *** Calculate the total as a percentage.
84 | // ***
85 | double colorMagnitude = sum / 255.0;
86 |
87 | // ***
88 | // *** If the color is "lighter" use a black
89 | // *** font color otherwise use white.
90 | // ***
91 | if (colorMagnitude > .5)
92 | {
93 | returnValue = Colors.Black;
94 | }
95 | else
96 | {
97 | returnValue = Colors.White;
98 | }
99 |
100 | return new SolidColorBrush(returnValue);
101 | }
102 | }
103 |
104 | public SolidColorBrush RedFontColor
105 | {
106 | get
107 | {
108 | Color returnValue = Colors.Wheat;
109 |
110 | if (this.RedPercent < .60)
111 | {
112 | returnValue = Colors.Black;
113 | }
114 |
115 | return new SolidColorBrush(returnValue);
116 | }
117 | }
118 |
119 | public SolidColorBrush GreenFontColor
120 | {
121 | get
122 | {
123 | Color returnValue = Colors.Wheat;
124 |
125 | if (this.GreenPercent < .60)
126 | {
127 | returnValue = Colors.Black;
128 | }
129 |
130 | return new SolidColorBrush(returnValue);
131 | }
132 | }
133 |
134 | public SolidColorBrush BlueFontColor
135 | {
136 | get
137 | {
138 | Color returnValue = Colors.Wheat;
139 |
140 | if (this.BluePercent < .60)
141 | {
142 | returnValue = Colors.Black;
143 | }
144 |
145 | return new SolidColorBrush(returnValue);
146 | }
147 | }
148 |
149 | public async Task AutoRotate()
150 | {
151 | await Task.Delay(2000);
152 |
153 | for (int i = 0; i <= 360; i++)
154 | {
155 | this.ColorPicker.Hue = i;
156 | await Task.Delay(75);
157 | }
158 | }
159 | }
160 | }
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Models/ApiRateLimiter.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Threading;
21 | using System.Threading.Tasks;
22 | using LifxDemo.Common;
23 | using Windows.UI.Xaml;
24 |
25 | namespace LifxDemo.Models
26 | {
27 | public class ApiRateLimiter : IDisposable
28 | {
29 | private ReaderWriterLockSlim _lock = new ReaderWriterLockSlim();
30 | private bool _locked = false;
31 |
32 | protected Action Callback { get; set; }
33 | protected DateTime LastCall { get; set; } = DateTime.MinValue;
34 | protected Action LastSkippedAction { get; set; }
35 | protected DispatcherTimer CallbackTimer { get; } = new DispatcherTimer();
36 | protected TimeSpan CallbackDelay { get; set; }
37 |
38 | public ApiRateLimiter(TimeSpan interval, Action callback, TimeSpan callbackDelay)
39 | {
40 | this.Interval = interval;
41 | this.Callback = callback;
42 | this.CallbackDelay = callbackDelay;
43 |
44 | this.CallbackTimer.Interval = this.CallbackDelay;
45 | this.CallbackTimer.Tick += this.CallbackTimer_Tick;
46 | }
47 |
48 | private void CallbackTimer_Tick(object sender, object e)
49 | {
50 | try
51 | {
52 | // ***
53 | // *** Stop the timer, it only needs to fire once.
54 | // ***
55 | this.CallbackTimer.Stop();
56 |
57 | // ***
58 | // *** Execute the last skipped action.
59 | // ***
60 | if (this.LastSkippedAction != null)
61 | {
62 | Task.Factory.StartNew(this.LastSkippedAction).RunAsync();
63 | }
64 | }
65 | finally
66 | {
67 | // ***
68 | // *** execute the callback.
69 | // ***
70 | this.Callback.Invoke();
71 | }
72 | }
73 |
74 | public Task Lock()
75 | {
76 | _lock.EnterWriteLock();
77 |
78 | try
79 | {
80 | _locked = true;
81 | }
82 | finally
83 | {
84 | _lock.ExitWriteLock();
85 | }
86 |
87 | return Task.FromResult(0);
88 | }
89 |
90 | public Task Unlock()
91 | {
92 | _lock.EnterWriteLock();
93 |
94 | try
95 | {
96 | _locked = false;
97 | }
98 | finally
99 | {
100 | _lock.ExitWriteLock();
101 | }
102 |
103 | return Task.FromResult(0);
104 | }
105 |
106 | public Task IsLocked()
107 | {
108 | bool returnValue = false;
109 |
110 | _lock.EnterReadLock();
111 | try
112 | {
113 | returnValue = _locked;
114 | }
115 | finally
116 | {
117 | _lock.ExitReadLock();
118 | }
119 |
120 | return Task.FromResult(returnValue);
121 | }
122 |
123 | public TimeSpan Interval { get; set; }
124 |
125 | public async void ThrottleMethod(Action action)
126 | {
127 | if (!await this.IsLocked())
128 | {
129 | // ***
130 | // *** Must wait at least 50ms between calls per the documentation.
131 | // ***
132 | if (DateTime.Now.Subtract(this.LastCall) > this.Interval)
133 | {
134 | try
135 | {
136 | // ***
137 | // *** Execute the action.
138 | // ***
139 | Task.Factory.StartNew(action).RunAsync();
140 | }
141 | finally
142 | {
143 | // ***
144 | // *** Mark the time of the last action.
145 | // ***
146 | this.LastCall = DateTime.Now;
147 |
148 | // ***
149 | // *** Reset the last skipped action so that an older
150 | // *** action is not executed after a newer action.
151 | // ***
152 | this.LastSkippedAction = null;
153 |
154 | if (this.CallbackDelay != TimeSpan.Zero)
155 | {
156 | // ***
157 | // *** Start the timer; each time the time is started it will
158 | // *** reset. This prevents the timer event from being fired until
159 | // *** the full interval has elapsed. For example, if the timer
160 | // *** interval is set to 1 second, and the Start() method is called
161 | // *** 100 times in a second, the timer event will fire just once.
162 | // ***
163 | this.CallbackTimer.Start();
164 | }
165 | }
166 | }
167 | else
168 | {
169 | // ***
170 | // *** Store the last skipped action.
171 | // ***
172 | this.LastSkippedAction = action;
173 | }
174 | }
175 | }
176 |
177 | public void Dispose()
178 | {
179 | this.CallbackTimer.Stop();
180 | this.CallbackTimer.Tick -= this.CallbackTimer_Tick;
181 | }
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/LifxViewModelBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Collections.Generic;
21 | using System.Threading.Tasks;
22 | using LifxDemo.Events;
23 | using Prism.Commands;
24 | using Prism.Events;
25 | using Windows.UI.Core;
26 | using Windows.UI.Xaml;
27 |
28 | namespace LifxDemo.ViewModels
29 | {
30 | public abstract class LifxViewModelBase : ViewModelBase
31 | {
32 | private SubscriptionToken _token1 = null;
33 | private SubscriptionToken _token2 = null;
34 |
35 | public LifxViewModelBase(bool attachApplicationEvents)
36 | {
37 | this.OnRegisterCommands();
38 |
39 | if (attachApplicationEvents)
40 | {
41 | _token1 = this.EventAggregator.GetEvent().Subscribe((e) => this.OnApplicationReadyEvent(e), ThreadOption.UIThread);
42 | _token2 = this.EventAggregator.GetEvent().Subscribe((e) => this.OnApplicationClosingEvent(e), ThreadOption.UIThread);
43 | }
44 | }
45 |
46 | protected CoreDispatcher Dispatcher { get; set; }
47 | protected IEventAggregator EventAggregator => ServiceLocator.Current.GetInstance();
48 | protected IResourceLoader ResourceLoader => ServiceLocator.Current.GetInstance();
49 |
50 | private bool _isActive = false;
51 | public bool IsActive
52 | {
53 | get
54 | {
55 | return _isActive;
56 | }
57 | set
58 | {
59 | this.SetProperty(ref _isActive, value);
60 | this.RaisePropertyChanged(nameof(this.NotIsActive));
61 | }
62 | }
63 |
64 | public bool NotIsActive
65 | {
66 | get
67 | {
68 | return !this.IsActive;
69 | }
70 | }
71 |
72 | public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary viewModelState)
73 | {
74 | base.OnNavigatedTo(e, viewModelState);
75 |
76 | // ***
77 | // *** Get and set the dispatcher.
78 | // ***
79 | this.Dispatcher = Window.Current.Dispatcher;
80 |
81 | // ***
82 | // *** Publish this event for view models that are attached to a
83 | // *** control and do not receive the normal OnNavigatedTo event.
84 | // ***
85 | this.EventAggregator.GetEvent().Publish(new ApplicationReadyEventArgs(this.Dispatcher, e, viewModelState));
86 | }
87 |
88 | public override void OnNavigatingFrom(NavigatingFromEventArgs e, Dictionary viewModelState, bool suspending)
89 | {
90 | base.OnNavigatingFrom(e, viewModelState, suspending);
91 |
92 | // ***
93 | // *** Publish this event for view models that are attached to a
94 | // *** control and do not receive the normal OnNavigatingFrom event.
95 | // ***
96 | this.EventAggregator.GetEvent().Publish(new ApplicationClosingEventArgs(e, viewModelState, suspending));
97 |
98 | if (_token1 != null)
99 | {
100 | this.EventAggregator.GetEvent().Unsubscribe(_token1);
101 | }
102 |
103 | if (_token2 != null)
104 | {
105 | this.EventAggregator.GetEvent().Unsubscribe(_token2);
106 | }
107 | }
108 |
109 | protected virtual Task OnApplicationReadyEvent(ApplicationReadyEventArgs e)
110 | {
111 | return Task.FromResult(0);
112 | }
113 |
114 | protected virtual Task OnApplicationClosingEvent(ApplicationClosingEventArgs e)
115 | {
116 | return Task.FromResult(0);
117 | }
118 |
119 | protected IList Commands { get; private set; } = new List();
120 |
121 | protected DelegateCommand RegisterCommand(Action executeMethod)
122 | {
123 | DelegateCommand command = new DelegateCommand(executeMethod);
124 | this.Commands.Add(command);
125 | return command;
126 | }
127 |
128 | protected DelegateCommand RegisterCommand(Action executeMethod, Func canExecuteMethod)
129 | {
130 | DelegateCommand command = new DelegateCommand(executeMethod, canExecuteMethod);
131 | this.Commands.Add(command);
132 | return command;
133 | }
134 |
135 | protected DelegateCommand RegisterCommand(Action executeMethod)
136 | {
137 | DelegateCommand command = new DelegateCommand(executeMethod);
138 | this.Commands.Add(command);
139 | return command;
140 | }
141 |
142 | protected DelegateCommand RegisterCommand(Action executeMethod, Func canExecuteMethod)
143 | {
144 | DelegateCommand command = new DelegateCommand(executeMethod, canExecuteMethod);
145 | this.Commands.Add(command);
146 | return command;
147 | }
148 |
149 | protected Task RefreshCommands()
150 | {
151 | foreach (DelegateCommandBase command in this.Commands)
152 | {
153 | command.RaiseCanExecuteChanged();
154 | }
155 |
156 | return Task.FromResult(0);
157 | }
158 |
159 | protected virtual void OnRegisterCommands()
160 | {
161 | }
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Solution.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.26730.15
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Color Picker Demo", "Color Picker Demo\Color Picker Demo.csproj", "{465683C1-ADEB-4EEF-9FF8-9E286284EF39}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Color Picker Control", "Color Picker Control\Color Picker Control.csproj", "{54AC9C22-E869-49EF-9DEF-C055CBA4C372}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LIFX Demo", "LIFX Demo\LIFX Demo.csproj", "{5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Debug|ARM = Debug|ARM
16 | Debug|x64 = Debug|x64
17 | Debug|x86 = Debug|x86
18 | Release|Any CPU = Release|Any CPU
19 | Release|ARM = Release|ARM
20 | Release|x64 = Release|x64
21 | Release|x86 = Release|x86
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|Any CPU.ActiveCfg = Debug|x86
25 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|ARM.ActiveCfg = Debug|ARM
26 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|ARM.Build.0 = Debug|ARM
27 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|ARM.Deploy.0 = Debug|ARM
28 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x64.ActiveCfg = Debug|x64
29 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x64.Build.0 = Debug|x64
30 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x64.Deploy.0 = Debug|x64
31 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x86.ActiveCfg = Debug|x86
32 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x86.Build.0 = Debug|x86
33 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Debug|x86.Deploy.0 = Debug|x86
34 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|Any CPU.ActiveCfg = Release|x86
35 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|ARM.ActiveCfg = Release|ARM
36 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|ARM.Build.0 = Release|ARM
37 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|ARM.Deploy.0 = Release|ARM
38 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x64.ActiveCfg = Release|x64
39 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x64.Build.0 = Release|x64
40 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x64.Deploy.0 = Release|x64
41 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x86.ActiveCfg = Release|x86
42 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x86.Build.0 = Release|x86
43 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}.Release|x86.Deploy.0 = Release|x86
44 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|Any CPU.Build.0 = Debug|Any CPU
46 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|ARM.ActiveCfg = Debug|ARM
47 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|ARM.Build.0 = Debug|ARM
48 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|x64.ActiveCfg = Debug|x64
49 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|x64.Build.0 = Debug|x64
50 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|x86.ActiveCfg = Debug|x86
51 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Debug|x86.Build.0 = Debug|x86
52 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|Any CPU.ActiveCfg = Release|Any CPU
53 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|Any CPU.Build.0 = Release|Any CPU
54 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|ARM.ActiveCfg = Release|ARM
55 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|ARM.Build.0 = Release|ARM
56 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|x64.ActiveCfg = Release|x64
57 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|x64.Build.0 = Release|x64
58 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|x86.ActiveCfg = Release|x86
59 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}.Release|x86.Build.0 = Release|x86
60 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|Any CPU.ActiveCfg = Debug|x86
61 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|ARM.ActiveCfg = Debug|ARM
62 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|ARM.Build.0 = Debug|ARM
63 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|ARM.Deploy.0 = Debug|ARM
64 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x64.ActiveCfg = Debug|x64
65 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x64.Build.0 = Debug|x64
66 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x64.Deploy.0 = Debug|x64
67 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x86.ActiveCfg = Debug|x86
68 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x86.Build.0 = Debug|x86
69 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Debug|x86.Deploy.0 = Debug|x86
70 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|Any CPU.ActiveCfg = Release|x86
71 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|ARM.ActiveCfg = Release|ARM
72 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|ARM.Build.0 = Release|ARM
73 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|ARM.Deploy.0 = Release|ARM
74 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x64.ActiveCfg = Release|x64
75 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x64.Build.0 = Release|x64
76 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x64.Deploy.0 = Release|x64
77 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x86.ActiveCfg = Release|x86
78 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x86.Build.0 = Release|x86
79 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}.Release|x86.Deploy.0 = Release|x86
80 | EndGlobalSection
81 | GlobalSection(SolutionProperties) = preSolution
82 | HideSolutionNode = FALSE
83 | EndGlobalSection
84 | GlobalSection(ExtensibilityGlobals) = postSolution
85 | SolutionGuid = {E80B507F-DC71-413A-A4BC-28F05EBD1FD5}
86 | EndGlobalSection
87 | EndGlobal
88 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/LifxListPageViewModel.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Collections.ObjectModel;
21 | using System.Linq;
22 | using System.Net.Sockets;
23 | using System.Threading.Tasks;
24 | using LifxDemo.Common;
25 | using LifxDemo.Events;
26 | using LifxNet;
27 | using Windows.UI.Core;
28 |
29 | namespace LifxDemo.ViewModels
30 | {
31 | public class LifxListPageViewModel : LifxViewModelBase
32 | {
33 | public LifxListPageViewModel()
34 | : base(true)
35 | {
36 | }
37 |
38 | public ObservableCollection Items { get; } = new ObservableCollection();
39 | protected LifxClient LifxClient { get; set; }
40 |
41 | protected async override Task OnApplicationReadyEvent(ApplicationReadyEventArgs e)
42 | {
43 | try
44 | {
45 | // ***
46 | // *** Subscribe to refresh events.
47 | // ***
48 | this.EventAggregator.GetEvent().Subscribe((args) => this.OnRefreshEvent(args));
49 |
50 | // ***
51 | // *** Set the dispatcher.
52 | // ***
53 | this.Dispatcher = e.Dispatcher;
54 |
55 | // ***
56 | // *** Initialize the LIFX client.
57 | // ***
58 | await this.InitializeLifxClient();
59 | }
60 | catch (Exception ex)
61 | {
62 | this.EventAggregator.GetEvent().Publish(new MessageEventArgs(ex));
63 | }
64 | }
65 |
66 | protected override async Task OnApplicationClosingEvent(ApplicationClosingEventArgs e)
67 | {
68 | // ***
69 | // *** Release the LFIX client.
70 | // ***
71 | await this.DeinitializeLifxClient();
72 | }
73 |
74 | protected async Task InitializeLifxClient()
75 | {
76 | this.EventAggregator.GetEvent().Publish(new MessageEventArgs(MessageEventType.Information, "Ready."));
77 |
78 | try
79 | {
80 | // ***
81 | // *** Configure the LIFX client.
82 | // ***
83 | this.LifxClient = await LifxClient.CreateAsync();
84 | this.LifxClient.DeviceDiscovered += this.LifxClient_DeviceDiscovered;
85 | this.LifxClient.DeviceLost += this.LifxClient_DeviceLost;
86 | this.LifxClient.StartDeviceDiscovery();
87 | }
88 | catch (SocketException)
89 | {
90 | string message = this.ResourceLoader.GetString(MagicString.Resource.LifxApplicationError);
91 | this.EventAggregator.GetEvent().Publish(new MessageEventArgs(MessageEventType.Error, message));
92 | }
93 | catch (Exception ex)
94 | {
95 | this.EventAggregator.GetEvent().Publish(new MessageEventArgs(MessageEventType.Error, ex.Message));
96 | }
97 | }
98 |
99 | protected Task DeinitializeLifxClient()
100 | {
101 | // ***
102 | // *** Dispose the current items.
103 | // ***
104 | foreach (LifxItem item in this.Items)
105 | {
106 | item.Dispose();
107 | }
108 |
109 | // ***
110 | // *** Clear the list.
111 | // ***
112 | this.Items.Clear();
113 |
114 | // ***
115 | // *** Release the client.
116 | // ***
117 | if (this.LifxClient != null)
118 | {
119 | this.LifxClient.StopDeviceDiscovery();
120 | this.LifxClient.DeviceDiscovered -= this.LifxClient_DeviceDiscovered;
121 | this.LifxClient.DeviceLost -= this.LifxClient_DeviceLost;
122 | this.LifxClient.Dispose();
123 | this.LifxClient = null;
124 | }
125 |
126 | return Task.FromResult(0);
127 | }
128 |
129 | private async void LifxClient_DeviceDiscovered(object sender, LifxClient.DeviceDiscoveryEventArgs e)
130 | {
131 | await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
132 | {
133 | if (e.Device is LightBulb bulb)
134 | {
135 | LifxItem lifxBulb = new LifxItem(this.LifxClient, bulb);
136 |
137 | if (!this.Items.Contains(lifxBulb))
138 | {
139 | this.Items.Add(lifxBulb);
140 | }
141 | }
142 | });
143 | }
144 |
145 | private async void LifxClient_DeviceLost(object sender, LifxClient.DeviceDiscoveryEventArgs e)
146 | {
147 | await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
148 | {
149 | if (e.Device is LightBulb bulb)
150 | {
151 | LifxItem item = this.Items.Where(t => t.HostName == bulb.HostName).SingleOrDefault();
152 |
153 | if (item != null)
154 | {
155 | item.Dispose();
156 | this.Items.Remove(item);
157 | }
158 | }
159 | });
160 | }
161 |
162 | private LifxItem _selectedItem = null;
163 | public LifxItem SelectedItem
164 | {
165 | get
166 | {
167 | return _selectedItem;
168 | }
169 | set
170 | {
171 | this.SetProperty(ref _selectedItem, value);
172 | this.EventAggregator.GetEvent().Publish(new SelectedItemEventArgs(value));
173 | }
174 | }
175 |
176 | protected async void OnRefreshEvent(RefreshEventArgs e)
177 | {
178 | if (e.Rediscover)
179 | {
180 | await this.DeinitializeLifxClient();
181 | await Task.Delay(1000);
182 | await this.InitializeLifxClient();
183 | }
184 | else
185 | {
186 | foreach (LifxItem item in this.Items)
187 | {
188 | item.Update().RunAsync();
189 | }
190 | }
191 | }
192 | }
193 | }
194 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Themes/TogglePowerSwitch.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
150 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 |
125 | # MightyMoose
126 | *.mm.*
127 | AutoTest.Net/
128 |
129 | # Web workbench (sass)
130 | .sass-cache/
131 |
132 | # Installshield output folder
133 | [Ee]xpress/
134 |
135 | # DocProject is a documentation generator add-in
136 | DocProject/buildhelp/
137 | DocProject/Help/*.HxT
138 | DocProject/Help/*.HxC
139 | DocProject/Help/*.hhc
140 | DocProject/Help/*.hhk
141 | DocProject/Help/*.hhp
142 | DocProject/Help/Html2
143 | DocProject/Help/html
144 |
145 | # Click-Once directory
146 | publish/
147 |
148 | # Publish Web Output
149 | *.[Pp]ublish.xml
150 | *.azurePubxml
151 | # TODO: Comment the next line if you want to checkin your web deploy settings
152 | # but database connection strings (with potential passwords) will be unencrypted
153 | *.pubxml
154 | *.publishproj
155 |
156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
157 | # checkin your Azure Web App publish settings, but sensitive information contained
158 | # in these scripts will be unencrypted
159 | PublishScripts/
160 |
161 | # NuGet Packages
162 | #*.nupkg
163 | # The packages folder can be ignored because of Package Restore
164 | **/packages/*
165 | # except build/, which is used as an MSBuild target.
166 | !**/packages/build/
167 | # Uncomment if necessary however generally it will be regenerated when needed
168 | #!**/packages/repositories.config
169 | # NuGet v3's project.json files produces more ignorable files
170 | *.nuget.props
171 | *.nuget.targets
172 |
173 | # Microsoft Azure Build Output
174 | csx/
175 | *.build.csdef
176 |
177 | # Microsoft Azure Emulator
178 | ecf/
179 | rcf/
180 |
181 | # Windows Store app package directories and files
182 | AppPackages/
183 | BundleArtifacts/
184 | Package.StoreAssociation.xml
185 | _pkginfo.txt
186 |
187 | # Visual Studio cache files
188 | # files ending in .cache can be ignored
189 | *.[Cc]ache
190 | # but keep track of directories ending in .cache
191 | !*.[Cc]ache/
192 |
193 | # Others
194 | ClientBin/
195 | ~$*
196 | *~
197 | *.dbmdl
198 | *.dbproj.schemaview
199 | *.jfm
200 | *.pfx
201 | *.publishsettings
202 | orleans.codegen.cs
203 |
204 | # Since there are multiple workflows, uncomment next line to ignore bower_components
205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
206 | #bower_components/
207 |
208 | # RIA/Silverlight projects
209 | Generated_Code/
210 |
211 | # Backup & report files from converting an old project file
212 | # to a newer Visual Studio version. Backup files are not needed,
213 | # because we have git ;-)
214 | _UpgradeReport_Files/
215 | Backup*/
216 | UpgradeLog*.XML
217 | UpgradeLog*.htm
218 |
219 | # SQL Server files
220 | *.mdf
221 | *.ldf
222 | *.ndf
223 |
224 | # Business Intelligence projects
225 | *.rdl.data
226 | *.bim.layout
227 | *.bim_*.settings
228 |
229 | # Microsoft Fakes
230 | FakesAssemblies/
231 |
232 | # GhostDoc plugin setting file
233 | *.GhostDoc.xml
234 |
235 | # Node.js Tools for Visual Studio
236 | .ntvs_analysis.dat
237 | node_modules/
238 |
239 | # Typescript v1 declaration files
240 | typings/
241 |
242 | # Visual Studio 6 build log
243 | *.plg
244 |
245 | # Visual Studio 6 workspace options file
246 | *.opt
247 |
248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
249 | *.vbw
250 |
251 | # Visual Studio LightSwitch build output
252 | **/*.HTMLClient/GeneratedArtifacts
253 | **/*.DesktopClient/GeneratedArtifacts
254 | **/*.DesktopClient/ModelManifest.xml
255 | **/*.Server/GeneratedArtifacts
256 | **/*.Server/ModelManifest.xml
257 | _Pvt_Extensions
258 |
259 | # Paket dependency manager
260 | .paket/paket.exe
261 | paket-files/
262 |
263 | # FAKE - F# Make
264 | .fake/
265 |
266 | # JetBrains Rider
267 | .idea/
268 | *.sln.iml
269 |
270 | # CodeRush
271 | .cr/
272 |
273 | # Python Tools for Visual Studio (PTVS)
274 | __pycache__/
275 | *.pyc
276 |
277 | # Cake - Uncomment if you are using it
278 | # tools/**
279 | # !tools/packages.config
280 |
281 | # Telerik's JustMock configuration file
282 | *.jmconfig
283 |
284 | # BizTalk build output
285 | *.btp.cs
286 | *.btm.cs
287 | *.odx.cs
288 | *.xsd.cs
289 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/LifxControllerPageViewModel.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Collections.Generic;
21 | using System.Collections.ObjectModel;
22 | using System.Linq;
23 | using System.Threading.Tasks;
24 | using LifxDemo.Events;
25 | using Prism.Events;
26 | using Windows.UI;
27 | using Windows.UI.Xaml.Media;
28 |
29 | namespace LifxDemo.ViewModels
30 | {
31 | public class LifxControllerPageViewModel : LifxViewModelBase
32 | {
33 | private SubscriptionToken _token = null;
34 | private bool _setting = false;
35 |
36 | public LifxControllerPageViewModel()
37 | : base(true)
38 | {
39 | WhiteItem[] whites = new WhiteItem[]
40 | {
41 | new WhiteItem() { Name = "Ultra Warm", Kelvin = 2500, Color = new SolidColorBrush(Color.FromArgb(255, 255, 222, 184)) },
42 | new WhiteItem() { Name = "Incandescent", Kelvin = 2750, Color = new SolidColorBrush(Color.FromArgb(255, 255, 225, 184))},
43 | new WhiteItem() { Name = "Warm", Kelvin = 3000 , Color = new SolidColorBrush(Color.FromArgb(255, 255, 228, 194))},
44 | new WhiteItem() { Name = "Neutral Warm", Kelvin = 3200, Color = new SolidColorBrush(Color.FromArgb(255, 254, 229, 198)) },
45 | new WhiteItem() { Name = "Neutral", Kelvin = 3500, Color = new SolidColorBrush(Color.FromArgb(255, 253, 229, 201)) },
46 | new WhiteItem() { Name = "Cool", Kelvin = 4000, Color = new SolidColorBrush(Color.FromArgb(255, 255, 235, 210)) },
47 | new WhiteItem() { Name = "Cool Daylight", Kelvin = 4500, Color = new SolidColorBrush(Color.FromArgb(255, 255, 239, 217)) },
48 | new WhiteItem() { Name = "Soft Daylight", Kelvin = 5000, Color = new SolidColorBrush(Color.FromArgb(255, 254, 240, 220)) },
49 | new WhiteItem() { Name = "Daylight", Kelvin = 5500, Color = new SolidColorBrush(Color.FromArgb(255, 253, 240, 225)) },
50 | new WhiteItem() { Name = "Noon Daylight", Kelvin = 6000, Color = new SolidColorBrush(Color.FromArgb(255, 249, 242, 230)) },
51 | new WhiteItem() { Name = "Bright Daylight", Kelvin = 6500, Color = new SolidColorBrush(Color.FromArgb(255, 246, 242, 235)) },
52 | new WhiteItem() { Name = "Cloudy Daylight", Kelvin = 7000, Color = new SolidColorBrush(Color.FromArgb(255, 242, 240, 237)) },
53 | new WhiteItem() { Name = "Blue Daylight", Kelvin = 7500, Color = new SolidColorBrush(Color.FromArgb(255, 236, 237, 238)) },
54 | new WhiteItem() { Name = "Blue Overcast", Kelvin = 8000, Color = new SolidColorBrush(Color.FromArgb(255, 237, 241, 246)) },
55 | new WhiteItem() { Name = "Blue Water", Kelvin = 8500, Color = new SolidColorBrush(Color.FromArgb(255, 235, 242, 249)) },
56 | new WhiteItem() { Name = "Blue Ice", Kelvin = 9000, Color = new SolidColorBrush(Color.FromArgb(255, 235, 244, 253)) }
57 | };
58 |
59 | this.WhiteItems.AddRange(whites);
60 | }
61 |
62 | public ObservableCollection WhiteItems { get; } = new ObservableCollection();
63 |
64 | protected override async Task OnApplicationReadyEvent(ApplicationReadyEventArgs e)
65 | {
66 | this.SelectedItem = null;
67 | _token = this.EventAggregator.GetEvent().Subscribe((args) => this.OnSelectedItemEvent(args));
68 |
69 | await base.OnApplicationReadyEvent(e);
70 | }
71 |
72 | protected override Task OnApplicationClosingEvent(ApplicationClosingEventArgs e)
73 | {
74 | this.SelectedItem = null;
75 |
76 | if (_token != null)
77 | {
78 | this.EventAggregator.GetEvent().Unsubscribe(_token);
79 | }
80 |
81 | return base.OnApplicationClosingEvent(e);
82 | }
83 |
84 | protected async void OnSelectedItemEvent(SelectedItemEventArgs e)
85 | {
86 | this.SelectedItem = e.LifxBulb;
87 |
88 | if (this.SelectedItem != null)
89 | {
90 | await this.SelectedItem.Update();
91 | }
92 | }
93 |
94 | private LifxItem _selectedItem = null;
95 | public LifxItem SelectedItem
96 | {
97 | get
98 | {
99 | return _selectedItem;
100 | }
101 | set
102 | {
103 | this.SetProperty(ref _selectedItem, value);
104 |
105 | if (_selectedItem != null)
106 | {
107 | // ***
108 | // *** The kelvin value on the bulb may not be an exact
109 | // *** match for an item in the list. Find the closest
110 | // *** item.
111 | // ***
112 | var closestItem = (from tbl in this.WhiteItems
113 | select new
114 | {
115 | d = Math.Abs(tbl.Kelvin - _selectedItem.Kelvin),
116 | k = tbl.Kelvin
117 | }).OrderBy(s => s.d).FirstOrDefault();
118 |
119 | // ***
120 | // *** Select the item.
121 | // ***
122 | WhiteItem item = this.WhiteItems.Where(r => r.Kelvin == closestItem.k).SingleOrDefault();
123 |
124 | try
125 | {
126 | _setting = true;
127 |
128 | if (item != null)
129 | {
130 | this.SelectedWhiteItem = item;
131 | }
132 | else
133 | {
134 | this.SelectedWhiteItem = null;
135 | }
136 | }
137 | finally
138 | {
139 | _setting = false;
140 | }
141 | }
142 | }
143 | }
144 |
145 | private WhiteItem _selectedWhiteItem = null;
146 | public WhiteItem SelectedWhiteItem
147 | {
148 | get
149 | {
150 | return _selectedWhiteItem;
151 | }
152 | set
153 | {
154 | this.SetProperty(ref _selectedWhiteItem, value);
155 |
156 | if (this.SelectedItem != null && !_setting)
157 | {
158 | this.SelectedItem.Saturation = 0;
159 | this.SelectedItem.Kelvin = _selectedWhiteItem.Kelvin;
160 | }
161 | }
162 | }
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Strings/en-US/Resources.resw:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | Another LIFX application is running preventing this application from retrieving the status of your LIFX bulbs.
122 |
123 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/Views/LifxControllerPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
33 |
34 |
41 |
42 |
49 |
50 |
56 |
57 |
61 |
62 |
63 |
64 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
78 |
79 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
98 |
99 |
108 |
109 |
110 |
111 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
133 |
134 |
142 |
143 |
152 |
153 |
162 |
163 |
171 |
172 |
181 |
182 |
183 |
184 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Demo/Color Picker Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {465683C1-ADEB-4EEF-9FF8-9E286284EF39}
8 | AppContainerExe
9 | Properties
10 | ColorPickerDemo
11 | ColorPickerDemo
12 | en-US
13 | UAP
14 | 10.0.22000.0
15 | 10.0.18362.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | true
20 | ColorPickerDemo_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\x86\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | x86
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\ARM\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | ARM
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\ARM\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | ARM
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\x64\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | x64
75 | false
76 | prompt
77 | true
78 |
79 |
80 | bin\x64\Release\
81 | TRACE;NETFX_CORE;WINDOWS_UWP
82 | true
83 | ;2008
84 | pdbonly
85 | x64
86 | false
87 | prompt
88 | true
89 | true
90 |
91 |
92 | PackageReference
93 |
94 |
95 |
96 | App.xaml
97 |
98 |
99 |
100 |
101 |
102 | MainPage.xaml
103 |
104 |
105 |
106 |
107 |
108 | Designer
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | MSBuild:Compile
124 | Designer
125 |
126 |
127 | MSBuild:Compile
128 | Designer
129 |
130 |
131 |
132 |
133 | 6.2.14
134 |
135 |
136 |
137 |
138 | {54ac9c22-e869-49ef-9def-c055cba4c372}
139 | Color Picker Control
140 |
141 |
142 |
143 |
144 |
145 |
146 | 14.0
147 |
148 |
149 |
156 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/ViewModels/LifxItem.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using System.Threading.Tasks;
21 | using LifxDemo.Common;
22 | using LifxDemo.Models;
23 | using LifxNet;
24 | using Prism.Mvvm;
25 | using Windows.UI;
26 | using Windows.UI.Core;
27 | using Windows.UI.Xaml;
28 | using Windows.UI.Xaml.Media;
29 |
30 | namespace LifxDemo.ViewModels
31 | {
32 | public class LifxItem : BindableBase, IDisposable
33 | {
34 | protected ApiRateLimiter Limiter { get; set; }
35 |
36 | public LifxItem(LifxClient client, LightBulb lightBulb)
37 | {
38 | this.Client = client;
39 | this.LightBulb = lightBulb;
40 | this.Limiter = new ApiRateLimiter(TimeSpan.FromMilliseconds(50), this.ApiLimiterCallback, TimeSpan.Zero);
41 |
42 | this.Update().RunAsync();
43 | }
44 |
45 | private async void ApiLimiterCallback()
46 | {
47 | await this.Update();
48 | }
49 |
50 | protected LifxClient Client { get; set; }
51 | protected LightBulb LightBulb { get; set; }
52 |
53 | public string HostName => this.LightBulb?.HostName;
54 | public string MacAddress => this.LightBulb?.MacAddressName.ToLower();
55 |
56 | private string _name = "Unknown";
57 | public string Name
58 | {
59 | get
60 | {
61 | return _name;
62 | }
63 | set
64 | {
65 | this.SetProperty(ref _name, value);
66 | }
67 | }
68 |
69 | private SolidColorBrush _lightColor = new SolidColorBrush(Colors.White);
70 | public SolidColorBrush LightColor
71 | {
72 | get
73 | {
74 | return _lightColor;
75 | }
76 | set
77 | {
78 | this.SetProperty(ref _lightColor, value);
79 | }
80 | }
81 |
82 | private bool _isOn = false;
83 | public bool IsOn
84 | {
85 | get
86 | {
87 | return _isOn;
88 | }
89 | set
90 | {
91 | this.SetProperty(ref _isOn, value);
92 | this.Limiter.ThrottleMethod(async () => { await this.SetPower(value); });
93 | }
94 | }
95 |
96 | private ushort _hue = 0;
97 | public ushort Hue
98 | {
99 | get
100 | {
101 | return _hue;
102 | }
103 | set
104 | {
105 | this.SetProperty(ref _hue, value);
106 | this.Limiter.ThrottleMethod(async () => { await this.SetHue(_hue); });
107 | this.SetColor();
108 | }
109 | }
110 |
111 | private double _saturation = 0;
112 | public double Saturation
113 | {
114 | get
115 | {
116 | return _saturation;
117 | }
118 | set
119 | {
120 | this.SetProperty(ref _saturation, value);
121 | this.Limiter.ThrottleMethod(async () => { await this.SetSaturation(_saturation); });
122 | this.SetColor();
123 | }
124 | }
125 |
126 | private double _brightness = 0;
127 | public double Brightness
128 | {
129 | get
130 | {
131 | return _brightness;
132 | }
133 | set
134 | {
135 | this.SetProperty(ref _brightness, value);
136 | this.Limiter.ThrottleMethod(async () => { await this.SetBrightness(_brightness); });
137 | this.SetColor();
138 | }
139 | }
140 |
141 | private ushort _kelvin = 0;
142 | public ushort Kelvin
143 | {
144 | get
145 | {
146 | return _kelvin;
147 | }
148 | set
149 | {
150 | this.SetProperty(ref _kelvin, value);
151 | this.SetKelvin(_kelvin);
152 | this.SetColor();
153 | }
154 | }
155 |
156 | public async Task Update()
157 | {
158 | try
159 | {
160 | // ***
161 | // *** Locking the API limiter prevents all calls
162 | // *** from being made.
163 | // ***
164 | await this.Limiter.Lock();
165 |
166 | if (this.Client != null)
167 | {
168 | LightStateResponse state = await this.Client.GetLightStateAsync(this.LightBulb);
169 |
170 | if (state != null)
171 | {
172 | // ***
173 | // *** Since this is a view model, it is possible that the bindable properties such
174 | // *** as LightColor are connected to the UI. For that reason, only update them on
175 | // *** the UI thread.
176 | // ***
177 | await ((DispatchedHandler)(() =>
178 | {
179 | this.Name = state.Label;
180 | this.IsOn = state.IsOn;
181 | this.Hue = Lifx.Hue.FromLifx(state.Hue);
182 | this.Saturation = Lifx.Saturation.FromLifx(state.Saturation);
183 | this.Brightness = Lifx.Brightness.FromLifx(state.Brightness);
184 | this.Kelvin = state.Kelvin;
185 | this.LightColor = Lifx.Rgb.CreateSolidColorBrush(state.Hue, state.Saturation, state.Brightness);
186 | })).RunOnUiThread();
187 | }
188 | }
189 | }
190 | finally
191 | {
192 | // ***
193 | // *** Unlock the API limiter.
194 | // ***
195 | await this.Limiter.Unlock();
196 | }
197 | }
198 |
199 | public async Task SetPower(bool on)
200 | {
201 | if (this.Client != null)
202 | {
203 | await this.Client.SetDevicePowerStateAsync(this.LightBulb, on);
204 | }
205 | }
206 |
207 | public async Task SetHue(ushort hue)
208 | {
209 | ushort h = Lifx.Hue.ToLifx(hue);
210 | ushort s = Lifx.Saturation.ToLifx(this.Saturation);
211 | ushort b = Lifx.Brightness.ToLifx(this.Brightness);
212 |
213 | await this.Client.SetColorAsync(this.LightBulb, h, s, b, this.Kelvin, TimeSpan.Zero);
214 | }
215 |
216 | public async Task SetSaturation(double saturation)
217 | {
218 | ushort h = Lifx.Hue.ToLifx(this.Hue);
219 | ushort s = Lifx.Saturation.ToLifx(saturation);
220 | ushort b = Lifx.Brightness.ToLifx(this.Brightness);
221 |
222 | await this.Client.SetColorAsync(this.LightBulb, h, s, b, this.Kelvin, TimeSpan.Zero);
223 | }
224 |
225 | public async Task SetBrightness(double brightness)
226 | {
227 | ushort h = Lifx.Hue.ToLifx(this.Hue);
228 | ushort s = Lifx.Saturation.ToLifx(this.Saturation);
229 | ushort b = Lifx.Brightness.ToLifx(brightness);
230 |
231 | await this.Client.SetColorAsync(this.LightBulb, h, s, b, this.Kelvin, TimeSpan.Zero);
232 | }
233 |
234 | public Task SetKelvin(ushort kelvin)
235 | {
236 | ushort h = Lifx.Hue.ToLifx(this.Hue);
237 | ushort s = Lifx.Saturation.ToLifx(this.Saturation);
238 | ushort b = Lifx.Brightness.ToLifx(this.Brightness);
239 |
240 | this.Client.SetColorAsync(this.LightBulb, h, s, b, kelvin, TimeSpan.Zero);
241 | return Task.FromResult(0);
242 | }
243 |
244 | public void Dispose()
245 | {
246 | //this.UpdateStateTimer.Tick -= this.UpdateStateTimer_Tick;
247 |
248 | if (this.Limiter != null)
249 | {
250 | this.Limiter.Dispose();
251 | this.Limiter = null;
252 | }
253 |
254 | if (this.Client != null)
255 | {
256 | // ***
257 | // *** Do not dispose the client here, it is shared and
258 | // *** will be disposed by the owner.
259 | // ***
260 | this.Client = null;
261 | }
262 |
263 | if (this.LightBulb != null)
264 | {
265 | this.LightBulb = null;
266 | }
267 | }
268 |
269 | protected async void SetColor()
270 | {
271 | ushort h = Lifx.Hue.ToLifx(this.Hue);
272 | ushort s = Lifx.Saturation.ToLifx(this.Saturation);
273 | ushort b = Lifx.Brightness.ToLifx(this.Brightness);
274 |
275 | await ((DispatchedHandler)(() =>
276 | {
277 | this.LightColor = Lifx.Rgb.CreateSolidColorBrush(h, s, b);
278 | })).RunOnUiThread();
279 | }
280 | }
281 | }
282 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Themes/ColorPickerWheel.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
10 |
11 |
13 |
14 |
16 |
17 | .65
18 | .85
19 | 1.0
20 | 0.0
21 |
22 | .8
23 | 0.9
24 | 1.0
25 |
26 |
28 |
29 |
31 |
32 |
173 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/TogglePowerSwitch.cs:
--------------------------------------------------------------------------------
1 | // Copyright © 2018-2022 Daniel Porrey
2 | //
3 | // This file is part of the Color Picker Control solution.
4 | //
5 | // Color Picker Control is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 | //
10 | // Color Picker Control is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 | //
15 | // You should have received a copy of the GNU General Public License
16 | // along with the Color Picker Control solution. If not,
17 | // see http://www.gnu.org/licenses/.
18 | //
19 | using System;
20 | using Windows.UI;
21 | using Windows.UI.Xaml;
22 | using Windows.UI.Xaml.Controls;
23 | using Windows.UI.Xaml.Media;
24 | using Windows.UI.Xaml.Shapes;
25 |
26 | namespace Porrey.Controls.ColorPicker
27 | {
28 | [TemplateVisualState(Name = "UncheckedNormal", GroupName = "CombinedStates")]
29 | [TemplateVisualState(Name = "UncheckedPointerOver", GroupName = "CombinedStates")]
30 | [TemplateVisualState(Name = "UncheckedPressed", GroupName = "CombinedStates")]
31 | [TemplateVisualState(Name = "UncheckedDisabled", GroupName = "CombinedStates")]
32 | [TemplateVisualState(Name = "CheckedNormal", GroupName = "CombinedStates")]
33 | [TemplateVisualState(Name = "CheckedPointerOver", GroupName = "CombinedStates")]
34 | [TemplateVisualState(Name = "CheckedPressed", GroupName = "CombinedStates")]
35 | [TemplateVisualState(Name = "CheckedDisabled", GroupName = "CombinedStates")]
36 | [TemplateVisualState(Name = "IndeterminateNormal", GroupName = "CombinedStates")]
37 | [TemplateVisualState(Name = "IndeterminatePointerOver", GroupName = "CombinedStates")]
38 | [TemplateVisualState(Name = "IndeterminatePressed", GroupName = "CombinedStates")]
39 | [TemplateVisualState(Name = "IndeterminateDisabled", GroupName = "CombinedStates")]
40 | [TemplatePart(Name = "PART_OuterBorder", Type = typeof(Border))]
41 | [TemplatePart(Name = "PART_Icon", Type = typeof(BitmapIcon))]
42 | [TemplatePart(Name = "PART_Glow", Type = typeof(Ellipse))]
43 | public class TogglePowerSwitch : CheckBox
44 | {
45 | public TogglePowerSwitch()
46 | {
47 | this.DefaultStyleKey = typeof(TogglePowerSwitch);
48 | this.SizeChanged += this.TogglePowerSwitch_SizeChanged;
49 | }
50 |
51 | private void TogglePowerSwitch_SizeChanged(object sender, SizeChangedEventArgs e)
52 | {
53 | if (this.OuterBorder != null)
54 | {
55 | this.OuterBorder.Width = e.NewSize.Width;
56 | this.OuterBorder.Height = e.NewSize.Height;
57 | this.OuterBorder.CornerRadius = new CornerRadius(e.NewSize.Width);
58 |
59 | this.SetGlowVerticalOffset();
60 | }
61 | }
62 |
63 | public static readonly DependencyProperty HueProperty = DependencyProperty.Register("Hue", typeof(int), typeof(TogglePowerSwitch), new PropertyMetadata(0, new PropertyChangedCallback(OnHuePropertyChanged)));
64 | public static readonly DependencyProperty SaturationProperty = DependencyProperty.Register("Saturation", typeof(double), typeof(TogglePowerSwitch), new PropertyMetadata(1.0, new PropertyChangedCallback(OnSaturationPropertyChanged)));
65 | public static readonly DependencyProperty BrightnessProperty = DependencyProperty.Register("Brightness", typeof(double), typeof(TogglePowerSwitch), new PropertyMetadata(.5, new PropertyChangedCallback(OnBrightnessPropertyChanged)));
66 | public static readonly DependencyProperty LightColorProperty = DependencyProperty.Register("LightColor", typeof(Color), typeof(TogglePowerSwitch), new PropertyMetadata(Color.FromArgb(255, 255, 0, 0), new PropertyChangedCallback(OnLightColorPropertyChanged)));
67 |
68 | public int Hue
69 | {
70 | get
71 | {
72 | return (int)this.GetValue(HueProperty);
73 | }
74 | set
75 | {
76 | this.SetValue(HueProperty, value);
77 | }
78 | }
79 |
80 | public double Saturation
81 | {
82 | get
83 | {
84 | return (double)this.GetValue(SaturationProperty);
85 | }
86 | set
87 | {
88 | this.SetValue(SaturationProperty, value);
89 | }
90 | }
91 |
92 | public double Brightness
93 | {
94 | get
95 | {
96 | return (double)this.GetValue(BrightnessProperty);
97 | }
98 | set
99 | {
100 | this.SetValue(BrightnessProperty, value);
101 | }
102 | }
103 |
104 | public Color LightColor
105 | {
106 | get
107 | {
108 | return (Color)this.GetValue(LightColorProperty);
109 | }
110 | set
111 | {
112 | this.SetValue(LightColorProperty, value);
113 | }
114 | }
115 |
116 | private static void OnHuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
117 | {
118 | if (d is TogglePowerSwitch instance)
119 | {
120 | if (instance.Hue >= 0 && instance.Hue <= 360)
121 | {
122 | instance.SetSelectedColor(instance.Hue, instance.Saturation, instance.Brightness);
123 | }
124 | else
125 | {
126 | throw new ArgumentOutOfRangeException("Hue", "Hue must be a value from 0 to 360.");
127 | }
128 | }
129 | }
130 |
131 | private static void OnSaturationPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
132 | {
133 | if (d is TogglePowerSwitch instance)
134 | {
135 | if (instance.Saturation >= 0 && instance.Saturation <= 1.0)
136 | {
137 | instance.SetSelectedColor(instance.Hue, instance.Saturation, instance.Brightness);
138 | }
139 | else
140 | {
141 | throw new ArgumentOutOfRangeException("Saturation", "Saturation must be a value from 0 to 1.0.");
142 | }
143 | }
144 | }
145 |
146 | private static void OnBrightnessPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
147 | {
148 | if (d is TogglePowerSwitch instance)
149 | {
150 | if (instance.Brightness >= 0 && instance.Brightness <= 1.0)
151 | {
152 | if (instance.Glow != null)
153 | {
154 | instance.Glow.Opacity = instance.Brightness;
155 | }
156 | }
157 | else
158 | {
159 | throw new ArgumentOutOfRangeException("Brightness", "Brightness must be a value from 0 to 1.0.");
160 | }
161 | }
162 | }
163 |
164 | private static void OnLightColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
165 | {
166 | if (d is TogglePowerSwitch instance)
167 | {
168 | var lightColor = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.ToHsv(instance.LightColor);
169 | instance.SetSelectedColor((int)(360 * lightColor.H), lightColor.S, lightColor.V);
170 | }
171 | }
172 |
173 | protected override void OnApplyTemplate()
174 | {
175 | if (this.GetTemplateChild("PART_OuterBorder") is Border border)
176 | {
177 | this.OuterBorder = border;
178 | }
179 |
180 | if (this.GetTemplateChild("PART_Glow") is Ellipse glow)
181 | {
182 | this.Glow = glow;
183 | }
184 |
185 | this.SetSelectedColor(0, 1.0, 1.0);
186 |
187 | base.OnApplyTemplate();
188 | }
189 |
190 | protected Border OuterBorder { get; set; }
191 | protected Ellipse Glow { get; set; }
192 |
193 | protected void SetSelectedColor(int hue, double saturation, double brightness)
194 | {
195 | if (this.Glow?.Fill is LinearGradientBrush fill)
196 | {
197 | fill.GradientStops[4].Color = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.FromHsv(hue, saturation, brightness, 1.0);
198 | fill.GradientStops[3].Color = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.FromHsv(hue, saturation, brightness, 0.8);
199 | fill.GradientStops[2].Color = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.FromHsv(hue, saturation, brightness, 0.6);
200 | fill.GradientStops[1].Color = Microsoft.Toolkit.Uwp.Helpers.ColorHelper.FromHsv(hue, saturation, brightness, 0.4);
201 | }
202 | }
203 |
204 | protected void SetGlowVerticalOffset()
205 | {
206 | if (this.Glow?.RenderTransform is CompositeTransform transform)
207 | {
208 | transform.TranslateY = .205 * (this.OuterBorder.ActualHeight - this.OuterBorder.BorderThickness.Top);
209 | }
210 | }
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/Color Picker Control/Color Picker Control.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {54AC9C22-E869-49EF-9DEF-C055CBA4C372}
8 | Library
9 | Properties
10 | Porrey.Controls.ColorPicker
11 | Porrey.Controls.ColorPicker
12 | en-US
13 | UAP
14 | 10.0.22000.0
15 | 10.0.18362.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 |
20 |
21 | AnyCPU
22 | true
23 | full
24 | false
25 | bin\Debug\
26 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
27 | prompt
28 | 4
29 |
30 |
31 | AnyCPU
32 | pdbonly
33 | true
34 | bin\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | prompt
37 | 4
38 |
39 |
40 | x86
41 | true
42 | bin\x86\Debug\
43 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
44 | ;2008
45 | full
46 | x86
47 | false
48 | prompt
49 |
50 |
51 | x86
52 | bin\x86\Release\
53 | TRACE;NETFX_CORE;WINDOWS_UWP
54 | true
55 | ;2008
56 | pdbonly
57 | x86
58 | false
59 | prompt
60 |
61 |
62 | ARM
63 | true
64 | bin\ARM\Debug\
65 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
66 | ;2008
67 | full
68 | ARM
69 | false
70 | prompt
71 |
72 |
73 | ARM
74 | bin\ARM\Release\
75 | TRACE;NETFX_CORE;WINDOWS_UWP
76 | true
77 | ;2008
78 | pdbonly
79 | ARM
80 | false
81 | prompt
82 |
83 |
84 | x64
85 | true
86 | bin\x64\Debug\
87 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
88 | ;2008
89 | full
90 | x64
91 | false
92 | prompt
93 |
94 |
95 | x64
96 | bin\x64\Release\
97 | TRACE;NETFX_CORE;WINDOWS_UWP
98 | true
99 | ;2008
100 | pdbonly
101 | x64
102 | false
103 | prompt
104 |
105 |
106 | PackageReference
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | 6.2.14
121 |
122 |
123 | 7.1.2
124 |
125 |
126 | 4.3.0
127 |
128 |
129 |
130 |
131 | MSBuild:Compile
132 | Designer
133 | Porrey.Controls.ColorPicker
134 |
135 |
136 | MSBuild:Compile
137 | Designer
138 | Porrey.Controls.ColorPicker
139 |
140 |
141 | MSBuild:Compile
142 | Designer
143 | Porrey.Controls.ColorPicker
144 |
145 |
146 | MSBuild:Compile
147 | Designer
148 | Porrey.Controls.ColorPicker
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 | 14.0
161 |
162 |
163 |
170 |
--------------------------------------------------------------------------------
/Source/Color Picker Solution/LIFX Demo/LIFX Demo.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {5CD7CD95-3A3C-4EB2-8A5F-BA411FE882C8}
8 | AppContainerExe
9 | Properties
10 | LifxDemo
11 | LifxDemo
12 | en-US
13 | UAP
14 | 10.0.19041.0
15 | 10.0.18362.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | true
20 | LIFX Demo_TemporaryKey.pfx
21 |
22 |
23 | true
24 | bin\x86\Debug\
25 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
26 | ;2008
27 | full
28 | x86
29 | false
30 | prompt
31 | true
32 |
33 |
34 | bin\x86\Release\
35 | TRACE;NETFX_CORE;WINDOWS_UWP
36 | true
37 | ;2008
38 | pdbonly
39 | x86
40 | false
41 | prompt
42 | true
43 | true
44 |
45 |
46 | true
47 | bin\ARM\Debug\
48 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
49 | ;2008
50 | full
51 | ARM
52 | false
53 | prompt
54 | true
55 |
56 |
57 | bin\ARM\Release\
58 | TRACE;NETFX_CORE;WINDOWS_UWP
59 | true
60 | ;2008
61 | pdbonly
62 | ARM
63 | false
64 | prompt
65 | true
66 | true
67 |
68 |
69 | true
70 | bin\x64\Debug\
71 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
72 | ;2008
73 | full
74 | x64
75 | false
76 | prompt
77 | true
78 |
79 |
80 | bin\x64\Release\
81 | TRACE;NETFX_CORE;WINDOWS_UWP
82 | true
83 | ;2008
84 | pdbonly
85 | x64
86 | false
87 | prompt
88 | true
89 | true
90 |
91 |
92 | PackageReference
93 |
94 |
95 |
96 | App.xaml
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 | LifxControllerPage.xaml
117 |
118 |
119 |
120 |
121 |
122 | LifxListPage.xaml
123 |
124 |
125 | MainPage.xaml
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 | Designer
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 | MSBuild:Compile
189 | Designer
190 |
191 |
192 | Designer
193 | MSBuild:Compile
194 | PreserveNewest
195 |
196 |
197 | Designer
198 | MSBuild:Compile
199 |
200 |
201 | Designer
202 | MSBuild:Compile
203 |
204 |
205 | MSBuild:Compile
206 | Designer
207 |
208 |
209 |
210 |
211 | 2.2.0
212 |
213 |
214 | 6.2.10
215 |
216 |
217 | 6.1.1
218 |
219 |
220 | 7.0.0.396
221 |
222 |
223 | 6.3.0
224 |
225 |
226 | 6.3.0
227 |
228 |
229 |
230 |
231 | {54ac9c22-e869-49ef-9def-c055cba4c372}
232 | Color Picker Control
233 |
234 |
235 |
236 |
237 | Windows IoT Extensions for the UWP
238 |
239 |
240 |
241 | 14.0
242 |
243 |
244 |
251 |
--------------------------------------------------------------------------------