예제 #1
0
 public void DeployGraph()
 {
     WaitingResult = WaitingDialogResult.Flawless;
     ZoomAndPanCanvasModel.Clear();
     ((Action)DoDeployGraph).BeginInvoke(OnDeployedGraph, null);
     Program.GetInstance().ShowWaitingDialog();
 }
예제 #2
0
 void SetModel(ZoomAndPanCanvasModel model)
 {
     Model = model;
     Model.TransformMatrixChanged += TransformMatrixChanged;
     Model.ContentUpdated         += UpdateContent;
     Model.ContentCleared         += CleareContent;
     CanvasTransform = new MatrixTransform(Model.TransformMatrix);
     Model.Released += () => View.ReleaseMouseCapture();
     Model.Captured += () => Mouse.Capture(View, CaptureMode.SubTree);
 }
예제 #3
0
 void UpdateGraph(IAsyncResult ar)
 {
     if (WaitingResult == WaitingDialogResult.Flawless)
     {
         Point p = GraphViewCenter();
         ZoomAndPanCanvasModel.Update(new Size(p.X * 2, p.Y * 2));
     }
     else
     {
         Program.GetInstance().CloseCurrentRepository();
     }
     Program.GetInstance().EndWaitingDialog(WaitingResult);
 }
예제 #4
0
        public void Scale(int wheelDelta, Point mouse)
        {
            Point  p            = GraphViewCenter();
            double desiredZoom  = Zoom * (wheelDelta > 0 ? 1.25 : 0.8);
            double boundedZoom  = Math.Max(0.5, Math.Min(3, desiredZoom));
            double boundedScale = boundedZoom / Zoom;

            Zoom = boundedZoom;
            AppSettings set    = ((App)Application.Current).Settings;
            Point       origin = set.UseMouseAsZoomOrigin ? mouse : Center;

            ZoomAndPanCanvasModel.Rescale(boundedScale, origin);
            ZoomAndPanCanvasModel.Move(new Vector(0, 0), new Size(p.X * 2, p.Y * 2));
        }
예제 #5
0
 void DoDeployGraph()
 {
     WaitingResult = WaitingDialogResult.Flawless;
     try
     {
         DeployCommitNodes();
         DeployBranchNodes();
         UpdateCheckouted();
         ZoomAndPanCanvasModel.CreateEdgePairs();
     }
     catch (OutOfMemoryException e)
     {
         WaitingResult = WaitingDialogResult.OutOfMemory;
     }
     catch (TooMuchCommitsException e)
     {
         WaitingResult = WaitingDialogResult.TooMuchCommits;
     }
 }
예제 #6
0
 public ZoomAndPanCanvasViewModel(ZoomAndPanCanvasModel model, ZoomAndPanCanvasView view)
 {
     SetModel(model);
     View             = view;
     View.DataContext = this;
 }
예제 #7
0
 public void ResetTranslate()
 {
     ZoomAndPanCanvasModel.Rescale(1 / Zoom, new Point(0, 0));
     Zoom = 1;
     Move(new Vector(double.MaxValue, double.MaxValue));
 }
예제 #8
0
        Vector AggresiveMove(Vector move)
        {
            Point p = GraphViewCenter();

            return(ZoomAndPanCanvasModel.AggresiveMove(move, new Size(p.X * 2, p.Y * 2)));
        }
예제 #9
0
 public void ReleaseMouseCapture()
 {
     ZoomAndPanCanvasModel.ReleaseMouseCapture();
 }
예제 #10
0
 public void CaptureMaouse()
 {
     ZoomAndPanCanvasModel.CaptureMouse();
 }