Example #1
0
 public GraphItemViewModel(GraphItemModel model, UserControl view)
 {
     Model = model;
     SubscribeModel();
     Control          = view;
     view.DataContext = this;
     InitializeCommands();
 }
Example #2
0
 public void HighlightAsCheckouted(GraphItemModel m)
 {
     if (Checkouted != null)
     {
         Checkouted.Checkouted = false;
     }
     Checkouted   = m;
     m.Checkouted = true;
 }
Example #3
0
 public void MouseUp(object sender, CrossStateData data, MouseButtonEventArgs e)
 {
     if (sender != null && sender == Aimed)
     {
         Program.GetInstance().Show(Aimed);
     }
     Aimed = null;
     MouseEnter(sender, data);
 }
Example #4
0
        public void AimHead()
        {
            GraphItemModel i = ZoomAndPanCanvasModel.Branches.Find(b => b.IsHead);

            if (i == null)
            {
                i = ZoomAndPanCanvasModel.Commits.Find(c => c.Checkouted);
            }
            Aim(i);
        }
Example #5
0
 public void Branch(GraphItemModel i, string name)
 {
     if (i != null)
     {
         CreateBranch(name, (dynamic)i);
     }
     else
     {
         Repository.CreateBranch(name);
     }
 }
Example #6
0
        public void OnAddBranch(GraphItemModel m)
        {
            var dialog = new InputDialog();

            dialog.Validator = text => Logic.LibGitService.GetInstance().IsValidRefName(text);
            dialog.Text      = "Enter name of new branch";
            if (dialog.ShowDialog() == true)
            {
                LibGitService.GetInstance().Branch(m, dialog.ResponseText);
            }
        }
Example #7
0
 public void Checkout(GraphItemModel m)
 {
     if (m is BranchLabelModel)
     {
         Commands.Checkout(Repository, ((BranchLabelModel)m).Branch);
     }
     else
     {
         Commands.Checkout(Repository, ((CommitNodeModel)m).Commit);
     }
 }
Example #8
0
        public void Rebase(BranchLabelModel rebasing, BranchLabelModel rebased)
        {
            GraphItemModel checkouted = Graph.Checkouted;

            Checkout(rebasing);
            bool succes = LibGitService.Merge(rebased);

            if (succes)
            {
                Checkout(rebased);
            }
        }
Example #9
0
        public void Merge(BranchLabelModel merging, BranchLabelModel merged)
        {
            GraphItemModel checkouted = Graph.Checkouted;

            Checkout(merging);
            bool succes = LibGitService.Merge(merged);

            if (succes)
            {
                Checkout(checkouted);
            }
        }
Example #10
0
 void UnsubscribeEvents(GraphItemModel m)
 {
     m.MouseDown  -= EventHandlerBatch.MouseDownEventHandler;
     m.MouseUp    -= EventHandlerBatch.MouseUpEventHandler;
     m.MouseEnter -= EventHandlerBatch.MouseEnterEventHandler;
     m.MouseLeave -= EventHandlerBatch.MouseLeaveEventHandler;
     m.AddBranch  -= EventHandlerBatch.AddBranchEventHandler;
     if (m is CommitNodeModel)
     {
         ((CommitNodeModel)m).ShowChanges -= EventHandlerBatch.ShowChangesEventHandler;
     }
 }
Example #11
0
 public void HighlightAsFocused(GraphItemModel model)
 {
     if (Focused != null)
     {
         Focused.Focused = false;
     }
     Focused = model;
     if (model != null)
     {
         model.Focused = true;
     }
 }
Example #12
0
        public GraphItemModel Next()
        {
            if (!Future.Any())
            {
                throw new InvalidOperationException("ViewHistory has not any future.");
            }
            GraphItemModel n = History.First();

            History.RemoveFirst();
            Future.AddFirst(n);
            return(n);
        }
Example #13
0
 public void HighlightAsMarked(GraphItemModel model)
 {
     if (Marked != null)
     {
         Marked.Marked = false;
     }
     Marked = model;
     if (model != null)
     {
         model.Marked = true;
     }
 }
Example #14
0
        public GraphItemModel Previous()
        {
            if (!History.Any())
            {
                throw new InvalidOperationException("ViewHistory has not any history.");
            }
            GraphItemModel n = Future.First();

            Future.RemoveFirst();
            History.AddFirst(n);
            return(n);
        }
Example #15
0
 void SubscribeEvents(GraphItemModel m)
 {
     m.MouseDown  += EventHandlerBatch.MouseDownEventHandler;
     m.MouseUp    += EventHandlerBatch.MouseUpEventHandler;
     m.MouseEnter += EventHandlerBatch.MouseEnterEventHandler;
     m.MouseLeave += EventHandlerBatch.MouseLeaveEventHandler;
     m.AddBranch  += EventHandlerBatch.AddBranchEventHandler;
     if (m is CommitNodeModel)
     {
         ((CommitNodeModel)m).ShowChanges += EventHandlerBatch.ShowChangesEventHandler;
     }
 }
Example #16
0
 public void MouseDown(object sender, CrossStateData data, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Left)
     {
         if (sender == null)
         {
             Graph.GetInstance().CaptureMaouse();
             ChangeState(MovingCanvas.GetInstance());
         }
         else
         {
             Aimed = (GraphItemModel)sender;
         }
     }
 }
Example #17
0
        public void ImplicitPush(GraphItemModel checkouted)
        {
            Branch b1  = Repository.Head;
            string str = Repository.Head.Reference.ResolveToDirectReference().TargetIdentifier;

            if (checkouted is BranchLabelModel && ((BranchLabelModel)checkouted).Branch.Reference.CanonicalName == Repository.Head.CanonicalName)
            {
                return;
            }
            string descr   = checkouted is BranchLabelModel ? "branch " + ((BranchLabelModel)checkouted).Name : "commit" + ((CommitNodeModel)checkouted).Commit.Sha;
            string message = "Implicit stash before checkout " + descr + ".";
            Stash  s       = Push(message);

            if (s != null)
            {
                LogStash(s.Reference.TargetIdentifier);
            }
        }
Example #18
0
 public void Mark(GraphItemModel i)
 {
     Graph.HighlightAsMarked(i);
 }
Example #19
0
 public void Aim(GraphItemModel i)
 {
     ResetTranslate();
     AggresiveMove(new Vector(-i.Location.X, -i.Location.Y));
     Program.GetInstance().Show(i);
 }
Example #20
0
 public void ShowItem(GraphItemModel m)
 {
     MainTabModel.Shown = m;
 }
Example #21
0
 public void EnsureAbsence(GraphItemModel n)
 {
     History.Remove(n);
     Future.Remove(n);
 }
Example #22
0
 public void Branch(GraphItemModel i, string name)
 {
     LibGitService.Branch(i, name);
 }
Example #23
0
 public void Checkout(GraphItemModel m)
 {
     Program.GetInstance().StashingManager.ImplicitPush(m);
     LibGitService.Checkout(m);
     Graph.HighlightAsCheckouted(m);
 }
Example #24
0
 public void WindowMouseUp(object sender, CrossStateData data, MouseButtonEventArgs e)
 {
     Aimed = null;
     MouseEnter(sender, data);
 }
Example #25
0
        void CheckoutMarked()
        {
            GraphItemModel marked = TabManager.MainTabModel.Shown;

            CommitManager.Checkout(marked);
        }
Example #26
0
 void ChangeState(IProgramState state)
 {
     Aimed = null;
     Program.ChangeState(state);
 }
Example #27
0
 public void Show(GraphItemModel item)
 {
     CommitManager.Mark(item);
     TabManager.ShowItem(item);
     ActionsManager.OnMarkedItem(item != null);
 }
Example #28
0
 public void Add(GraphItemModel node)
 {
     Future.Clear();
     History.AddFirst(node);
 }