示例#1
0
        public static void OnAddNewQuery(object sender, ExecutedRoutedEventArgs e)
        {
            TagsDataGrid control = sender as TagsDataGrid;

            if (control == null)
            {
                return;
            }
            if (e.OriginalSource is DataGridCell)
            {
                try
                {
                    ScadaDeviceUpdateQuery query = (ScadaDeviceUpdateQuery)((DataGridCell)e.OriginalSource).DataContext;
                    CustomWindow           wnd   = new CustomWindow();
                    query.Name += "_Copy";
                    TagSettingsControl cl = new TagSettingsControl(query, true);
                    wnd.Content               = cl;
                    wnd.Title                 = "Add New Tag";
                    wnd.MinHeight             = 260;
                    wnd.MaxHeight             = 380;
                    wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                    wnd.Owner                 = Window.GetWindow(control);
                    wnd.ShowDialog();
                }
                catch (InvalidCastException ex)
                {
                    control.AddTagMethod();
                }
            }
        }
示例#2
0
        public static void OnEnableTag(object sender, ExecutedRoutedEventArgs e)
        {
            TagsDataGrid control = sender as TagsDataGrid;

            if (control == null)
            {
                return;
            }

            if (control.SelectedQuery != null)
            {
                control.SelectedQuery.IsEnabled = (bool)((ToggleButton)e.OriginalSource).IsChecked;
                List <ScadaDeviceUpdateQuery> quieries = new List <ScadaDeviceUpdateQuery>();
                quieries.Add(control.SelectedQuery);
                ServerManager.Instance.AddUpdateScadaQuery(quieries);
            }
        }
示例#3
0
        public static void OnShowTresholds(object sender, ExecutedRoutedEventArgs e)
        {
            TagsDataGrid control = sender as TagsDataGrid;

            if (control == null)
            {
                return;
            }

            if (control.SelectedQuery != null)
            {
                CustomWindow wnd = new CustomWindow();
                wnd.Title     = "Thresholds";
                wnd.MinHeight = 260;
                wnd.MaxHeight = 380;
                TagThresholdsGrid cl = new TagThresholdsGrid(control.SelectedQuery.Tresholds);
                //TagSettingsControl cl = new TagSettingsControl(SelectedQuery, false);
                //cl.SelectedQuery = new Objects.Modbus.SCADA.ScadaDeviceUpdateQuery();
                wnd.Content = cl;
                wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                wnd.Owner = Window.GetWindow(control);
                wnd.ShowDialog();
            }
        }