-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
330 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Window x:Class="Artorio.ColorsPickerWIndow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Artorio" | ||
xmlns:colorpicker="clr-namespace:ColorPicker;assembly=ColorPicker" | ||
mc:Ignorable="d" | ||
WindowStyle="ToolWindow" | ||
ResizeMode="NoResize" | ||
Title="Color picker" Height="458" Width="213"> | ||
<Grid> | ||
<colorpicker:StandardColorPicker x:Name="main" PickerType="HSV" Height="385" VerticalAlignment="Top"/> | ||
<Button Click="OnApplyClick" Content="Apply" HorizontalAlignment="Left" Margin="10,0,0,10" Height="20" VerticalAlignment="Bottom"/> | ||
<Button Click="OnCancelClick" Content="Cancel" HorizontalAlignment="Right" Margin="0,0,10,10" Height="20" VerticalAlignment="Bottom"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System.Windows; | ||
using System.Windows.Media; | ||
|
||
namespace Artorio | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ColorsPickerWIndow.xaml | ||
/// </summary> | ||
public partial class ColorsPickerWIndow : Window | ||
{ | ||
public static ColorsPickerWIndow Instance { get; private set; } | ||
|
||
public static void OpenWindow(Color? selectColor = null) | ||
{ | ||
if (Instance == null) | ||
Instance = new ColorsPickerWIndow(); | ||
|
||
if (selectColor.HasValue) | ||
Instance.SelectColor(selectColor.Value); | ||
|
||
Instance.ShowDialog(); | ||
} | ||
|
||
private bool stayOpen; | ||
public Color GetSelectedColor => main.SelectedColor; | ||
public bool ColorWasSelected { get; private set; } | ||
|
||
public ColorsPickerWIndow() | ||
{ | ||
InitializeComponent(); | ||
stayOpen = true; | ||
Closing += ColorsPickerWIndow_Closing; | ||
} | ||
|
||
public void CloseWindow() | ||
{ | ||
stayOpen = false; | ||
Close(); | ||
} | ||
|
||
public void SelectColor(Color clr) | ||
{ | ||
main.SelectedColor = clr; | ||
} | ||
|
||
private void ColorsPickerWIndow_Closing(object sender, System.ComponentModel.CancelEventArgs e) | ||
{ | ||
if (stayOpen) | ||
{ | ||
e.Cancel = false; | ||
} | ||
} | ||
|
||
private void OnApplyClick(object sender, RoutedEventArgs e) | ||
{ | ||
ColorWasSelected = true; | ||
Hide(); | ||
} | ||
|
||
private void OnCancelClick(object sender, RoutedEventArgs e) | ||
{ | ||
ColorWasSelected = false; | ||
Hide(); | ||
} | ||
} | ||
} |
Oops, something went wrong.