-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallerDeneme.cs
156 lines (128 loc) · 5.06 KB
/
InstallerDeneme.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
namespace GtkSharpSamples
{
using System;
using System.IO;
using System.IO.Compression;
using Gtk;
public class SampleAssistant : Assistant
{
public static int Main(string[] argv)
{
Application.Init();
new SampleAssistant().ShowAll();
Application.Run();
return 0;
}
ProgressBar progress_bar;
public SampleAssistant()
{
SetSizeRequest(450, 300);
Title = "Gtk.Assistant Sample";
// ANA SAYFA
Label lbl = new Label("HELLO PEOPLE OF EKINOKS");
AppendPage(lbl);
SetPageTitle(lbl, "Introduction");
SetPageType(lbl, AssistantPageType.Intro);
SetPageComplete(lbl, true);
// ZIP SECME SAYFASI
FileChooserButton fileChooserButton = new FileChooserButton("Choose the instalation zip", 0);
HBox box = new HBox(true, 1);
box.PackStart(fileChooserButton);
fileChooserButton.CurrentFolderChanged += new EventHandler(Deneme);
AppendPage(box);
SetPageTitle(box, "Choose zip, people of Ekinoks");
SetPageType(box, AssistantPageType.Content);
//ESKI YAZI SEC SAYFASI
//HBox box = new HBox(false, 6);
//box.PackStart(new Label("Enter some text: "), false, false, 6);
//Entry entry = new Entry();
//entry.Changed += new EventHandler(EntryChanged);
//box.PackStart(entry, false, false, 6);
//Entry entry2 = new Entry();
//entry2.Changed += new EventHandler(EntryChanged);
//box.PackStart(entry2, false, false, 6);
//AppendPage(box);
//SetPageTitle(box, "Getting Some Input");
//SetPageType(box, AssistantPageType.Content);
CheckButton chk = new CheckButton("I think Gtk# is awesome.");
chk.Toggled += new EventHandler(ButtonToggled);
AppendPage(chk);
SetPageTitle(chk, "Provide Feedback");
SetPageType(chk, AssistantPageType.Content);
Alignment al = new Alignment(0.5f, 0.5f, 0.0f, 0.0f);
box = new HBox(false, 6);
progress_bar = new ProgressBar();
box.PackStart(progress_bar, true, true, 6);
Button btn = new Button("Make progress");
btn.Clicked += new EventHandler(ButtonClicked);
box.PackStart(btn, false, false, 6);
al.Add(box);
AppendPage(al);
SetPageTitle(al, "Show Some Progress");
SetPageType(al, AssistantPageType.Progress);
lbl = new Label("In addition to being able to type,\nYou obviously have great taste in software.");
AppendPage(lbl);
SetPageTitle(lbl, "Congratulations");
SetPageType(lbl, AssistantPageType.Confirm);
SetPageComplete(lbl, true);
Cancel += new EventHandler(AssistantCancel);
Close += new EventHandler(AssistantClose);
}
protected void Deneme(object o, EventArgs args)
{
string zipPath = ((FileChooserButton)o).Filename;
string extractPath = ((FileChooserButton)o).CurrentFolderUri;
Console.WriteLine(zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);
}
protected override bool OnDeleteEvent(Gdk.Event ev)
{
Console.WriteLine("Assistant Destroyed prematurely");
Application.Quit();
return true;
}
// If there is text in the GtkEntry, set the page as complete.
void EntryChanged(object o, EventArgs args)
{
string text = (o as Gtk.Entry).Text;
SetPageComplete(GetNthPage(CurrentPage), text.Length > 0);
}
// If check button is checked, set the page as complete.
void ButtonToggled(object o, EventArgs args)
{
bool active = (o as ToggleButton).Active;
SetPageComplete(o as Widget, active);
}
// Progress 10% per second after button clicked.
void ButtonClicked(object o, EventArgs args)
{
(o as Widget).Sensitive = false;
GLib.Timeout.Add(500, new GLib.TimeoutHandler(TimeoutCallback));
}
double fraction = 0.0;
bool TimeoutCallback()
{
fraction += 5.0;
progress_bar.Fraction = fraction / 100.0;
progress_bar.Text = String.Format("{0}% Complete", fraction);
if (fraction == 100.0)
{
SetPageComplete(progress_bar.Parent.Parent, true);
return false;
}
return true;
}
void AssistantCancel(object o, EventArgs args)
{
Console.WriteLine("Assistant cancelled.");
Destroy();
Application.Quit();
}
void AssistantClose(object o, EventArgs args)
{
Console.WriteLine("Assistant ran to completion.");
Destroy();
Application.Quit();
}
}
}