Exemplo n.º 1
0
        public void Remove(SimulateDataViewModel sdvmodel)
        {
            LinkedListNode <SimulateDataViewModel> node = SDVModels.Find(sdvmodel);

            if (node == null)
            {
                return;
            }
            MainGrid.RowDefinitions.RemoveAt(0);
            node = node.Next;
            while (node != null)
            {
                SimulateDataViewModel _sdvmodel = node.Value;
                int row = Grid.GetRow(_sdvmodel);
                Grid.SetRow(_sdvmodel, row - 1);
                node = node.Next;
            }
            Grid.SetRow(NewButton, SDVModels.Count() - 1);
            SDVModels.Remove(sdvmodel);
            MainGrid.Children.Remove(sdvmodel);
            sdvmodel.Closed        -= OnSDModelClose;
            sdvmodel.SDModelLock   -= OnSDModelLock;
            sdvmodel.SDModelView   -= OnSDModelView;
            sdvmodel.SDModelUnlock -= OnSDModelUnlock;
            sdvmodel.SDModelUnview -= OnSDModelUnview;
        }
Exemplo n.º 2
0
        public void Add(SimulateDataViewModel sdvmodel, int id)
        {
            if (id == sdvmodels.Count())
            {
                AddLast(sdvmodel);
                return;
            }
            RowDefinition rdef = new RowDefinition();

            rdef.Height = new GridLength(40);
            MainGrid.RowDefinitions.Add(rdef);
            SimulateDataViewModel _sdvmodel = sdvmodels.ElementAt(id);
            LinkedListNode <SimulateDataViewModel> nodestart = sdvmodels.Find(_sdvmodel);
            LinkedListNode <SimulateDataViewModel> node      = nodestart;

            while (node != null)
            {
                _sdvmodel = node.Value;
                int row = Grid.GetRow(_sdvmodel);
                Grid.SetRow(_sdvmodel, row + 1);
                node = node.Next;
            }
            Grid.SetRow(sdvmodel, id);
            sdvmodels.AddBefore(nodestart, sdvmodel);
            MainGrid.Children.Add(sdvmodel);
            sdvmodel.Closed        += OnSDModelClose;
            sdvmodel.SDModelLock   += OnSDModelLock;
            sdvmodel.SDModelView   += OnSDModelView;
            sdvmodel.SDModelUnlock += OnSDModelUnlock;
            sdvmodel.SDModelUnview += OnSDModelUnview;
        }
Exemplo n.º 3
0
        private void OnNewButtonClicked(object sender, MouseEventArgs e)
        {
            SimulateDataViewModel sdimodel = new SimulateDataViewModel();

            sdimodel.SDModelSetup += OnSDModelSetup;
            sdimodel.Closed       += OnSDModelClose;
            AddLast(sdimodel);
        }
Exemplo n.º 4
0
 public SimuViewChartModel(IEnumerable <SimulateDataModel> sdmodels)
 {
     InitializeComponent();
     sdvmodels = new LinkedList <SimulateDataViewModel>();
     sdcmodels = new LinkedList <SimulateDataChartModel>();
     foreach (SimulateDataModel sdmodel in sdmodels)
     {
         SimulateDataViewModel  sdvmodel = new SimulateDataViewModel(sdmodel);
         SimulateDataChartModel sdcmodel = new SimulateDataChartModel(sdmodel, TRuler);
         sdvmodels.AddLast(sdvmodel);
         sdcmodels.AddLast(sdcmodel);
     }
     ReinitializeComponent();
 }
Exemplo n.º 5
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);
         }
     }
 }
Exemplo n.º 6
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;
         }
     }
 }
Exemplo n.º 7
0
        public void AddLast(SimulateDataViewModel sdvmodel)
        {
            RowDefinition rdef = new RowDefinition();

            rdef.Height = new GridLength(40);
            MainGrid.RowDefinitions.Add(rdef);
            MainGrid.Children.Remove(NewButton);
            int count = SDVModels.Count();

            Grid.SetRow(sdvmodel, count);
            Grid.SetColumn(sdvmodel, 0);
            Grid.SetRow(NewButton, count + 1);
            Grid.SetColumn(NewButton, 0);
            SDVModels.AddLast(sdvmodel);
            MainGrid.Children.Add(sdvmodel);
            MainGrid.Children.Add(NewButton);
            sdvmodel.Closed        += OnSDModelClose;
            sdvmodel.SDModelLock   += OnSDModelLock;
            sdvmodel.SDModelView   += OnSDModelView;
            sdvmodel.SDModelUnlock += OnSDModelUnlock;
            sdvmodel.SDModelUnview += OnSDModelUnview;
        }
Exemplo n.º 8
0
        public void Add(SimulateDataModel sdmodel, int id)
        {
            SimulateDataViewModel sdvmodel = new SimulateDataViewModel(sdmodel);

            Add(sdvmodel, id);
        }
Exemplo n.º 9
0
        public void AddLast(SimulateDataModel sdmodel)
        {
            SimulateDataViewModel sdvmodel = new SimulateDataViewModel(sdmodel);

            AddLast(sdvmodel);
        }