Esempio n. 1
0
 public void PlaceActivityControlAt(int column, int row, IActivityControl activityControl,
                                    ActivityControlsLink sourceActivityControlsLink){
     var control = (Control) activityControl;
     Controls.Add(control);
     control.Location = new Point(column*CellWH, row*CellWH);
     control.Size = new Size(CellWH, CellWH);
     control.BringToFront();
     InitLinkControlBy(control, sourceActivityControlsLink);
 }
Esempio n. 2
0
 void activityControl_OnClickActivityControl(IActivityControl activityControl) {
     InvertSelectionFor(activityControl);
     SelectFirstSelectedIfNoSelection(activityControl);
     if (ShiftKeyIsPressed && SelectedSomeActivityControls) {
         SelectActivityControlsInRange(_firstSelectedActivityControl, activityControl);
         return;
     }
     ClearAllSelection();
     ReplaceFirstSelectedWith(activityControl);
     AddRemoveToSelectedList(activityControl);
 }
Esempio n. 3
0
 private void SelectActivityControlsInRange(IActivityControl firstSelectedActivityControl,
                                 IActivityControl currentActivityControl){
     Position startPosition = GetPosOf(firstSelectedActivityControl);
     Position finishPosition = GetPosOf(currentActivityControl);
     //изменить чтобы упорядочить по углам
     ClearAllSelection();
     for (int column = startPosition.Column; column <= finishPosition.Column; column++){
         for (int row = startPosition.Row; row <= finishPosition.Row; row++){
             IActivityControl activityControl = ActivityControls[column, row];
             if (activityControl == null)
                 continue;
             activityControl.Selected = true;
             AddToSelectedList(activityControl);
         }
     }
 }
Esempio n. 4
0
 private void SelectFirstSelectedIfNoSelection(IActivityControl activityControl){
     if (_firstSelectedActivityControl == null)
         _firstSelectedActivityControl = activityControl;
 }
Esempio n. 5
0
 private Position GetPosOf(IActivityControl activityControl){
     for (int column = 0; column < _columnCount; column++){
         for (int row = 0; row < _rowCount; row++){
             if (ActivityControls[column, row] != activityControl)
                 continue;
             return new Position(column, row);
         }
     }
     throw new Exception("Position is undefined for control");
 }
Esempio n. 6
0
 private void ReplaceFirstSelectedWith(IActivityControl activityControl){
     _firstSelectedActivityControl = activityControl;
 }
Esempio n. 7
0
 private static void ChangeSelectionColorFor(IActivityControl activityControl){
     ((Control) activityControl).BackColor = activityControl.Selected
                                                 ? Color.DarkGray
                                                 : activityControl.DefaultBGColor;
 }
Esempio n. 8
0
 private void RemoveFromSelectedList(IActivityControl activityControl){
     if (_selectedActivityControls.Contains(activityControl))
         _selectedActivityControls.Remove(activityControl);
     ChangeSelectionColorFor(activityControl);
 }
Esempio n. 9
0
 public ActivityControlsController(DesignFieldControl designFieldControl){
     _designFieldControl = designFieldControl;
     ActivityControls = new IActivityControl[_columnCount,_rowCount];
     _designFieldControl.OnClickInPos += designFieldControl_OnClickInPos;
 }
Esempio n. 10
0
 public static void InitControlBy(IActivityControl activityControl, Control groupBox, params Control[] controls){
     var control = (Control)activityControl;
     activityControl.DefaultBGColor = control.BackColor;
     groupBox.Size = new Size(control.Width - CellSpan*2, control.Height - CellSpan*2);
     groupBox.Location = new Point(CellSpan, CellSpan);
     control.Click += ChangeSelection;
     groupBox.Click += ChangeSelectionForParent;
     foreach (var subControl in controls)
         subControl.Click += ChangeSelectionForParentofParent;
 }
Esempio n. 11
0
 private static void InvertSelectionFor(IActivityControl activityControl){
     activityControl.Selected = !activityControl.Selected;
 }
Esempio n. 12
0
 void ActivityControlsController_OnDoubleClickActivityControl(IActivityControl activityControl) {
     if (OnExpandCompositeActivity != null)
         OnExpandCompositeActivity(activityControl.Activity);
 }
Esempio n. 13
0
  public void RegisterActivityControl(IActivityControl activityControl, BaseActivity sourceActivity, ActivityControlsLink sourceActivityControlsLink, int column, int row) {
     ActivityControls[column, row] = activityControl;
     activityControl.SourceActivity = sourceActivity;
     activityControl.OnClickActivityControl += activityControl_OnClickActivityControl;
     _designFieldControl.PlaceActivityControlAt(column, row, activityControl, sourceActivityControlsLink);
     activityControl.Init();
 }
Esempio n. 14
0
 private bool AddToSelectedList(IActivityControl activityControl){
     if (!activityControl.Selected)
         return false;
     if (!_selectedActivityControls.Contains(activityControl))
         _selectedActivityControls.Add(activityControl);
     ChangeSelectionColorFor(activityControl);
     return true;
 }
Esempio n. 15
0
 public ActivityControlsLink(IActivityControl sourceActivityControl, NeighbourDirections sourceOutputDirection) {
     _sourceActivityControl = sourceActivityControl;
     _sourceOutputDirection = sourceOutputDirection;
 }
Esempio n. 16
0
 private static void ChangeSelectionFor(IActivityControl activityControl){
     activityControl.FireOnClickActivityControl();
 }
Esempio n. 17
0
 private void AddRemoveToSelectedList(IActivityControl activityControl){
     if (AddToSelectedList(activityControl))
         return;
     RemoveFromSelectedList(activityControl);
 }