private void Label_MouseDown(object sender, MouseButtonEventArgs e) { SplashScreen splashScreen = new SplashScreen("IOPT_Splash.png"); splashScreen.Show(false); Hide(); try { var o = sender as Label; if (o == null) { return; } Settings.Current = o.Tag as Settings; if (true)//Network.Connect() { Cursor = Cursors.Arrow; Main.GetMainWindow().DGProp.ItemsSource = View.ModelToView(); Main.GetMainWindow().Show(); splashScreen.Close(new TimeSpan(0)); } else { Show(); splashScreen.Close(new TimeSpan(0)); Message.Show((string)Application.Current.Resources["Errid1"], (string)Application.Current.Resources["Dialogid5"]); } } catch (Exception ex) { Show(); splashScreen.Close(new TimeSpan(0)); Message.Show((string)Application.Current.Resources["Errid1"] + ex.Message, (string)Application.Current.Resources["Dialogid5"]); } }
private void DeleteEvent(object sender, RoutedEventArgs e) { if (!(sender is Button)) { return; } if (((Button)sender).Tag is Model) { if ((bool)Message.Show((string)Application.Current.Resources["Dialogid1"], (string)Application.Current.Resources["Dialogid3"], true)) { //if(Network.IoTFactory.DeleteModel((sender as Button).Tag as Model)) Platform.Current.Models.Remove(((Button)sender).Tag as Model); } } if (((Button)sender).Tag is Object) { ELobjects.SelectedItem = ((Button)sender).Tag; if (ELmodels.SelectedItem != null) { if ((bool)Message.Show((string)Application.Current.Resources["Dialogid1"], (string)Application.Current.Resources["Dialogid3"], true)) { //if (Network.IoTFactory.DeleteObject((sender as Button).Tag as Object)) (ELmodels.SelectedItem as Model).Objects.Remove((sender as Button).Tag as Object); } } } if (((Button)sender).Tag is Property) { ELproperties.SelectedItem = ((Button)sender).Tag; if (ELobjects.SelectedItem != null) { if ((bool)Message.Show((string)Application.Current.Resources["Dialogid1"], (string)Application.Current.Resources["Dialogid3"], true)) { //if (Network.IoTFactory.DeleteProperty((sender as Button).Tag as Property)) (ELobjects.SelectedItem as Object)?.Properties.Remove(((Button)sender).Tag as Property); } } } if (((Button)sender).Tag is Script) { ELscripts.SelectedItem = ((Button)sender).Tag; if (ELproperties.SelectedItem != null) { if ((bool)Message.Show((string)Application.Current.Resources["Dialogid1"], (string)Application.Current.Resources["Dialogid3"], true)) { //if (Network.IoTFactory.DeleteScript((sender as Button).Tag as Script)) (ELproperties.SelectedItem as Property).Scripts.Remove((sender as Button).Tag as Script); } } } Main.GetMainWindow().Notified(null, null); }