-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.cs
634 lines (620 loc) · 30.3 KB
/
MainWindow.cs
1
2
3
4
5
6
7
8
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
//using System;
using System.Diagnostics;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
using System.Xml.Linq;
namespace oobe
{
public class MainWindow : Window
{
[UI] private Label _label1 = null;
[UI] private Label _label2 = null;
[UI] private Label _liveinfolabel = null;
[UI] private Button _button1 = null;
[UI] private Button _button2 = null;
[UI] private Image _thum = null;
[UI] private Image _live_icon = null;
[UI] private Image texteditoricon = null;
[UI] private Image browsericon = null;
[UI] private ProgressBar _progress = null;
[UI] private Box packagelistbox = null;
[UI] private ComboBoxText texteditorcombo = null;
[UI] private ComboBoxText browsercombo = null;
[UI] private TextView eulaview = null;
[UI] private ScrolledWindow windoweulaview = null;
[UI] private CheckButton toggleswitch = null;
[UI] private ButtonBox _navigationbar = null;
[UI] private Box _navi_install = null;
[UI] private Button _calamares = null;
[UI] private Label _pionever = null;
[UI] private Button _liveenv = null;
[UI] private Button _window_info = null;
[UI] private Box _infomationbar = null;
[UI] private Spinner _progresscircle = null;
private int _state = 0;
private bool loginview = false;
private bool windowstimesync = false;
private bool packagelisted = false;
private int _bypass_network = 0;
private int eulaviewed = 0;
// インストールするパッケージの指定用変数
private XElement texteditorlistroot = null!;
private XElement browserlistroot = null!;
//
public MainWindow() : this(new Builder("MainWindow.glade")) { }
private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
{
builder.Autoconnect(this);
DeleteEvent += Window_DeleteEvent;
// OSバージョンの確認
string[] lines = File.ReadAllLines("/etc/os-release");
string prettyNameLine = lines.FirstOrDefault(line => line.StartsWith("VERSION="));
_pionever.Text = "ver." + prettyNameLine.Split('=')[1].Trim('"');
// CSS Apply
var provider = new CssProvider();
var cssdata = "._navi_install { background-color: #E0E0E0; padding: 10px 10px 10px 10px;}._navigationbar{ background-color: #E0E0E0; padding: 5px 5px 5px 5px} .border{ padding: 1px 0px 1px 0px} ";
provider.LoadFromData(cssdata);
StyleContext.AddProviderForScreen(Gdk.Screen.Default, provider, 800);
// Live 環境かどうかのチェック
if (Directory.Exists("/live"))
{
_label2.Text = "PioneOS ライブメディアへようこそ";
_thum.Visible = true;
_navigationbar.Visible = false;
_label1.Visible = false;
_progress.Visible = false;
windoweulaview.Visible = false;
toggleswitch.Visible = false;
_button2.Visible = false;
_progresscircle.Visible = false;
_navi_install.Visible = true;
_liveinfolabel.Visible = true;
packagelistbox.Visible = false;
_liveinfolabel.Text = "こんにちは、何をしたいですか?";
var image = new Gdk.Pixbuf("/usr/share/pioneos/oobe/Assets/pioneos.png",48,48);
_live_icon.Pixbuf = image;
_calamares.Clicked += _calamares_Clicked;
_liveenv.Clicked += _liveenv_Clicked;
_window_info.Clicked += _window_info_Clicked;
Console.WriteLine("Live 環境です");
_thum.Visible = false;
//_thum.File = "/usr/share/pioneos/oobe/Assets/pioneos.png";
}
else{
Console.WriteLine("非 Live 環境です");
_button1.Clicked += Button1_Clicked;
_button2.Clicked += Button2_Clicked;
_progress.Visible = false;
windoweulaview.Visible = false;
toggleswitch.Visible = false;
_button2.Visible = false;
_progresscircle.Visible = false;
_navi_install.Visible = false;
_liveinfolabel.Visible = false;
_live_icon.Visible = true;
_window_info.Visible = false;
packagelistbox.Visible = false;
_thum.File = "/usr/share/pioneos/oobe/Assets/pioneos.png";
}
this.Decorated = false;
this.DeleteEvent += (o, args) => args.RetVal = true;
}
private void Button2_Clicked(object sender, EventArgs e)
{
if (_bypass_network == 7 && _state == 0){
_state = 4;
_button2.Opacity = 1.0;
_button2.Label = "<戻る";
setAsync(sender, e);
}
else if (_state == 3){
var dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.Ok, "エンドユーザーライセンスに同意しない場合は、PioneOS をご利用できません。\n初期ページに戻ります");
dialog.Run();
dialog.Destroy();
windoweulaview.Visible = false;
_thum.Visible = true;
_state = 0;
setAsync(sender, e);
}
else {
_state--;
setAsync(sender, e);
}
}
private void Window_DeleteEvent(object sender, DeleteEventArgs a)
{
if (_state <= 4)
{
Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "このウィンドウは閉じれません。\nウィンドウを切り替えるには Alt + Tab を押します。");
dialog.Run();
dialog.Destroy();
a.RetVal = true;
}
}
private async void Button1_Clicked(object sender, EventArgs a)
{
_button2.Label = "<戻る";
_button2.Opacity = 1.0;
_button1.Label = "次へ>";
_state++;
setAsync(sender, a);
}
private void logintoggled(object sender,EventArgs a)
{
//if (_state == 4){
// if (toggleswitch.Active == true){
// _thum.File = "/usr/share/pioneos/oobe/Assets/usernameoff.png";
// loginview = false;
// }
// else{
// _thum.File = "/usr/share/pioneos/oobe/Assets/usernameon.png";
// loginview = true;
// }}
if (_state == 4){
if (toggleswitch.Active == true){
windowstimesync = true;
}
else{
windowstimesync = false;
}
}
}
//Calamares を起動する
private async void _calamares_Clicked(object sender,EventArgs a)
{
_progresscircle.Visible = true;
_navi_install.Visible = false;
_window_info.Visible = false;
await Task.Delay(2);
var processInfo_calamares = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = "calamares"
};
_progresscircle.Visible = true;
_navi_install.Visible = false;
_window_info.Visible = false;
await Task.Delay(2);
using (Process pwatch = Process.Start(processInfo_calamares))
{
if (pwatch != null)
{
await pwatch.WaitForExitAsync();
}
}
_progresscircle.Visible = false;
_navi_install.Visible = true;
_window_info.Visible = true;
Console.WriteLine("end");
Application.Invoke(delegate {Deiconify();});
}
private async void _liveenv_Clicked(object sender,EventArgs a)
{
_progresscircle.Visible = true;
_navi_install.Visible = false;
_window_info.Visible = false;
await Task.Delay(2);
var processInfo_calamares = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = false,
RedirectStandardOutput = true,
Arguments = "/usr/share/pioneos/oobe/livetodesktop.sh"
};
_progresscircle.Visible = true;
_navi_install.Visible = false;
_window_info.Visible = false;
await Task.Delay(2);
Process.Start(processInfo_calamares);
}
private async void _window_info_Clicked(object sender, EventArgs a)
{
AboutDialog aboutdialog = new AboutDialog();
aboutdialog.ProgramName = "PioneOS Setup";
byte[] epreview = File.ReadAllBytes("/usr/share/pioneos/oobe/Assets/pioneos.png");
var image = new Gdk.Pixbuf(epreview,128,128);
aboutdialog.Logo = image;
aboutdialog.Title = "PioneOS Setup";
aboutdialog.Comments = "PioneOS をセットアップするソフトウェアです。";
aboutdialog.Copyright = "(C)2024 PioneOS Group";
aboutdialog.Authors = new string[] { "Budobudou" };
// aboutdialog.License = "this software uses gtksharp";
aboutdialog.Run();
aboutdialog.ShowAll();
aboutdialog.Destroy();
}
private async Task setAsync(object sender, EventArgs a)
{
Console.WriteLine(_state);
if (_state == 0){
_label2.Text = "Welcome to PioneOS!";
_label1.Text = "このプロセスでは PioneOS を使う準備をします。\n続けるには「次へ」をクリックしてください。";
_thum.File = "/usr/share/pioneos/oobe/Assets/pioneos.png";
_infomationbar.Visible = true;
// アイコン設定
_live_icon.IconName = "face-smile";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
_button1.Sensitive = _button2.Sensitive = true;
//
_pionever.Visible = true;
_bypass_network++;
if (_bypass_network == 7){
_button2.Visible = true;
_button2.Label = "bypass";
_button1.Label = "次へ>";
_button2.Opacity = 0.5;
}
else{
_button2.Label = "<戻る";
_button1.Label = "次へ>";
_button2.Visible = false;
}
}
else if (_state == 1){
_label2.Text = "インターネットへの接続";
_button1.Visible = _button2.Visible = true;
_navigationbar.Visible = true;
_thum.Visible = true;
eulaview.Visible = false;
windoweulaview.Visible = false;
_infomationbar.Visible = false;
_label1.Text = "PioneOS のセットアップにはインターネット接続が必要です。\n無線 LAN の場合は画面左下のアイコンをクリックして接続先を選択します。\n有線 LAN の場合は接続してから左下のアイコンを確認します。";
_button1.Label = "接続を確認>";
_button2.Label = "<戻る";
_thum.File = "/usr/share/pioneos/oobe/Assets/network.png";
_pionever.Visible = false;
// アイコン設定
_live_icon.IconName = "internet-archive";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
//
}
else if (_state == 2){
_button1.Sensitive = _button2.Sensitive = false;
_label1.Text = "インターネット接続を確認中です。\nしばらくお待ちください。";
try{
var connectcheck = new HttpClient();
await connectcheck.GetAsync("http://ospio.net");
connectcheck.Dispose();
_state++;
}
catch{
Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "インターネット接続が確認できませんでした。\n接続を確認してから再度お試しください。");
dialog.Run();
dialog.Destroy();
_state = 1;
}
await setAsync(sender, a);
}
else if (_state == 3){
_button1.Sensitive = _button2.Sensitive = true;
_label2.Text = "エンドユーザー ライセンスの確認";
toggleswitch.Visible = false;
_label1.Text = "エンドユーザー ライセンスを読んで同意してください。\n同意しない場合は、PioneOS をご利用できません。";
_thum.Visible = false;
eulaview.Visible = true;
packagelistbox.Visible = false;
_progresscircle.Visible = false;
_button1.Sensitive = _button2.Sensitive = false;
_button1.Label = "同意>";
_button2.Label = "<拒否";
windoweulaview.Visible = true;
// アイコン設定
_live_icon.IconName = "notes";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
//
try{
if (eulaviewed == 0){
var connectcheck = new HttpClient();
var eulaget = await connectcheck.GetAsync("http://ospio.net/eula.txt");
if (eulaget.IsSuccessStatusCode == false){
throw new Exception("EULA の取得に失敗しました。");
}
connectcheck.Dispose();
string eulakekka = await eulaget.Content.ReadAsStringAsync();
var tagLarge = new TextTag("large"){SizePoints = 17,Weight = Pango.Weight.Bold};
eulaview.Buffer.TagTable.Add(tagLarge);
//eulakekka の行数を取得
var iter = eulaview.Buffer.EndIter;
var lines = eulakekka.Split('\n');
foreach (var line in eulakekka.Split('\n'))
{
if (line.StartsWith("!")){
string lineremove = line.Replace("!", "");
eulaview.Buffer.InsertWithTags(ref iter, lineremove + "\n", tagLarge);
}
else{
eulaview.Buffer.Insert(ref iter, line + "\n");
}
eulaviewed = 1;
}
//行数分ループ
}
_button1.Sensitive = _button2.Sensitive = true;
}
catch (Exception e){
Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "インターネット接続が確認できませんでした。接続を確認してから再度お試しください。\n\nエラー:"+ e.Message);
dialog.Run();
dialog.Destroy();
_state = 1;
await setAsync(sender, a);
}
}
else if(_state == 4){
_label2.Text = "ソフトウェアの選択";
_button1.Visible = true;
_button2.Visible = true;
toggleswitch.Visible = false;
_thum.Visible = false;
eulaview.Visible = false;
windoweulaview.Visible = false;
_button1.Label = "次へ>";
_button2.Label = "<戻る";
_label1.Text = "ここでデフォルトで使用するソフトウェアを選択することができます。\nなお、ここに表示されるソフトウェアは後からでも手動でインストールできます。";
// アイコン設定
_live_icon.IconName = "downloader";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
_button1.Sensitive = _button2.Sensitive = false;
// インストールするパッケージィの設定
if (packagelisted == false)
{
texteditorcombo.AppendText("nano&vim");
texteditorcombo.Active = 0;
browsercombo.AppendText("Chromium");
browsercombo.Active = 0;
//テキストエディタリスト
var connectcheck2 = new HttpClient();
try{
_progresscircle.Visible = true;
var texteditorlistget = await connectcheck2.GetAsync("http://ospio.net/packagelists/texteditorlist.xml");
string texteditorlist = await texteditorlistget.Content.ReadAsStringAsync();
XDocument texteditorlistxml = XDocument.Parse(texteditorlist);
texteditorlistroot = texteditorlistxml.Element("data");
foreach (XElement textitem in texteditorlistroot.Elements("item"))
{
Console.WriteLine(textitem.Element("id").Value);
texteditorcombo.AppendText(textitem.Element("name").Value);
}
var browserlistget = await connectcheck2.GetAsync("http://ospio.net/packagelists/browserlist.xml");
string browserlist = await browserlistget.Content.ReadAsStringAsync();
XDocument browserlistxml = XDocument.Parse(browserlist);
browserlistroot = browserlistxml.Element("data");
foreach (XElement textitem in browserlistroot.Elements("item"))
{
Console.WriteLine(textitem.Element("id").Value);
browsercombo.AppendText(textitem.Element("name").Value);
}
packagelistbox.Visible = true;
}
catch{
Console.WriteLine("package list error");
}
connectcheck2.Dispose();
packagelisted = true;
}
_button1.Sensitive = _button2.Sensitive = true;
_progresscircle.Visible = false;
packagelistbox.Visible = true;
}
else if (_state == 5){
_label2.Text = "Windows とのデュアルブート環境向けの設定";
_button1.Visible = true;
_button2.Visible = true;
toggleswitch.Visible = true;
_progresscircle.Visible = false;
toggleswitch.Label = "デュアルブート向け設定を適用する";
_thum.Visible = false;
eulaview.Visible = false;
windoweulaview.Visible = false;
packagelistbox.Visible = false;
_label1.Text = "このチェックを入れると、PioneOS と Windows をデュアルブートする環境向けに以下の設定を適用します。\n1. 時刻ズレを修正するためにシステム時刻をローカル時刻へセット\n2.Windows で再起動するアイコンを作成";
_button1.Label = "次へ>";
_button2.Label = "<戻る";
_thum.PixelSize = 196;
// アイコン設定
_live_icon.IconName = "distributor-logo-windows";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
//
if (windowstimesync == true){
toggleswitch.Active = true;
}
else{
toggleswitch.Active = false;
}
}
else if(_state == 6){
_label1.Text = "PioneOS を快適にご利用いただくための最終処理を行っています。\n自動で再起動するまでこのまましばらくお待ちください!";
_button1.Visible = false;
toggleswitch.Visible = false;
_button2.Visible = false;
_progress.Visible = true;
packagelistbox.Visible = false;
_navigationbar.Visible = false;
_infomationbar.Visible = true;
_pionever.Visible = true;
_window_info.Visible = false;
_thum.Visible = true;
// アイコン設定
_live_icon.IconName = "checkmark";
_live_icon.PixelSize = 48;
_live_icon.Visible = true;
//
_label2.Text = "これで、初期設定が完了しました!";
var image = new Gdk.Pixbuf("/usr/share/pioneos/oobe/Assets/pioneos.png");
_thum.Pixbuf = image;
await Task.Run(() => StartProgressBarAnimation(_progress));
//まずは apt-get update だな
var processInfo3 = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = false,
Arguments = "/usr/share/pioneos/oobe/apt-get.sh",
RedirectStandardOutput = true
};
_pionever.Text = "進捗状況:Debian システムの更新中...";
using (Process pwatch = Process.Start(processInfo3)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
//パッケージのインストール
if(texteditorcombo.Active == 0)
{
Console.WriteLine("テキストエディタはデフォルトのままです");
}
else
{
// 選択された ID からアイテムを取得し、install をインストール
XElement installertext = texteditorlistroot.Elements("item").FirstOrDefault(item => (string)item.Element("id") == texteditorcombo.Active.ToString());
if (installertext != null)
{
string packageinstall = installertext.Element("install").Value;
string packageuninstall = installertext.Element("uninstall").Value;
//インストール開始
if(installertext.Element("howto").Value == "apt")
{
await Task.Delay(50);
var processInfo_textedit = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = true,
Arguments = "/usr/share/pioneos/oobe/texteditor.sh" + " " + packageinstall + " " + packageuninstall
};
_pionever.Text = "進捗状況:テキストブラウザのインストール中...";
using (Process pwatch = Process.Start(processInfo_textedit)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
Console.WriteLine(packageinstall + "をインストールしました。");
}
}
}
//ブラウザをインストール
if(browsercombo.Active == 0)
{
Console.WriteLine("ブラウザはデフォルトのままです");
}
else
{
// 選択された ID からアイテムを取得し、install をインストール
XElement installerbrowser = browserlistroot.Elements("item").FirstOrDefault(item => (string)item.Element("id") == browsercombo.Active.ToString());
string packageinstall = installerbrowser.Element("install").Value;
string packageuninstall = installerbrowser.Element("uninstall").Value;
string packagehowto = installerbrowser.Element("howto").Value;
string packagegpg = "";
string packagerepo = "";
string packagemanage = "";
if (installerbrowser != null)
{
if (packagehowto == "dpkg"){
packagegpg = installerbrowser.Element("url").Value;
}
else{
packagerepo = installerbrowser.Element("repo").Value;
packagegpg = installerbrowser.Element("gpg").Value;
packagemanage = installerbrowser.Element("manage").Value;
}
//インストール開始
if(installerbrowser.Element("howto").Value == "apt")
{
await Task.Delay(50);
var processInfo_browser = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = true,
Arguments = "/usr/share/pioneos/oobe/browser.sh" + " " + packageinstall + " " + packageuninstall + " " + packagehowto + " " + packagegpg + " " + packagerepo + " " + packagemanage
};
_pionever.Text = "進捗状況:Web ブラウザのインストール中...";
using (Process pwatch = Process.Start(processInfo_browser)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
Console.WriteLine(packageinstall + "をインストールしました。");
}
}
}
//時間同期など
_pionever.Text = "進捗状況:設定の最適化中...";
if (windowstimesync == true){
Console.WriteLine("windowstimesync.sh を実行します。");
var processInfo_windowstimesync = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = false,
Arguments = "/usr/share/pioneos/oobe/windowstimesync.sh",
RedirectStandardOutput = true,
};
using (Process pwatch = Process.Start(processInfo_windowstimesync)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
}
//最終処理、ここでサヨナラ
Console.WriteLine("fini2.sh を実行します。");
var process2Info = new ProcessStartInfo
{
FileName = "/usr/share/pioneos/oobe/fini2.sh",
UseShellExecute = false,
RedirectStandardOutput = true
};
Console.WriteLine("fini.sh を実行します。");
using (Process pwatch = Process.Start(process2Info)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
await Task.Delay(10);
var processInfo = new ProcessStartInfo
{
FileName = "sudo",
UseShellExecute = false,
Arguments = "/usr/share/pioneos/oobe/fini.sh",
RedirectStandardOutput = true
};
using (Process pwatch = Process.Start(processInfo)){if (pwatch != null){await pwatch.WaitForExitAsync();}}
}
static void StartProgressBarAnimation(ProgressBar _progress)
{
int animationInterval = 60;
Timer? timer = null;
bool increasing = true;
timer = new Timer((state) =>
{
double newFraction;
if (increasing)
{
newFraction = _progress.Fraction + 0.012;
}
else
{
newFraction = _progress.Fraction - 0.012;
}
if (newFraction >= 1.0 || newFraction <= 0.0)
{
newFraction = 0.0;
}
Application.Invoke((sender, e) =>
{
_progress.Fraction = newFraction;
});
}, null, 0, animationInterval);
}
}
//Gtk から該当のハンドルを受け取ったら
private void settexteditor(object sender, EventArgs a)
{
if(texteditorcombo.Active != 0)
{
Console.WriteLine(texteditorcombo.Active + "番のテキストエディタが選択されました");
XElement installertext = texteditorlistroot.Elements("item").FirstOrDefault(item => (string)item.Element("id") == texteditorcombo.Active.ToString());
texteditoricon.IconName = installertext.Element("icon").Value;
}
else
{
texteditoricon.IconName = "mousepad";
}
}
private void setbrowser(object sender, EventArgs a)
{
if(browsercombo.Active != 0)
{
Console.WriteLine(browsercombo.Active + "番のブラウザが選択されました");
XElement installertext = browserlistroot.Elements("item").FirstOrDefault(item => (string)item.Element("id") == browsercombo.Active.ToString());
browsericon.IconName = installertext.Element("icon").Value;
}
else
{
browsericon.IconName = "chromium";
}
}
}
}