Esempio n. 1
0
 private void OnSDModelUnview(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimulateDataViewModel)
     {
         e.SDVModel = (SimulateDataViewModel)(sender);
         if (SDModelUnview != null)
         {
             SDModelUnview(this, e);
         }
     }
     if (sender is SimuViewChartModel)
     {
         if (e.SDVModel == null)
         {
             foreach (SimulateDataViewModel sdvmodel in SDVModels)
             {
                 if (sdvmodel.SDModel == e.SDModel_old)
                 {
                     e.SDVModel = sdvmodel;
                 }
             }
         }
         if (e.SDVModel == null)
         {
             throw new KeyNotFoundException();
         }
         //e.SDVModel.HideViewFlag();
         e.SDVModel.ViewFlag.Visibility  = Visibility.Hidden;
         e.SDVModel.MI_ViewButton.Header = "监视";
     }
 }
Esempio n. 2
0
 //public event SimulateDataModelEventHandler SDModelSetup;
 private void OnSDModelSetup(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimuViewChartModel)
     {
         if (e.SDCModel == null)
         {
             foreach (SimulateDataChartModel sdcmodel in SDCModels)
             {
                 if (sdcmodel.SDModel == e.SDModel_old)
                 {
                     e.SDCModel = sdcmodel;
                     break;
                 }
             }
         }
         if (e.SDCModel == null)
         {
             Add(e.SDModel_new, e.ID);
         }
         else
         {
             e.SDCModel.Setup(e.SDModel_new);
         }
     }
 }
Esempio n. 3
0
 private void OnXYModelCreate(object sender, SimulateDataModelEventArgs e)
 {
     if (XYModelCreate != null)
     {
         XYModelCreate(this, e);
     }
 }
Esempio n. 4
0
 private void OnSDModelDraw(object sender, SimulateDataModelEventArgs e)
 {
     if (SDModelDraw != null)
     {
         SDModelDraw(this, e);
     }
 }
Esempio n. 5
0
 private void OnSDModelLock(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimulateDataViewModel)
     {
         e.SDVModel = (SimulateDataViewModel)(sender);
         if (SDModelLock != null)
         {
             SDModelLock(this, e);
         }
     }
     if (sender is SimuViewChartModel)
     {
         if (e.SDVModel == null)
         {
             foreach (SimulateDataViewModel sdvmodel in SDVModels)
             {
                 if (sdvmodel.SDModel == e.SDModel_old)
                 {
                     e.SDVModel = sdvmodel;
                 }
             }
         }
         if (e.SDVModel == null)
         {
             throw new KeyNotFoundException();
         }
         //e.SDVModel.ShowLockFlag();
         e.SDVModel.LockFlag.Visibility  = Visibility.Visible;
         e.SDVModel.MI_LockButton.Header = "取消锁定";
     }
 }
Esempio n. 6
0
 private void OnSDModelDelete(object sender, SimulateDataModelEventArgs e)
 {
     foreach (SimulateDataChartModel sdcmodel in VChart.CursorCollection())
     {
         VChart.CursorRemoveValue(sdcmodel.SDModel);
     }
 }
Esempio n. 7
0
 private void OnSDModelUnview(object sender, SimulateDataModelEventArgs e)
 {
     e.SDModel_new.IsView = false;
     if (SDModelUnview != null)
     {
         SDModelUnview(this, e);
     }
 }
Esempio n. 8
0
 private void OnSDModelUnlock(object sender, SimulateDataModelEventArgs e)
 {
     e.SDModel_new.IsLock = false;
     if (SDModelUnlock != null)
     {
         SDModelUnlock(this, e);
     }
 }
Esempio n. 9
0
        private void MI_Select_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            if (SDModelSelect != null)
            {
                SDModelSelect(this, _e);
            }
        }
Esempio n. 10
0
        private void OnSDModelPaste(object sender, SimulateDataModelEventArgs e)
        {
            int id = e.ID;

            foreach (SimulateDataModel sdmodel in copysdmodels)
            {
                SimulateDataChartModel sdcmodel = VChart.SDCModels.ElementAt(id);
                VChart.SetValue(sdmodel, sdcmodel.SDModel, (int)(copystart), (int)(copyend), (int)(e.TimeStart), (int)(e.TimeEnd));
            }
        }
Esempio n. 11
0
        private void MI_LoadAll_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.TimeStart = CursorTimeStart();
            _e.TimeEnd   = CursorTimeEnd();
            if (SDModelLoadAll != null)
            {
                SDModelLoadAll(this, _e);
            }
        }
Esempio n. 12
0
 private void OnSDModelCopy(object sender, SimulateDataModelEventArgs e)
 {
     copysdmodels.Clear();
     copystart = e.TimeStart;
     copyend   = e.TimeEnd;
     foreach (SimulateDataChartModel sdcmodel in VChart.CursorCollection())
     {
         SimulateDataModel sdmodel = sdcmodel.SDModel.Clone();
         copysdmodels.Add(sdmodel);
     }
 }
Esempio n. 13
0
 private void OnRunDataFinished(object sender, SimulateDataModelEventArgs e)
 {
     foreach (SimulateDataChartModel sdcmodel in SDCModels)
     {
         SimulateDataModel sdmodel = sdcmodel.SDModel;
         if (sdmodel.IsView)
         {
             sdcmodel.Update();
         }
     }
 }
Esempio n. 14
0
        private void MI_Delete_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.TimeStart = CursorTimeStart();
            _e.TimeEnd   = CursorTimeEnd();
            if (SDModelDelete != null)
            {
                SDModelDelete(this, _e);
            }
            UpdateChart();
        }
Esempio n. 15
0
        private void MI_Paste_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.TimeStart = CursorTimeStart();
            _e.TimeEnd   = CursorTimeEnd();
            _e.ID        = (int)(Math.Min(cssy, csey) / 40);
            if (SDModelPaste != null)
            {
                SDModelPaste(this, _e);
            }
            UpdateChart();
        }
Esempio n. 16
0
 private void OnSDModelView(object sender, SimulateDataModelEventArgs e)
 {
     if (e.SDModel_old.IsLock)
     {
         e.SDModel_new.IsLock = false;
         if (SDModelUnlock != null)
         {
             SDModelUnlock(this, e);
         }
     }
     e.SDModel_new.IsView = true;
     if (SDModelView != null)
     {
         SDModelView(this, e);
     }
 }
Esempio n. 17
0
        private void LoadXml(string filename)
        {
            XDocument xdoc      = XDocument.Load(filename);
            XElement  node_Root = xdoc.Element("SimuDatas");
            IEnumerable <XElement>     node_SDModels = node_Root.Elements("SimuDataNode");
            SimulateDataModelEventArgs e;

            foreach (SimulateDataChartModel sdcmodel in VChart.SDCModels)
            {
                SimulateDataModel sdmodel = sdcmodel.SDModel;
                e             = new SimulateDataModelEventArgs();
                e.SDModel_old = sdmodel;
                e.SDModel_new = null;
                OnSDModelClose(this, e);
            }
            //VList.Clear();
            //VChart.Clear();
            int id = 0;

            foreach (XElement node_SDModel in node_SDModels)
            {
                SimulateDataModel sdmodel = new SimulateDataModel();
                sdmodel.LoadXml(node_SDModel);
                e             = new SimulateDataModelEventArgs();
                e.SDModel_new = sdmodel;
                e.ID          = id++;
                if (SDModelSetup != null)
                {
                    SDModelSetup(this, e);
                }
            }
            foreach (SimulateDataChartModel sdcmodel in VChart.SDCModels)
            {
                SimulateDataModel sdmodel = sdcmodel.SDModel;
                e             = new SimulateDataModelEventArgs();
                e.SDModel_new = sdmodel;
                if (sdmodel.IsLock && SDModelLock != null)
                {
                    SDModelLock(this, e);
                }
                if (sdmodel.IsView && SDModelView != null)
                {
                    SDModelView(this, e);
                }
            }
        }
Esempio n. 18
0
 private void OnSDModelClose(object sender, RoutedEventArgs e)
 {
     if (sender is SimulateDataViewModel)
     {
         SimulateDataViewModel sdvmodel = (SimulateDataViewModel)(sender);
         if (!SDVModels.Contains(sdvmodel))
         {
             return;
         }
         if (SDModelClose != null)
         {
             SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();
             _e.SDModel_old = sdvmodel.SDModel;
             _e.SDVModel    = sdvmodel;
             SDModelClose(sender, _e);
         }
     }
 }
Esempio n. 19
0
        private void OnRunDrawFinished(object sender, SimulateDataModelEventArgs e)
        {
            List <SimulateDataModel> views = new List <SimulateDataModel>();

            foreach (SimulateDataChartModel sdcmodel in SDCModels)
            {
                SimulateDataModel sdmodel = sdcmodel.SDModel;
                if (sdmodel.IsView)
                {
                    views.Add(sdmodel);
                }
            }
            e.SDModels = views;
            if (XYModelCreate != null)
            {
                XYModelCreate(this, e);
            }
        }
Esempio n. 20
0
 private void OnSDModelSetup(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimulateDataViewModel)
     {
         SimulateDataViewModel sdvmodel = (SimulateDataViewModel)(sender);
         e.SDVModel = sdvmodel;
         e.ID       = 0;
         foreach (SimulateDataViewModel _sdvmodel in SDVModels)
         {
             if (sdvmodel == _sdvmodel)
             {
                 break;
             }
             e.ID++;
         }
         if (SDModelSetup != null)
         {
             SDModelSetup(sender, e);
         }
     }
     if (sender is SimuViewChartModel)
     {
         if (e.SDVModel == null)
         {
             foreach (SimulateDataViewModel sdvmodel in SDVModels)
             {
                 if (sdvmodel.SDModel == e.SDModel_old)
                 {
                     sdvmodel.SDModel = e.SDModel_new;
                     e.SDVModel       = sdvmodel;
                     break;
                 }
             }
         }
         if (e.SDVModel == null)
         {
             Add(e.SDModel_new, e.ID);
         }
         else
         {
             e.SDVModel.SDModel = e.SDModel_new;
         }
     }
 }
Esempio n. 21
0
        private void OnSDModelLoadAll(object sender, SimulateDataModelEventArgs e)
        {
            OpenFileDialog ofdialog = new OpenFileDialog();

            ofdialog.Filter = "SimuWave文件|*.siw";
            ofdialog.Title  = "读取仿真波形文件";
            if (ofdialog.ShowDialog() == true)
            {
                try
                {
                    string filename = ofdialog.FileName;
                    LoadXml(filename);
                }
                catch (Exception)
                {
                    LocalizedMessageBox.Show("读取波形文件失败!", LocalizedMessageIcon.Error);
                }
            }
        }
Esempio n. 22
0
        private void OnSDModelSaveAll(object sender, SimulateDataModelEventArgs e)
        {
            SaveFileDialog sfdialog = new SaveFileDialog();

            sfdialog.Filter = "SimuWave文件|*.siw";
            sfdialog.Title  = "保存仿真波形文件";
            if (sfdialog.ShowDialog() == true)
            {
                try
                {
                    string filename = sfdialog.FileName;
                    SaveXml(filename);
                }
                catch (Exception)
                {
                    LocalizedMessageBox.Show("保存波形文件失败!", LocalizedMessageIcon.Error);
                }
            }
        }
Esempio n. 23
0
        private void MI_ViewButton_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.SDModel_old = _e.SDModel_new = SDModel;
            if (!SDModel.IsView)
            {
                if (SDModelView != null)
                {
                    SDModelView(this, _e);
                }
            }
            else
            {
                if (SDModelUnview != null)
                {
                    SDModelUnview(this, _e);
                }
            }
        }
Esempio n. 24
0
        private void MI_LockButton_Click(object sender, RoutedEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.SDModel_old = _e.SDModel_new = SDModel;
            if (!SDModel.IsLock)
            {
                if (SDModelLock != null)
                {
                    SDModelLock(this, _e);
                }
            }
            else
            {
                if (SDModelUnlock != null)
                {
                    SDModelUnlock(this, _e);
                }
            }
        }
Esempio n. 25
0
        private void OnSDModelClose(object sender, SimulateDataModelEventArgs e)
        {
            SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();

            _e.SDCModel = e.SDCModel;
            _e.SDVModel = e.SDVModel;
            if (SDModelUnlock != null && e.SDModel_old.IsLock)
            {
                _e.SDModel_old = _e.SDModel_new = e.SDModel_old;
                SDModelUnlock(this, _e);
            }
            if (SDModelUnview != null && e.SDModel_old.IsView)
            {
                _e.SDModel_old = _e.SDModel_new = e.SDModel_old;
                SDModelUnview(this, _e);
            }
            if (SDModelClose != null)
            {
                SDModelClose(this, e);
            }
        }
Esempio n. 26
0
 private void OnSDModelClose(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimuViewChartModel)
     {
         if (e.SDVModel == null)
         {
             foreach (SimulateDataViewModel sdvmodel in SDVModels)
             {
                 if (sdvmodel.SDModel == e.SDModel_old)
                 {
                     e.SDVModel = sdvmodel;
                     break;
                 }
             }
         }
         if (e.SDVModel == null)
         {
             throw new ArgumentException();
         }
         Remove(e.SDVModel);
     }
 }
Esempio n. 27
0
 private void OnSDModelUnview(object sender, SimulateDataModelEventArgs e)
 {
     if (sender is SimuViewChartModel)
     {
         if (e.SDCModel == null)
         {
             foreach (SimulateDataChartModel sdcmodel in SDCModels)
             {
                 if (sdcmodel.SDModel == e.SDModel_old)
                 {
                     e.SDCModel = sdcmodel;
                     break;
                 }
             }
         }
         if (e.SDCModel == null)
         {
             throw new KeyNotFoundException();
         }
         e.SDCModel.Update();
     }
 }
Esempio n. 28
0
 private void OnInputKeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         string name = NameTextInput.Text;
         Match  m1   = Regex.Match(name, @"^\w+\d+$");
         //Match m2 = Regex.Match(name, @"^\w+\[\d+\.\.\d+\]$");
         //Match m3 = Regex.Match(name, @"^\w+\b\w+\d+$");
         //Match m4 = Regex.Match(name, @"^\w+\b\w+\[\d+\.\.\d+\]$");
         if (m1.Success)
         {
             SimulateDataModel _sdmodel = SimulateDataModel.Create(name);
             if (_sdmodel != null && SDModelSetup != null)
             {
                 SimulateDataModelEventArgs _e = new SimulateDataModelEventArgs();
                 _e.SDModel_new = _sdmodel;
                 //_e.SDVModel = this;
                 Setup(_sdmodel);
                 SDModelSetup(this, _e);
             }
         }
     }
 }
Esempio n. 29
0
 private void OnSDModelSelect(object sender, SimulateDataModelEventArgs e)
 {
 }