Beispiel #1
0
 private void GetUpMove(CProfileUserControl profileUserControl)
 {
     if (!Added)
     {
         if (_profileUserControls.Count == 1)
         {
             profileUserControl.Move = EMove.Null;
         }
         else
         {
             if (profileUserControl.Priority == 1)
             {
                 profileUserControl.Move = EMove.Down;
             }
             else if (profileUserControl.Priority == _profileUserControls.Count)
             {
                 profileUserControl.Move = EMove.Up;
             }
             else
             {
                 profileUserControl.Move = EMove.DownUp;
             }
         }
     }
 }
Beispiel #2
0
        private void Load(CPriorityProfile priorityProfile, bool added)
        {
            for (int i = 0; i < priorityProfile.GetCount(); i++)
            {
                CProfileUserControl profileUserControl;
                if (!added)
                {
                    if (priorityProfile.GetCount() == 1)
                    {
                        profileUserControl = new CProfileUserControl(priorityProfile.GetProfile(i + 1), EMove.Null, i + 1);
                    }
                    else
                    {
                        if (i == 0)
                        {
                            profileUserControl = new CProfileUserControl(priorityProfile.GetProfile(i + 1), EMove.Down, i + 1);
                        }
                        else if (i == priorityProfile.GetCount() - 1)
                        {
                            profileUserControl = new CProfileUserControl(priorityProfile.GetProfile(i + 1), EMove.Up, i + 1);
                        }
                        else
                        {
                            profileUserControl = new CProfileUserControl(priorityProfile.GetProfile(i + 1), EMove.DownUp, i + 1);
                        }
                    }
                }
                else
                {
                    profileUserControl = new CProfileUserControl(priorityProfile.GetProfile(i + 1), EMove.Null, i + 1);
                }

                Height = Height + profileUserControl.Height;
                profileUserControl.HorizontalAlignment = HorizontalAlignment.Right;
                profileUserControl.VerticalAlignment   = VerticalAlignment.Top;
                profileUserControl.Margin          = new Thickness(0, Height - profileUserControl.Height, 0, 0);
                profileUserControl.ButtonMoveUp   += CProfileUserControlMoveUp;
                profileUserControl.ButtonMoveDown += CProfileUserControlMoveDown;

                _profileUserControls.Add(profileUserControl);
                ((Grid)this.Content).Children.Add(profileUserControl);
            }
        }
Beispiel #3
0
        private void CProfileUserControlMove(int priority, EStep step)
        {
            DirectionWithProfile.PriorityProfile.ChangePriority(step, priority);
            CProfileUserControl buf = _profileUserControls[priority - 1];
            int thisControl         = priority - 1;
            int thatControl         = priority - 2 + (int)step * 2;

            _profileUserControls[thisControl].Priority = _profileUserControls[thisControl].Priority - 1 + (int)step * 2;
            _profileUserControls[thatControl].Priority = _profileUserControls[thatControl].Priority + 1 - (int)step * 2;

            Thickness thickness = new Thickness(0, _profileUserControls[thisControl].Margin.Top, 0, 0);

            _profileUserControls[thisControl].Margin = new Thickness(0, _profileUserControls[thatControl].Margin.Top * (1 - (int)step) +                                                 //Up
                                                                     (_profileUserControls[thisControl].Margin.Top + _profileUserControls[thatControl].Height) * (int)step, 0, 0);       //Down
            _profileUserControls[thatControl].Margin = new Thickness(0, thickness.Top * (int)step +                                                                                      //Up
                                                                     (_profileUserControls[thatControl].Margin.Top + _profileUserControls[thisControl].Height) * (1 - (int)step), 0, 0); //Down

            _profileUserControls[thisControl] = _profileUserControls[priority - 2 + (int)step * 2];
            _profileUserControls[thatControl] = buf;

            GetUpMove(_profileUserControls[thisControl]);
            GetUpMove(_profileUserControls[priority - 2 + (int)step * 2]);
        }