diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-06-04 16:13:14 +0200 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2020-06-04 16:14:10 +0200 |
| commit | 89ef03b5bf7a317a290c5161d5e5cc1c6df8bc1d (patch) | |
| tree | ae7823bfde636fc1f62eeaf5564ab5d90b95daec /Samples | |
| parent | bae9b85da7089fed1ca5dd7882f4f83b74fa6a34 (diff) | |
remove loadTemplate with declaringType args, use normal iml load for templates, single static GetStreamFromPath in all cases
Diffstat (limited to 'Samples')
| -rw-r--r-- | Samples/ShowCase/ShowCase.cs | 42 | ||||
| -rw-r--r-- | Samples/common/ui/Interfaces/Divers/testFocus.crow | 6 |
2 files changed, 22 insertions, 26 deletions
diff --git a/Samples/ShowCase/ShowCase.cs b/Samples/ShowCase/ShowCase.cs index 10da3683..8f3c70ec 100644 --- a/Samples/ShowCase/ShowCase.cs +++ b/Samples/ShowCase/ShowCase.cs @@ -10,9 +10,8 @@ using Crow.IML; namespace ShowCase { - class Showcase : Interface + class Showcase : SampleBase { - static void Main () { #if NETCOREAPP3_1 @@ -24,8 +23,20 @@ namespace ShowCase public Container crowContainer; + public string CurrentDir { + get { return Configuration.Global.Get<string> ("CurrentDir"); } + set { + if (CurrentDir == value) + return; + Configuration.Global.Set ("CurrentDir", value); + NotifyValueChanged ("CurrentDir",CurrentDir); + } + } + protected override void OnInitialized () { + if (string.IsNullOrEmpty (CurrentDir)) + CurrentDir = Path.Combine (Directory.GetCurrentDirectory (), "Interfaces"); Widget g = Load ("#ShowCase.showcase.crow"); g.DataSource = this; crowContainer = g.FindByName ("CrowContainer") as Container; @@ -46,12 +57,6 @@ namespace ShowCase #endif } - public Showcase () - : base (1024, 800) - { - } - - void Dv_SelectedItemChanged (object sender, SelectionChangeEventArgs e) { FileSystemInfo fi = e.NewValue as FileSystemInfo; @@ -59,23 +64,11 @@ namespace ShowCase return; if (fi is DirectoryInfo) return; - hideError (); - lock (UpdateMutex) { - try { - Widget g = CreateInstance (fi.FullName); - crowContainer.SetChild (g); - g.DataSource = this; - } catch (Exception ex) { - Console.WriteLine (ex.ToString ()); - showError (ex); - } - } string source = ""; using (Stream s = new FileStream (fi.FullName, FileMode.Open)) { - using (StreamReader sr = new StreamReader (s)) { + using (StreamReader sr = new StreamReader (s)) source = sr.ReadToEnd (); - } } NotifyValueChanged ("source", source); } @@ -104,9 +97,12 @@ namespace ShowCase crowContainer.SetChild (g); g.DataSource = this; } + } catch (InstantiatorException itorex) { + Console.WriteLine (itorex.ToString ()); + showError (itorex.InnerException); } catch (Exception ex) { - Console.WriteLine (ex.ToString ()); - showError ((Exception)ex); + Console.WriteLine (ex); + showError (ex); } } diff --git a/Samples/common/ui/Interfaces/Divers/testFocus.crow b/Samples/common/ui/Interfaces/Divers/testFocus.crow index 1f262631..d8f914ee 100644 --- a/Samples/common/ui/Interfaces/Divers/testFocus.crow +++ b/Samples/common/ui/Interfaces/Divers/testFocus.crow @@ -29,15 +29,15 @@ </Menu> <HorizontalStack Height="Fit"> <Label Text="Hover:" Width="50" Foreground="Grey"/> - <Label Text="{HoverWidget}"/> + <Label Text="{HoverWidget}" Font="mono, 8"/> </HorizontalStack> <HorizontalStack Height="Fit"> <Label Text="Focus:" Width="50" Foreground="Grey"/> - <Label Text="{FocusedWidget}"/> + <Label Text="{FocusedWidget}" Font="mono, 8"/> </HorizontalStack> <HorizontalStack Height="Fit"> <Label Text="Active:" Width="50" Foreground="Grey"/> - <Label Text="{ActiveWidget}"/> + <Label Text="{ActiveWidget}" Font="mono, 8"/> </HorizontalStack> <Container Fit="true" Margin="50" Background="SlateGrey"> <Label Text="MouseEvents" Margin="3" Focusable="true" Fit="true" |