Winify – Diff between revs 43 and 44

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 43 Rev 44
Line 29... Line 29...
29 private Announcement _announcement; 29 private Announcement _announcement;
Line 30... Line 30...
30   30  
31 private Server _server; 31 private Server _server;
32 private readonly MainForm _mainForm; 32 private readonly MainForm _mainForm;
-   33 private readonly CancellationToken _cancellationToken;
Line 33... Line 34...
33 private readonly CancellationToken _cancellationToken; 34 private readonly BindingSource _configurationBindingSource;
Line 34... Line 35...
34   35  
Line 35... Line 36...
35 #endregion 36 #endregion
36   37  
37 #region Constructors, Destructors and Finalizers 38 #region Constructors, Destructors and Finalizers
-   39  
-   40 public SettingsForm()
38   41 {
Line 39... Line 42...
39 public SettingsForm() 42 InitializeComponent();
40 { 43  
41 InitializeComponent(); 44 Utilities.WindowState.FormTracker.Track(this);
Line 53... Line 56...
53 _server = _servers.Server.FirstOrDefault() ?? new Server(); 56 _server = _servers.Server.FirstOrDefault() ?? new Server();
54 _cancellationToken = cancellationToken; 57 _cancellationToken = cancellationToken;
Line 55... Line 58...
55   58  
56 _serverBindingSource = new BindingSource(); 59 _serverBindingSource = new BindingSource();
-   60 _serverBindingSource.DataSource = _server;
-   61 _configurationBindingSource = new BindingSource();
-   62 _configurationBindingSource.DataSource = _mainForm.Configuration;
-   63  
-   64 checkBox1.DataBindings.Add(new Binding("Checked", _configurationBindingSource,
-   65 nameof(_mainForm.Configuration.LaunchOnBoot), true, DataSourceUpdateMode.OnPropertyChanged));
-   66  
-   67 checkBox2.DataBindings.Add(new Binding("Checked", _configurationBindingSource,
Line 57... Line 68...
57 _serverBindingSource.DataSource = _server; 68 nameof(_mainForm.Configuration.IgnoreSelfSignedCertificates), true, DataSourceUpdateMode.OnPropertyChanged));
58   69  
59 serverNameTextBox.DataBindings.Add(new Binding("Text", _serverBindingSource, nameof(_server.Name), true, 70 serverNameTextBox.DataBindings.Add(new Binding("Text", _serverBindingSource, nameof(_server.Name), true,
60 DataSourceUpdateMode.OnPropertyChanged)); 71 DataSourceUpdateMode.OnPropertyChanged));
Line 120... Line 131...
120 listBox1.SelectedItem = server; 131 listBox1.SelectedItem = server;
121 } 132 }
Line 122... Line 133...
122   133  
123 private void Button2_Click(object sender, EventArgs e) 134 private void Button2_Click(object sender, EventArgs e)
124 { 135 {
125 if (listBox1.SelectedItem is Server server) -  
126 { -  
127 _servers.Server.Remove(server); -  
128 } 136 if (listBox1.SelectedItem is Server server) _servers.Server.Remove(server);
Line 129... Line 137...
129 } 137 }
130   138  
131 private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) 139 private void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
Line 140... Line 148...
140 } 148 }
141 } 149 }
Line 142... Line 150...
142   150  
143 private void Button3_Click(object sender, EventArgs e) 151 private void Button3_Click(object sender, EventArgs e)
144 { 152 {
145 if (listBox2.SelectedItem is Announcement announcement) -  
146 { -  
147 _announcements.Announcement.Remove(announcement); -  
148 } 153 if (listBox2.SelectedItem is Announcement announcement) _announcements.Announcement.Remove(announcement);
Line 149... Line 154...
149 } 154 }
150   155  
151 private void Button4_Click(object sender, EventArgs e) 156 private void Button4_Click(object sender, EventArgs e)
152 { 157 {
153 var announcement = new Announcement(); -  
154 if (int.TryParse(appIdTextBox.Text, out var appId)) -  
155 { -  
Line 156... Line 158...
156 announcement.AppId = appId; 158 var announcement = new Announcement();
157 } -  
158   -  
159 if (int.TryParse(lingerTimeTextBox.Text, out var lingerTime)) -  
Line 160... Line 159...
160 { 159 if (int.TryParse(appIdTextBox.Text, out var appId)) announcement.AppId = appId;
Line 161... Line 160...
161 announcement.LingerTime = lingerTime; 160  
Line 196... Line 195...
196 { 195 {
197 checkBox1.Checked = _mainForm.Configuration.LaunchOnBoot; 196 checkBox1.Checked = _mainForm.Configuration.LaunchOnBoot;
198 } 197 }
Line 199... Line 198...
199   198  
-   199 #endregion
-   200  
-   201 private void CheckBox2_CheckedChanged(object sender, EventArgs e)
-   202 {
-   203 _mainForm.Configuration.IgnoreSelfSignedCertificates = ((CheckBox)sender).Checked;
-   204  
-   205 _mainForm.ChangedConfigurationContinuation.Schedule(TimeSpan.FromSeconds(1),
-   206 async () => { await _mainForm.SaveConfiguration(); }, _cancellationToken);
200 #endregion 207 }
201 } 208 }
202 } 209 }