Пример #1
0
 private void EnterMultiSelectedState()
 {
     if (_selectRectOwner != null)
     {
         _selectRectOwner.ReleaseSelectRect();
         _selectRectOwner = null;
     }
 }
Пример #2
0
 private void InitAll()
 {
     _networks              = new LinkedList <SimuViewNetworkModel>();
     _selectRect            = new SelectRect();
     _selectStartNetwork    = null;
     _selectRectOwner       = null;
     _selectAllNetworks     = new SortedSet <SimuViewNetworkModel>();
     _selectAllNetworkCache = new SortedSet <SimuViewNetworkModel>();
 }
Пример #3
0
 private void EnterMultiSelectingState()
 {
     if (_selectStartNetwork != null)
     {
         _selectStartNetwork.IsSelectAreaMode = true;
     }
     if (_selectRectOwner != null)
     {
         _selectRectOwner.ReleaseSelectRect();
         _selectRectOwner = null;
     }
 }
Пример #4
0
 public void ClearAll()
 {
     if (_selectRectOwner != null)
     {
         _selectRectOwner.ReleaseSelectRect();
     }
     _networks.Clear();
     _selectStartNetwork = null;
     _selectRectOwner    = null;
     _selectAllNetworks.Clear();
     _selectAllNetworkCache.Clear();
     _selectRect.X = 0;
     _selectRect.Y = 0;
 }
Пример #5
0
 private void EnterSingleSelectedState()
 {
     if (_selectStartNetwork != null)
     {
         _selectStartNetwork.IsSelectAreaMode = false;
         _selectStartNetwork.IsSelectAllMode  = false;
         _selectStartNetwork = null;
     }
     _selectAllNetworks.Clear();
     foreach (var net in _selectAllNetworkCache)
     {
         net.IsSelectAreaMode = false;
         net.IsSelectAllMode  = false;
     }
     _selectAllNetworkCache.Clear();
 }
Пример #6
0
 public void AcquireSelectRect(SimuViewNetworkModel network)
 {
     if (_selectRectOwner == null)
     {
         _selectRectOwner = network;
     }
     else
     {
         if (_selectRectOwner != network)
         {
             _selectRectOwner.ReleaseSelectRect();
             _selectRectOwner = network;
         }
     }
     SelectionStatus = SelectStatus.SingleSelected;
 }
Пример #7
0
 public void Setup(LadderChart[] lcharts)
 {
     ClearAll();
     foreach (LadderChart lchart in lcharts)
     {
         SimuViewNetworkModel svnmodel = new SimuViewNetworkModel(this, _networks.Count() + 1);
         svnmodel.Setup(lchart);
         if (_selectRectOwner == null)
         {
             _selectRectOwner = svnmodel;
             svnmodel.AcquireSelectRect();
         }
         _networks.AddLast(svnmodel);
     }
     ReloadNetworksToStackPanel();
 }
Пример #8
0
 private void SelectRectDown()
 {
     if (_selectRectOwner != null)
     {
         if (_selectRect.Y + 1 < _selectRectOwner.RowCount)
         {
             _selectRect.Y++;
         }
         else
         {
             if (!_selectRectOwner.IsLastNetwork())
             {
                 _selectRectOwner.ReleaseSelectRect();
                 _selectRectOwner = _networks.ElementAt(_selectRectOwner.NetworkNumber + 1);
                 _selectRect.Y    = 0;
                 _selectRectOwner.AcquireSelectRect();
             }
         }
     }
 }
Пример #9
0
 private void SelectRectUp()
 {
     if (_selectRectOwner != null)
     {
         if (_selectRect.Y > 0)
         {
             _selectRect.Y--;
         }
         else
         {
             if (!_selectRectOwner.IsFirstNetwork())
             {
                 _selectRectOwner.ReleaseSelectRect();
                 _selectRectOwner = _networks.ElementAt(_selectRectOwner.NetworkNumber - 1);
                 _selectRect.Y    = _selectRectOwner.RowCount - 1;
                 _selectRectOwner.AcquireSelectRect();
             }
         }
     }
 }
Пример #10
0
 private void EnterIdleState()
 {
     if (_selectStartNetwork != null)
     {
         _selectStartNetwork.IsSelectAreaMode = false;
         _selectStartNetwork.IsSelectAllMode  = false;
         _selectStartNetwork = null;
     }
     if (_selectRectOwner != null)
     {
         _selectRectOwner.ReleaseSelectRect();
         _selectRectOwner = null;
     }
     _selectAllNetworks.Clear();
     foreach (var net in _selectAllNetworkCache)
     {
         net.IsSelectAreaMode = false;
         net.IsSelectAllMode  = false;
     }
     _selectAllNetworkCache.Clear();
 }
Пример #11
0
 /// <summary>
 /// Called when initialze the ladder diagram, do not call by user, for it can not undo
 /// </summary>
 /// <param name="network"></param>
 public void AppendNetwork(SimuViewNetworkModel network)
 {
     network.NetworkNumber = _networks.Count;
     _networks.AddLast(network);
     LadderNetworkStackPanel.Children.Add(network);
 }