개정판 5dc8354d
ISSUE #00000 COLOR LIST EDIT
Change-Id: I73b2ef23155b4e1e188765fcd68efc257d481e70
ColorList/App.Debug.config | ||
---|---|---|
2 | 2 |
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 --> |
3 | 3 |
<!-- In case configuration is not the root element, replace it with root element in source configuration file --> |
4 | 4 |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> |
5 |
<startup> |
|
6 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> |
|
7 |
</startup> |
|
8 |
<connectionStrings> |
|
9 |
<add name="markusEntities" connectionString="metadata=res://*/ModelMarkus.csdl|res://*/ModelMarkus.ssdl|res://*/ModelMarkus.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.0.67;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> |
|
10 |
</connectionStrings> |
|
5 | 11 |
</configuration> |
ColorList/App.config | ||
---|---|---|
1 | 1 |
<?xml version="1.0" encoding="utf-8"?> |
2 | 2 |
<configuration> |
3 |
<configSections></configSections> |
|
4 |
<connectionStrings> |
|
5 |
<add name="ColorList.Properties.Settings.설정" connectionString="Data Source=192.168.0.67;Initial Catalog=markus;Persist Security Info=True;User ID=doftech;Password=dof1073#" providerName="System.Data.SqlClient" /> |
|
6 |
<add name="markusEntities" connectionString="metadata=res://*/ModelMarkus.csdl|res://*/ModelMarkus.ssdl|res://*/ModelMarkus.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.0.67;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /> |
|
7 |
</connectionStrings> |
|
8 | 3 |
<startup> |
9 | 4 |
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> |
10 | 5 |
</startup> |
11 |
</configuration> |
|
6 |
<connectionStrings><add name="markusEntities" connectionString="metadata=res://*/ModelMarkus.csdl|res://*/ModelMarkus.ssdl|res://*/ModelMarkus.msl;provider=System.Data.SqlClient;provider connection string="data source=192.168.0.67;initial catalog=markus;persist security info=True;user id=doftech;password=dof1073#;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" /></connectionStrings></configuration> |
ColorList/ColorEditor.xaml | ||
---|---|---|
1 |
<Window |
|
2 |
x:Class="ColorList.ColorEditor" |
|
3 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
4 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
5 |
xmlns:converter="clr-namespace:ColorList.Converters" |
|
6 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
7 |
xmlns:local="clr-namespace:ColorList" |
|
8 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
9 |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
|
10 |
x:Name="colorEditor" |
|
11 |
Title="Select Color" |
|
12 |
d:DesignHeight="300" |
|
13 |
d:DesignWidth="600" |
|
14 |
Background="White" |
|
15 |
mc:Ignorable="d"> |
|
16 |
<Window.Resources> |
|
17 |
<converter:StringToColorBrushConverter x:Key="StringToColorBrushConverter" /> |
|
18 |
</Window.Resources> |
|
19 |
<Grid> |
|
20 |
<Grid.ColumnDefinitions> |
|
21 |
<ColumnDefinition Width="4*" /> |
|
22 |
<ColumnDefinition Width="6*" /> |
|
23 |
</Grid.ColumnDefinitions> |
|
24 |
<Grid.RowDefinitions> |
|
25 |
<RowDefinition /> |
|
26 |
<RowDefinition Height="Auto" /> |
|
27 |
</Grid.RowDefinitions> |
|
28 |
<telerik:RadColorSelector |
|
29 |
MainPalette="Office" |
|
30 |
MainPaletteHeaderText="" |
|
31 |
NoColorVisibility="Collapsed" |
|
32 |
SelectedColor="{Binding SelectColor, Mode=TwoWay, ElementName=colorEditor}" |
|
33 |
StandardPaletteVisibility="Collapsed" /> |
|
34 |
<telerik:RadColorEditor Grid.Column="1" SelectedColor="{Binding SelectColor, Mode=TwoWay, ElementName=colorEditor}" /> |
|
35 |
<Grid Grid.Row="1" Grid.ColumnSpan="2"> |
|
36 |
<Grid.ColumnDefinitions> |
|
37 |
<ColumnDefinition /> |
|
38 |
<ColumnDefinition Width="Auto" /> |
|
39 |
</Grid.ColumnDefinitions> |
|
40 |
<StackPanel |
|
41 |
Margin="3" |
|
42 |
HorizontalAlignment="Left" |
|
43 |
Orientation="Horizontal"> |
|
44 |
<TextBlock VerticalAlignment="Center" Text="Select Color " /> |
|
45 |
<Border |
|
46 |
x:Name="border" |
|
47 |
Width="40" |
|
48 |
Height="40" |
|
49 |
Background="{Binding SelectColor, Converter={StaticResource StringToColorBrushConverter}, ElementName=colorEditor, Mode=TwoWay}" |
|
50 |
BorderBrush="Black" |
|
51 |
BorderThickness="1" /> |
|
52 |
</StackPanel> |
|
53 |
<StackPanel Grid.Column="1" Orientation="Horizontal"> |
|
54 |
<Button |
|
55 |
Width="80" |
|
56 |
Margin="5" |
|
57 |
Click="OK_Click" |
|
58 |
Content="Ok" /> |
|
59 |
<Button |
|
60 |
Width="80" |
|
61 |
Margin="5" |
|
62 |
Click="Cancel_Click" |
|
63 |
Content="Cancel" /> |
|
64 |
</StackPanel> |
|
65 |
</Grid> |
|
66 |
</Grid> |
|
67 |
</Window> |
ColorList/ColorEditor.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Windows; |
|
7 |
using System.Windows.Controls; |
|
8 |
using System.Windows.Data; |
|
9 |
using System.Windows.Documents; |
|
10 |
using System.Windows.Input; |
|
11 |
using System.Windows.Media; |
|
12 |
using System.Windows.Media.Imaging; |
|
13 |
using System.Windows.Navigation; |
|
14 |
using System.Windows.Shapes; |
|
15 |
|
|
16 |
namespace ColorList |
|
17 |
{ |
|
18 |
/// <summary> |
|
19 |
/// ColorEditor.xaml에 대한 상호 작용 논리 |
|
20 |
/// </summary> |
|
21 |
public partial class ColorEditor : Window |
|
22 |
{ |
|
23 |
public event EventHandler<EventArgs> SelectColorChanged; |
|
24 |
|
|
25 |
public ColorEditor() |
|
26 |
{ |
|
27 |
InitializeComponent(); |
|
28 |
} |
|
29 |
|
|
30 |
public static readonly DependencyProperty SelectColorProperty = |
|
31 |
DependencyProperty.Register("SelectColor",typeof(Color), |
|
32 |
typeof(ColorEditor),new PropertyMetadata(Colors.Transparent,new PropertyChangedCallback(SelectColorPropertyChanged))); |
|
33 |
|
|
34 |
private static void SelectColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
|
35 |
{ |
|
36 |
if(d is ColorEditor colorEditor) |
|
37 |
{ |
|
38 |
if (colorEditor.SelectColorChanged != null) |
|
39 |
colorEditor.SelectColorChanged(colorEditor, new EventArgs()); |
|
40 |
} |
|
41 |
} |
|
42 |
|
|
43 |
public Color SelectColor |
|
44 |
{ |
|
45 |
get { return (Color)GetValue(SelectColorProperty); } |
|
46 |
set { SetValue(SelectColorProperty, value); } |
|
47 |
} |
|
48 |
|
|
49 |
private void OK_Click(object sender, RoutedEventArgs e) |
|
50 |
{ |
|
51 |
DialogResult = true; |
|
52 |
this.Close(); |
|
53 |
} |
|
54 |
|
|
55 |
private void Cancel_Click(object sender, RoutedEventArgs e) |
|
56 |
{ |
|
57 |
DialogResult = false; |
|
58 |
this.Close(); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
ColorList/ColorList.csproj | ||
---|---|---|
38 | 38 |
<ItemGroup> |
39 | 39 |
<Reference Include="System" /> |
40 | 40 |
<Reference Include="System.Data" /> |
41 |
<Reference Include="System.Drawing" /> |
|
41 | 42 |
<Reference Include="System.Runtime.Serialization" /> |
42 | 43 |
<Reference Include="System.Security" /> |
44 |
<Reference Include="System.Windows.Forms" /> |
|
43 | 45 |
<Reference Include="System.Xml" /> |
44 | 46 |
<Reference Include="Microsoft.CSharp" /> |
45 | 47 |
<Reference Include="System.Core" /> |
... | ... | |
78 | 80 |
<Generator>MSBuild:Compile</Generator> |
79 | 81 |
<SubType>Designer</SubType> |
80 | 82 |
</ApplicationDefinition> |
83 |
<Compile Include="ColorEditor.xaml.cs"> |
|
84 |
<DependentUpon>ColorEditor.xaml</DependentUpon> |
|
85 |
</Compile> |
|
86 |
<Compile Include="Converters\StringToColorBrushConverter.cs" /> |
|
81 | 87 |
<Compile Include="MainWindow.xaml.cs"> |
82 | 88 |
<DependentUpon>MainWindow.xaml</DependentUpon> |
83 | 89 |
</Compile> |
... | ... | |
86 | 92 |
<SubType>Code</SubType> |
87 | 93 |
</Compile> |
88 | 94 |
<Compile Include="RaisePropertyChange.cs" /> |
95 |
<Compile Include="SampleItem.xaml.cs"> |
|
96 |
<DependentUpon>SampleItem.xaml</DependentUpon> |
|
97 |
</Compile> |
|
98 |
<Page Include="ColorEditor.xaml"> |
|
99 |
<SubType>Designer</SubType> |
|
100 |
<Generator>MSBuild:Compile</Generator> |
|
101 |
</Page> |
|
89 | 102 |
<Page Include="MainWindow.xaml"> |
90 | 103 |
<Generator>MSBuild:Compile</Generator> |
91 | 104 |
<SubType>Designer</SubType> |
92 | 105 |
</Page> |
106 |
<Page Include="SampleItem.xaml"> |
|
107 |
<SubType>Designer</SubType> |
|
108 |
<Generator>MSBuild:Compile</Generator> |
|
109 |
</Page> |
|
93 | 110 |
</ItemGroup> |
94 | 111 |
<ItemGroup> |
95 | 112 |
<Compile Include="ModelMarkus.Context.cs"> |
ColorList/Converters/StringToColorBrushConverter.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Globalization; |
|
4 |
using System.Linq; |
|
5 |
using System.Text; |
|
6 |
using System.Threading.Tasks; |
|
7 |
using System.Windows.Data; |
|
8 |
using System.Windows.Media; |
|
9 |
|
|
10 |
namespace ColorList.Converters |
|
11 |
{ |
|
12 |
public class StringToColorBrushConverter : IValueConverter |
|
13 |
{ |
|
14 |
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
|
15 |
{ |
|
16 |
if (value == null) |
|
17 |
return new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); |
|
18 |
|
|
19 |
if (value is Color) |
|
20 |
return new SolidColorBrush((Color)value); |
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
if (value is string) |
|
25 |
return new SolidColorBrush(Parse((string)value)); |
|
26 |
|
|
27 |
throw new NotSupportedException("ColorToBurshConverter only supports converting from Color and String"); |
|
28 |
} |
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) |
|
33 |
{ |
|
34 |
throw new NotSupportedException(); |
|
35 |
} |
|
36 |
|
|
37 |
|
|
38 |
public static Color Parse(string color) |
|
39 |
{ |
|
40 |
if (color == null) |
|
41 |
{ |
|
42 |
color = "#FFFFCD28"; |
|
43 |
} |
|
44 |
|
|
45 |
var offset = color.StartsWith("#") ? 1 : 0; |
|
46 |
|
|
47 |
int inx = 0; |
|
48 |
byte alpha = 0; |
|
49 |
|
|
50 |
if (color.Length == 8) |
|
51 |
{ |
|
52 |
alpha = Byte.Parse(color.Substring(0 + offset, 2), NumberStyles.HexNumber); |
|
53 |
inx += 2; |
|
54 |
} |
|
55 |
else |
|
56 |
{ |
|
57 |
alpha = 0xFF; |
|
58 |
} |
|
59 |
|
|
60 |
var r = Byte.Parse(color.Substring(inx + offset, 2), NumberStyles.HexNumber); |
|
61 |
inx += 2; |
|
62 |
|
|
63 |
var g = Byte.Parse(color.Substring(inx + offset, 2), NumberStyles.HexNumber); |
|
64 |
inx += 2; |
|
65 |
|
|
66 |
var b = Byte.Parse(color.Substring(inx + offset, 2), NumberStyles.HexNumber); |
|
67 |
inx += 2; |
|
68 |
|
|
69 |
return Color.FromArgb(alpha, r, g, b); |
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
} |
|
74 |
} |
ColorList/MainWindow.xaml | ||
---|---|---|
2 | 2 |
x:Class="ColorList.MainWindow" |
3 | 3 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
4 | 4 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
5 |
xmlns:Globalization="clr-namespace:System.Globalization;assembly=mscorlib" |
|
5 | 6 |
xmlns:ZoomAndPan="clr-namespace:ZoomAndPan;assembly=ZoomAndPan" |
7 |
xmlns:converters="clr-namespace:ColorList.Converters" |
|
6 | 8 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
7 | 9 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
8 | 10 |
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
9 | 11 |
Title="Color List" |
10 |
Width="600" |
|
11 |
Height="600"> |
|
12 |
Width="785" |
|
13 |
Height="910"> |
|
14 |
<Window.Resources> |
|
15 |
<converters:StringToColorBrushConverter x:Key="StringToColorBrushConverter" /> |
|
16 |
</Window.Resources> |
|
12 | 17 |
<Grid> |
13 | 18 |
<Grid.RowDefinitions> |
14 | 19 |
<RowDefinition Height="Auto" /> |
... | ... | |
21 | 26 |
<ZoomAndPan:ZoomAndPanControl |
22 | 27 |
x:Name="zoomAndPanControl" |
23 | 28 |
Grid.Row="1" |
24 |
Grid.Column="1"
|
|
29 |
Grid.Column="2"
|
|
25 | 30 |
Background="LightGray" |
26 | 31 |
ConstrainedContentViewportHeight="{Binding ActualHeight, ElementName=image, Mode=OneWay}" |
27 | 32 |
ConstrainedContentViewportWidth="{Binding ActualWidth, ElementName=image, Mode=OneWay}" |
28 | 33 |
ContentScale="1" |
34 |
MouseDown="zoomAndPanControl_MouseDown" |
|
35 |
MouseMove="zoomAndPanControl_MouseMove" |
|
29 | 36 |
MouseWheel="zoomAndPanControl_MouseWheel"> |
30 |
<Canvas x:Name="canvas"> |
|
31 |
<Canvas.RenderTransform> |
|
32 |
<TransformGroup> |
|
33 |
<RotateTransform x:Name="rotate" Angle="0" /> |
|
34 |
<TranslateTransform x:Name="translate" X="1" Y="1" /> |
|
35 |
</TransformGroup> |
|
36 |
</Canvas.RenderTransform> |
|
37 |
<Canvas |
|
38 |
x:Name="canvas" |
|
39 |
Width="{Binding ActualWidth, ElementName=image, Mode=OneWay}" |
|
40 |
Height="{Binding ActualHeight, ElementName=image, Mode=OneWay}"> |
|
37 | 41 |
<Image |
38 | 42 |
x:Name="image" |
39 |
Canvas.Left="-226" |
|
40 |
Canvas.Top="-340" |
|
41 | 43 |
Source="/sample.png" |
42 | 44 |
Stretch="None" /> |
43 | 45 |
</Canvas> |
44 | 46 |
</ZoomAndPan:ZoomAndPanControl> |
47 |
<Border |
|
48 |
Grid.Column="1" |
|
49 |
HorizontalAlignment="Left" |
|
50 |
VerticalAlignment="Top" |
|
51 |
Background="AliceBlue" |
|
52 |
BorderBrush="#FF6A6A6A" |
|
53 |
BorderThickness="2"> |
|
54 |
<StackPanel Margin="5" Orientation="Horizontal"> |
|
55 |
<TextBlock Text="Text Bold: " /> |
|
56 |
<CheckBox |
|
57 |
x:Name="chkTextBold" |
|
58 |
Margin="0,0,10,0" |
|
59 |
HorizontalAlignment="Center" |
|
60 |
VerticalAlignment="Center" |
|
61 |
Click="chkTextBold_Click" /> |
|
62 |
<TextBlock Text="Text Size : " /> |
|
63 |
<telerik:RadNumericUpDown |
|
64 |
Margin="0,0,10,0" |
|
65 |
Minimum="1" |
|
66 |
ValueChanged="TextSize_ValueChanged" |
|
67 |
Value="12"> |
|
68 |
<telerik:RadNumericUpDown.NumberFormatInfo> |
|
69 |
<Globalization:NumberFormatInfo |
|
70 |
CurrencyDecimalDigits="0" |
|
71 |
NumberDecimalDigits="0" |
|
72 |
PercentDecimalDigits="0" |
|
73 |
PercentSymbol="px" /> |
|
74 |
</telerik:RadNumericUpDown.NumberFormatInfo> |
|
75 |
</telerik:RadNumericUpDown> |
|
76 |
<TextBlock Text="Border Size : " /> |
|
77 |
<telerik:RadNumericUpDown |
|
78 |
Minimum="1" |
|
79 |
ValueChanged="BorderSize_ValueChanged" |
|
80 |
Value="1"> |
|
81 |
<telerik:RadNumericUpDown.NumberFormatInfo> |
|
82 |
<Globalization:NumberFormatInfo |
|
83 |
CurrencyDecimalDigits="0" |
|
84 |
NumberDecimalDigits="0" |
|
85 |
PercentDecimalDigits="0" |
|
86 |
PercentSymbol="px" /> |
|
87 |
</telerik:RadNumericUpDown.NumberFormatInfo> |
|
88 |
</telerik:RadNumericUpDown> |
|
89 |
</StackPanel> |
|
90 |
</Border> |
|
45 | 91 |
<StackPanel Margin="5"> |
46 | 92 |
<Button |
47 | 93 |
Width="100" |
... | ... | |
49 | 95 |
Click="Button_Click" |
50 | 96 |
Content="Save" /> |
51 | 97 |
</StackPanel> |
52 |
<telerik:RadListBox x:Name="listBox" Grid.Row="1"> |
|
98 |
<telerik:RadListBox |
|
99 |
x:Name="listBox" |
|
100 |
Grid.Row="1" |
|
101 |
MouseDoubleClick="listBox_MouseDoubleClick"> |
|
53 | 102 |
<telerik:RadListBox.ItemTemplate> |
54 | 103 |
<DataTemplate> |
55 |
<StackPanel> |
|
104 |
<StackPanel Orientation="Horizontal"> |
|
105 |
<TextBlock Text="{Binding Inx, StringFormat=\{0:D2\}}" /> |
|
56 | 106 |
<Border |
57 |
Background="{Binding Color}" |
|
107 |
Width="80" |
|
108 |
Height="24" |
|
109 |
Background="{Binding Color, Converter={StaticResource StringToColorBrushConverter}}" |
|
58 | 110 |
BorderBrush="#FFE0E0E0" |
59 | 111 |
BorderThickness="1" /> |
60 |
<TextBlock Text="{Binding Inx}" /> |
|
61 | 112 |
</StackPanel> |
62 | 113 |
</DataTemplate> |
63 | 114 |
</telerik:RadListBox.ItemTemplate> |
ColorList/MainWindow.xaml.cs | ||
---|---|---|
10 | 10 |
using System.Windows.Media; |
11 | 11 |
using System.Windows.Media.Imaging; |
12 | 12 |
using System.Windows.Shapes; |
13 |
|
|
13 |
using System.Linq; |
|
14 | 14 |
using Telerik.Windows.Controls; |
15 | 15 |
|
16 | 16 |
namespace ColorList |
... | ... | |
20 | 20 |
/// </summary> |
21 | 21 |
public partial class MainWindow : Window |
22 | 22 |
{ |
23 |
public const string DISPLAY_COLOR = "DisplayColor"; |
|
24 |
|
|
25 | 23 |
public MainWindow() |
26 | 24 |
{ |
27 | 25 |
InitializeComponent(); |
28 | 26 |
|
29 |
using(markusEntities entities = new markusEntities()) |
|
27 |
this.Loaded += MainWindow_Loaded; |
|
28 |
} |
|
29 |
|
|
30 |
private void ColorEditor_SelectColorChanged(object sender, EventArgs e) |
|
31 |
{ |
|
32 |
if (listBox.SelectedItem != null && sender is ColorEditor colorEditor) |
|
33 |
{ |
|
34 |
var coloritem = listBox.SelectedItem as ColorItem; |
|
35 |
|
|
36 |
foreach (var item in canvas.Children) |
|
37 |
{ |
|
38 |
if (item is SampleItem sample) |
|
39 |
{ |
|
40 |
if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2")) |
|
41 |
{ |
|
42 |
sample.BorderBrush = new SolidColorBrush(colorEditor.SelectColor); |
|
43 |
break; |
|
44 |
} |
|
45 |
} |
|
46 |
} |
|
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
public const string DISPLAY_COLOR = "DisplayColor"; |
|
51 |
public System.Collections.ObjectModel.ObservableCollection<ColorItem> ColorItems = new System.Collections.ObjectModel.ObservableCollection<ColorItem>(); |
|
52 |
|
|
53 |
private void MainWindow_Loaded(object sender, RoutedEventArgs e) |
|
54 |
{ |
|
55 |
ColorItems.CollectionChanged += ColorItems_CollectionChanged; |
|
56 |
listBox.ItemsSource = ColorItems; |
|
57 |
|
|
58 |
using (markusEntities entities = new markusEntities()) |
|
59 |
{ |
|
60 |
var items = entities.PROPERTIES.Where(x => x.TYPE == DISPLAY_COLOR).ToList(); |
|
61 |
int top = 10; |
|
62 |
int left = 10; |
|
63 |
int inx = 1; |
|
64 |
|
|
65 |
foreach (var item in items) |
|
66 |
{ |
|
67 |
ColorItems.Add(new ColorItem { Inx = inx, ID = item.ID, Color = item.VALUE }); |
|
68 |
|
|
69 |
SampleItem sample = new SampleItem(); |
|
70 |
sample.Tag = inx.ToString("D2"); |
|
71 |
sample.BorderBrush = new SolidColorBrush(Converters.StringToColorBrushConverter.Parse(item.VALUE)); |
|
72 |
Canvas.SetTop(sample, top); |
|
73 |
Canvas.SetLeft(sample, left); |
|
74 |
canvas.Children.Add(sample); |
|
75 |
|
|
76 |
top += 50; |
|
77 |
left += 20; |
|
78 |
inx++; |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
|
|
83 |
private void ColorItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
|
84 |
{ |
|
85 |
} |
|
86 |
|
|
87 |
private System.Windows.Media.Color colorPicker(string strColor) |
|
88 |
{ |
|
89 |
ColorEditor colorEditor = new ColorEditor(); |
|
90 |
colorEditor.Width = 485; |
|
91 |
colorEditor.Height = 300; |
|
92 |
|
|
93 |
colorEditor.SelectColorChanged += ColorEditor_SelectColorChanged; |
|
94 |
|
|
95 |
System.Windows.Media.Color color = Converters.StringToColorBrushConverter.Parse(strColor); |
|
96 |
|
|
97 |
colorEditor.SelectColor = color; |
|
98 |
|
|
99 |
var result = colorEditor.ShowDialog(); |
|
100 |
|
|
101 |
if (result == true) |
|
30 | 102 |
{ |
31 |
listBox.ItemsSource = entities.PROPERTIES.Where(x => x.TYPE == DISPLAY_COLOR).Select((x,inx) => new ColorItem {Inx = inx,Color = x.VALUE }); |
|
103 |
color.A = colorEditor.SelectColor.A; |
|
104 |
color.B = colorEditor.SelectColor.B; |
|
105 |
color.G = colorEditor.SelectColor.G; |
|
106 |
color.R = colorEditor.SelectColor.R; |
|
32 | 107 |
} |
108 |
|
|
109 |
return color; |
|
33 | 110 |
} |
34 | 111 |
|
35 | 112 |
private void zoomAndPanControl_MouseWheel(object sender, MouseWheelEventArgs e) |
... | ... | |
87 | 164 |
|
88 | 165 |
var value = await entities.SaveChangesAsync(); |
89 | 166 |
|
90 |
if(value > -1)
|
|
167 |
if(value > 0)
|
|
91 | 168 |
{ |
92 |
|
|
169 |
MessageBox.Show($"{value}개가 업데이트 되었습니다."); |
|
93 | 170 |
} |
94 | 171 |
} |
95 | 172 |
} |
173 |
|
|
174 |
private void listBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) |
|
175 |
{ |
|
176 |
if (listBox.SelectedItem != null) |
|
177 |
{ |
|
178 |
var coloritem = listBox.SelectedItem as ColorItem; |
|
179 |
|
|
180 |
var result = colorPicker(coloritem.Color); |
|
181 |
|
|
182 |
coloritem.Color = $"{result.R:X2}{result.G:X2}{result.B:X2}"; |
|
183 |
|
|
184 |
|
|
185 |
foreach (var item in canvas.Children) |
|
186 |
{ |
|
187 |
if (item is SampleItem sample) |
|
188 |
{ |
|
189 |
if (sample.Tag?.ToString() == coloritem.Inx.ToString("D2")) |
|
190 |
{ |
|
191 |
sample.BorderBrush = new SolidColorBrush(result); |
|
192 |
break; |
|
193 |
} |
|
194 |
} |
|
195 |
} |
|
196 |
} |
|
197 |
} |
|
198 |
|
|
199 |
private void chkTextBold_Click(object sender, RoutedEventArgs e) |
|
200 |
{ |
|
201 |
if(chkTextBold.IsChecked == true) |
|
202 |
{ |
|
203 |
zoomAndPanControl.FontWeight = FontWeights.Bold; |
|
204 |
} |
|
205 |
else |
|
206 |
{ |
|
207 |
zoomAndPanControl.FontWeight = FontWeights.Normal; |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
private void TextSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e) |
|
212 |
{ |
|
213 |
zoomAndPanControl.FontSize = (int)e.NewValue; |
|
214 |
} |
|
215 |
|
|
216 |
private void BorderSize_ValueChanged(object sender, RadRangeBaseValueChangedEventArgs e) |
|
217 |
{ |
|
218 |
foreach (var item in canvas.Children) |
|
219 |
{ |
|
220 |
if (item is SampleItem sample) |
|
221 |
{ |
|
222 |
sample.BorderThickness = new Thickness((int)e.NewValue); |
|
223 |
} |
|
224 |
} |
|
225 |
} |
|
226 |
|
|
227 |
private Point canvasZoommovingMouseDownPoint; |
|
228 |
|
|
229 |
private void zoomAndPanControl_MouseMove(object sender, MouseEventArgs e) |
|
230 |
{ |
|
231 |
if (e.RightButton == MouseButtonState.Pressed) |
|
232 |
{ |
|
233 |
Point currentCanvasZoomPanningMouseMovePoint = e.GetPosition(zoomAndPanControl); |
|
234 |
|
|
235 |
Vector dragOffset = currentCanvasZoomPanningMouseMovePoint - canvasZoommovingMouseDownPoint; |
|
236 |
|
|
237 |
double dragOffsetX = dragOffset.X = (dragOffset.X < -1) ? -1 : (dragOffset.X > 1) ? 1 : dragOffset.X; |
|
238 |
double dragOffsetY = dragOffset.Y = (dragOffset.Y < -1) ? -1 : (dragOffset.Y > 1) ? 1 : dragOffset.Y; |
|
239 |
|
|
240 |
zoomAndPanControl.ContentOffsetX -= dragOffsetX; |
|
241 |
zoomAndPanControl.ContentOffsetY -= dragOffsetY; |
|
242 |
} |
|
243 |
} |
|
244 |
|
|
245 |
private void zoomAndPanControl_MouseDown(object sender, MouseButtonEventArgs e) |
|
246 |
{ |
|
247 |
if (e.RightButton == MouseButtonState.Pressed) |
|
248 |
{ |
|
249 |
canvasZoommovingMouseDownPoint = e.GetPosition(zoomAndPanControl); |
|
250 |
} |
|
251 |
} |
|
96 | 252 |
} |
97 | 253 |
|
98 | 254 |
public class ColorItem : NotifyPropertyChange |
ColorList/ModelMarkus.edmx | ||
---|---|---|
4 | 4 |
<edmx:Runtime> |
5 | 5 |
<!-- SSDL content --> |
6 | 6 |
<edmx:StorageModels> |
7 |
<Schema Namespace="markusModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
|
|
7 |
<Schema Namespace="markusModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl"> |
|
8 | 8 |
<EntityType Name="PROPERTIES"> |
9 | 9 |
<Key> |
10 | 10 |
<PropertyRef Name="ID" /> |
... | ... | |
17 | 17 |
<EntityContainer Name="markusModelStoreContainer"> |
18 | 18 |
<EntitySet Name="PROPERTIES" EntityType="Self.PROPERTIES" Schema="dbo" store:Type="Tables" /> |
19 | 19 |
</EntityContainer> |
20 |
</Schema> |
|
21 |
</edmx:StorageModels> |
|
20 |
</Schema></edmx:StorageModels> |
|
22 | 21 |
<!-- CSDL content --> |
23 | 22 |
<edmx:ConceptualModels> |
24 | 23 |
<Schema Namespace="markusModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"> |
ColorList/Properties/Settings.Designer.cs | ||
---|---|---|
22 | 22 |
return defaultInstance; |
23 | 23 |
} |
24 | 24 |
} |
25 |
|
|
26 |
[global::System.Configuration.ApplicationScopedSettingAttribute()] |
|
27 |
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
|
28 |
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)] |
|
29 |
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=192.168.0.67;Initial Catalog=markus;Persist Security Info=True;User I" + |
|
30 |
"D=doftech;Password=dof1073#")] |
|
31 |
public string 설정 { |
|
32 |
get { |
|
33 |
return ((string)(this["설정"])); |
|
34 |
} |
|
35 |
} |
|
36 | 25 |
} |
37 | 26 |
} |
ColorList/Properties/Settings.settings | ||
---|---|---|
1 | 1 |
<?xml version='1.0' encoding='utf-8'?> |
2 |
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ColorList.Properties" GeneratedClassName="Settings">
|
|
2 |
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)"> |
|
3 | 3 |
<Profiles /> |
4 |
<Settings> |
|
5 |
<Setting Name="설정" Type="(Connection string)" Scope="Application"> |
|
6 |
<DesignTimeValue Profile="(Default)"><?xml version="1.0" encoding="utf-16"?> |
|
7 |
<SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
|
8 |
<ConnectionString>Data Source=192.168.0.67;Initial Catalog=markus;Persist Security Info=True;User ID=doftech;Password=dof1073#</ConnectionString> |
|
9 |
<ProviderName>System.Data.SqlClient</ProviderName> |
|
10 |
</SerializableConnectionString></DesignTimeValue> |
|
11 |
<Value Profile="(Default)">Data Source=192.168.0.67;Initial Catalog=markus;Persist Security Info=True;User ID=doftech;Password=dof1073#</Value> |
|
12 |
</Setting> |
|
13 |
</Settings> |
|
4 |
<Settings /> |
|
14 | 5 |
</SettingsFile> |
ColorList/SampleItem.xaml | ||
---|---|---|
1 |
<UserControl |
|
2 |
x:Class="ColorList.SampleItem" |
|
3 |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
4 |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
5 |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
6 |
xmlns:local="clr-namespace:ColorList" |
|
7 |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
8 |
x:Name="userControl" |
|
9 |
d:DesignHeight="100" |
|
10 |
d:DesignWidth="100" |
|
11 |
mc:Ignorable="d"> |
|
12 |
<Grid> |
|
13 |
<Rectangle |
|
14 |
Width="100" |
|
15 |
Height="100" |
|
16 |
Stroke="{Binding BorderBrush, ElementName=userControl}" /> |
|
17 |
<TextBlock Foreground="{Binding BorderBrush, ElementName=userControl}" Text="{Binding Tag, ElementName=userControl, StringFormat=Index : \{0\}}" /> |
|
18 |
</Grid> |
|
19 |
</UserControl> |
ColorList/SampleItem.xaml.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
using System.Windows; |
|
7 |
using System.Windows.Controls; |
|
8 |
using System.Windows.Data; |
|
9 |
using System.Windows.Documents; |
|
10 |
using System.Windows.Input; |
|
11 |
using System.Windows.Media; |
|
12 |
using System.Windows.Media.Imaging; |
|
13 |
using System.Windows.Navigation; |
|
14 |
using System.Windows.Shapes; |
|
15 |
|
|
16 |
namespace ColorList |
|
17 |
{ |
|
18 |
/// <summary> |
|
19 |
/// SampleItem.xaml에 대한 상호 작용 논리 |
|
20 |
/// </summary> |
|
21 |
public partial class SampleItem : UserControl |
|
22 |
{ |
|
23 |
public SampleItem() |
|
24 |
{ |
|
25 |
InitializeComponent(); |
|
26 |
} |
|
27 |
} |
|
28 |
} |
내보내기 Unified diff