22using System . Collections . Generic ;
33using System . Diagnostics ;
44using System . Linq ;
5+ using System . Runtime . Serialization ;
6+ using System . Security . Permissions ;
57using System . Text ;
68using System . Threading . Tasks ;
79using System . Windows ;
1416using System . Windows . Navigation ;
1517using System . Windows . Shapes ;
1618using JayCustomControlLib ;
19+ using JayLib . JaySerialization ;
1720using JayLib . WPF . BasicClass ;
1821
1922namespace ControlTest
@@ -23,6 +26,11 @@ namespace ControlTest
2326 /// </summary>
2427 public partial class MainWindow : Window
2528 {
29+ public override void BeginInit ( )
30+ {
31+ base . BeginInit ( ) ;
32+ }
33+
2634 public static string [ ] FaderTickStrings { get ; private set ; } = new string [ ]
2735{
2836 "OFF" , //0
@@ -51,15 +59,16 @@ public partial class MainWindow : Window
5159 public MainWindow ( )
5260 {
5361 InitializeComponent ( ) ;
54- bbb . CalculateValueFunction = dddd ;
55- //List<int> aa = new List<int>();
56- //for (int i = 0; i < 10; i++)
57- //{
58- // aa.Add(i);
59- //}
62+ colorPickerTest colorPickerTest = new colorPickerTest ( ) ;
63+ //bbb.CalculateValueFunction = dddd;
64+ List < int > aa = new List < int > ( ) ;
65+ for ( int i = 0 ; i < 10 ; i ++ )
66+ {
67+ aa . Add ( i ) ;
68+ }
6069 //timer.Elapsed += Timer_Elapsed;
6170 //timer.Start();
62- // bbb.ItemsSource = aa;
71+ bbb . ItemsSource = aa ;
6372 //ttt.ItemsSource = aa;
6473 //bbb.SetBinding(JSpinner.ValueProperty, new Binding("Value") { Source = c ,Mode= BindingMode.OneWay});
6574 //ttt.SetBinding(ComboBox.SelectedIndexProperty, new Binding("Value") { Source = c ,Mode= BindingMode.OneWay});
@@ -93,6 +102,30 @@ public MainWindow()
93102 "10:1" ,
94103 "Limit"
95104} ;
105+
106+ cac cccc = new cac ( )
107+ {
108+ Text = "ac" ,
109+ Value = 5 ,
110+ MyProperty = 1.1456 ,
111+ listint = new List < int > ( ) { 1 , 2 , 3 } ,
112+ listccc = new List < ccc > ( )
113+ {
114+ new ccc ( ) { Text = "a" } ,
115+ new ccc ( ) { Text = "b" }
116+ }
117+ } ;
118+ ccc aaa = new ccc ( )
119+ {
120+ Text = "aaa" ,
121+ Value = 6 ,
122+ } ;
123+ JSerializer . Serialize ( cccc , AppDomain . CurrentDomain . BaseDirectory + "c.bin" ) ;
124+ JSerializer . Serialize ( aaa , AppDomain . CurrentDomain . BaseDirectory + "a.bin" ) ;
125+
126+ var dccc = JSerializer . Deserialize ( AppDomain . CurrentDomain . BaseDirectory + "c.bin" ) as cac ;
127+ var accc = JSerializer . Deserialize ( AppDomain . CurrentDomain . BaseDirectory + "a.bin" ) as ccc ;
128+ int b = 0 ;
96129 }
97130 int i = 0 ;
98131 private void Timer_Elapsed ( object sender , System . Timers . ElapsedEventArgs e )
@@ -115,7 +148,29 @@ private int dddd(string b)
115148 }
116149 }
117150
118- public class ccc : NotificationObject
151+ public class colorPickerTest : NotificationObject
152+ {
153+ private Brush mycolor ;
154+
155+ public Brush myColor
156+ {
157+ get { return mycolor ; }
158+ set { mycolor = value ; OnPropertyChanged ( ( ) => myColor ) ; }
159+ }
160+
161+
162+ private Brush mycolor2 ;
163+
164+ public Brush myColor2
165+ {
166+ get { return mycolor2 ; }
167+ set { mycolor2 = value ; OnPropertyChanged ( ( ) => myColor2 ) ; }
168+ }
169+
170+ }
171+
172+ [ Serializable ]
173+ public class ccc : NotificationObject , ISerializable
119174 {
120175 private int _value ;
121176
@@ -132,5 +187,56 @@ public string Text
132187 get { return _text ; }
133188 set { _text = value ; OnPropertyChanged ( ( ) => Text ) ; }
134189 }
190+
191+ public List < int > listint { get ; set ; }
192+ public RelayCommand RelayCommand1 { get ; set ; }
193+ public RelayCommand < int > RelayCommand2 { get ; set ; }
194+
195+ private string testbool ;
196+
197+ public ccc ( )
198+ {
199+ RelayCommand1 = new RelayCommand ( RelayCommand1E ) ;
200+ RelayCommand2 = new RelayCommand < int > ( RelayCommand2E ) ;
201+ testbool = "aaaa" ;
202+ }
203+
204+ private void RelayCommand2E ( int obj )
205+ {
206+
207+ }
208+
209+ private void RelayCommand1E ( )
210+ {
211+
212+ }
213+
214+ public void GetObjectData ( SerializationInfo info , StreamingContext context )
215+ {
216+ SerializerHelper . SerializationFieldHelper ( info , this ) ;
217+ SerializerHelper . SerializationPropertyHelper ( info , this , typeof ( int ) , typeof ( RelayCommand ) , typeof ( RelayCommand < int > ) ) ;
218+ }
219+
220+ [ SecurityPermissionAttribute ( SecurityAction . Demand , SerializationFormatter = true ) ]
221+ protected ccc ( SerializationInfo info , StreamingContext context )
222+ {
223+ SerializerHelper . DeserializtionPropertyHelper ( info , this , typeof ( int ) , typeof ( RelayCommand ) , typeof ( RelayCommand < int > ) ) ;
224+ SerializerHelper . DeSerializationFieldHelper ( info , this ) ;
225+ }
226+ }
227+ [ Serializable ]
228+ public class cac : ccc
229+ {
230+ public double MyProperty { get ; set ; }
231+ public List < ccc > listccc { get ; set ; }
232+ public cac ( )
233+ {
234+
235+ }
236+ protected cac ( SerializationInfo info , StreamingContext context )
237+ {
238+ SerializerHelper . DeserializtionPropertyHelper ( info , this , typeof ( int ) , typeof ( RelayCommand ) , typeof ( RelayCommand < int > ) ) ;
239+ SerializerHelper . DeSerializationFieldHelper ( info , this ) ;
240+ }
135241 }
136242}
0 commit comments