Changeset View
Changeset View
Standalone View
Standalone View
src/examples/elementary/efl_ui_unit_converter.cs
Show All 17 Lines | 5 | #if EFL_BETA | |||
---|---|---|---|---|---|
18 | { | 18 | { | ||
19 | Efl.Ui.AlertPopup popup = new Efl.Ui.AlertPopup(win); | 19 | Efl.Ui.AlertPopup popup = new Efl.Ui.AlertPopup(win); | ||
20 | Efl.Ui.Text popup_text = new Efl.Ui.Text(popup); | 20 | Efl.Ui.Text popup_text = new Efl.Ui.Text(popup); | ||
21 | popup_text.SetText($"Error: {message}"); | 21 | popup_text.SetText($"Error: {message}"); | ||
22 | popup.SetContent(popup_text); | 22 | popup.SetContent(popup_text); | ||
23 | popup.SetVisible(true); | 23 | popup.SetVisible(true); | ||
24 | popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Ok", null); | 24 | popup.SetButton(Efl.Ui.AlertPopupButton.Positive, "Ok", null); | ||
25 | popup.SetSize(new Eina.Size2D(150, 30)); | 25 | popup.SetSize(new Eina.Size2D(150, 30)); | ||
26 | popup.ButtonClickedEvt += (object sender, Efl.Ui.AlertPopupButtonClickedEvt_Args e) => { | 26 | popup.ButtonClickedEvent += (object sender, Efl.Ui.AlertPopupButtonClickedEventArgs e) => { | ||
27 | popup.SetParent(null); | 27 | popup.SetParent(null); | ||
28 | popup.Invalidate(); | 28 | popup.Invalidate(); | ||
29 | }; | 29 | }; | ||
30 | } | 30 | } | ||
31 | 31 | | |||
32 | #if WIN32 // Passed to the C# compiler with -define:WIN32 | 32 | #if WIN32 // Passed to the C# compiler with -define:WIN32 | ||
33 | // Mono on Windows by default uses multi-thread apartments for COM stuff while | 33 | // Mono on Windows by default uses multi-thread apartments for COM stuff while | ||
34 | // OLE - used by ecore win32 DnD requires single threading for COM. | 34 | // OLE - used by ecore win32 DnD requires single threading for COM. | ||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Line(s) | 37 | public static void Main() { | |||
94 | kms_button.SetText("To Miles"); | 94 | kms_button.SetText("To Miles"); | ||
95 | kms_button.SetSize(size); | 95 | kms_button.SetSize(size); | ||
96 | kms_button.SetVisible(true); | 96 | kms_button.SetVisible(true); | ||
97 | 97 | | |||
98 | kms_box.DoPack(kms_label); | 98 | kms_box.DoPack(kms_label); | ||
99 | kms_box.DoPack(kms_input); | 99 | kms_box.DoPack(kms_input); | ||
100 | kms_box.DoPack(kms_button); | 100 | kms_box.DoPack(kms_button); | ||
101 | 101 | | |||
102 | ((Efl.Ui.Clickable)kms_button).ClickedEvt += (object sender, EventArgs e) => { | 102 | ((Efl.Ui.Clickable)kms_button).ClickedEvent += (object sender, EventArgs e) => { | ||
103 | try | 103 | try | ||
104 | { | 104 | { | ||
105 | string text = kms_input.GetText(); | 105 | string text = kms_input.GetText(); | ||
106 | Console.WriteLine("Text is [{0}]", text); | 106 | Console.WriteLine("Text is [{0}]", text); | ||
107 | double val = double.Parse(text); | 107 | double val = double.Parse(text); | ||
108 | miles_input.SetText(String.Format("{0:f3}", KmsToMiles(val))); | 108 | miles_input.SetText(String.Format("{0:f3}", KmsToMiles(val))); | ||
109 | kms_input.SetFocus(true); | 109 | kms_input.SetFocus(true); | ||
110 | } | 110 | } | ||
111 | catch (FormatException ex) | 111 | catch (FormatException ex) | ||
112 | { | 112 | { | ||
113 | Console.WriteLine("Exception {0} caught", ex); | 113 | Console.WriteLine("Exception {0} caught", ex); | ||
114 | ShowErrorPopup(win, "Invalid number"); | 114 | ShowErrorPopup(win, "Invalid number"); | ||
115 | } | 115 | } | ||
116 | }; | 116 | }; | ||
117 | 117 | | |||
118 | ((Efl.Ui.Clickable)miles_button).ClickedEvt += (object sender, EventArgs e) => { | 118 | ((Efl.Ui.Clickable)miles_button).ClickedEvent += (object sender, EventArgs e) => { | ||
119 | try | 119 | try | ||
120 | { | 120 | { | ||
121 | string text = miles_input.GetText(); | 121 | string text = miles_input.GetText(); | ||
122 | Console.WriteLine("Text is [{0}]", text); | 122 | Console.WriteLine("Text is [{0}]", text); | ||
123 | double val = double.Parse(text); | 123 | double val = double.Parse(text); | ||
124 | kms_input.SetText(String.Format("{0:f3}", MilesToKms(val))); | 124 | kms_input.SetText(String.Format("{0:f3}", MilesToKms(val))); | ||
125 | miles_input.SetFocus(true); | 125 | miles_input.SetFocus(true); | ||
126 | } | 126 | } | ||
Show All 29 Lines |