| | |
| | | } |
| | | |
| | | var content = data.Content; |
| | | var last = page.Child; |
| | | PluginPackage.Get(last)?.DeActive(); |
| | | var newPlugin = PluginPackage.Get(content); |
| | | var last = PluginPackage.Get(page.Child); |
| | | |
| | | if (last != null && !last.CanDeActive()) |
| | | { |
| | | SelectedSubMenu = (PluginInfo)e.RemovedItems[0]; |
| | | return; |
| | | } |
| | | |
| | | if (newPlugin != null && !newPlugin.CanActive()) |
| | | { |
| | | if (e.RemovedItems.Count > 0) |
| | | { |
| | | SelectedSubMenu = (PluginInfo)e.RemovedItems[0]; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | last?.DeActive(); |
| | | newPlugin?.Active(); |
| | | if (data.Type == "WinForm") |
| | | { |
| | | if (content is System.Windows.Forms.Form form) |
| | |
| | | { |
| | | page.Child = (UIElement)content; |
| | | } |
| | | |
| | | PluginPackage.Get(content)?.Active(); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | Loaded -= UserControl_Loaded; |
| | | } |
| | | |
| | | private string alarmInfo; |
| | | public string AlarmInfo |
| | | { |
| | | get => alarmInfo; |
| | | set |
| | | { |
| | | RaiseAndSetIfChanged(ref alarmInfo, value); |
| | | } |
| | | } |
| | | |
| | | private void Button_Click_1(object sender, RoutedEventArgs e) |
| | | { |
| | | alarmBorder.Visibility = Visibility.Collapsed; |
| | | AlarmInfo = string.Empty; |
| | | } |
| | | |
| | | public void ShowAlarm(string message) |
| | | { |
| | | AlarmInfo = message; |
| | | alarmBorder.Visibility = Visibility.Visible; |
| | | } |
| | | } |
| | | } |