コード例 #1
0
ファイル: Overview.cs プロジェクト: wooln/AK47Source
        private void BindToDiagram(Diagram diagram)
        {
            if (diagram == null)
            {
                this.Model = null;
                return;
            }

            if (diagram.Model is PartsModel)
            {
                Diagram.Error("cannot show an Overview of a Diagram with a PartsModel");
                return;
            }

            ApplyTemplate();
            DiagramPanel vpanel = this.Panel;

            if (vpanel == null)
            {
                return;
            }
            //vpanel.IsVirtualizing = false;

            diagram.ApplyTemplate();
            DiagramPanel dpanel = diagram.Panel;

            if (dpanel == null)
            {
                return;
            }

            if (!this.BoundEventHandlers)
            {
                // try to avoid executing this twice
                this.BoundEventHandlers       = true;
                dpanel.ViewportBoundsChanged += this.ObservedPanel_ViewportBoundsChanged;
                dpanel.DiagramBoundsChanged  += this.ObservedPanel_DiagramBoundsChanged;
                dpanel.PartBoundsChanged     += this.ObservedPanel_PartBoundsChanged;
                dpanel.PartVisibleChanged    += this.ObservedPanel_PartVisibleChanged;
                diagram.TemplatesChanged     += this.ObservedDiagram_TemplatesChanged;
                diagram.ModelReplaced        += this.ObservedDiagram_ModelReplaced;
                vpanel.ViewportBoundsChanged += this.OverviewPanel_ViewportBoundsChanged;
            }

            UpdateModel();

            UpdateTemplates();

            BindBox();
        }
コード例 #2
0
ファイル: Overview.cs プロジェクト: jerryshi2007/AK47Source
    private void BindToDiagram(Diagram diagram) {
      if (diagram == null) {
        this.Model = null;
        return;
      }

      if (diagram.Model is PartsModel) {
        Diagram.Error("cannot show an Overview of a Diagram with a PartsModel");
        return;
      }

      ApplyTemplate();
      DiagramPanel vpanel = this.Panel;
      if (vpanel == null) return;
      //vpanel.IsVirtualizing = false;

      diagram.ApplyTemplate();
      DiagramPanel dpanel = diagram.Panel;
      if (dpanel == null) return;

      if (!this.BoundEventHandlers) {
        // try to avoid executing this twice
        this.BoundEventHandlers = true;
        dpanel.ViewportBoundsChanged += this.ObservedPanel_ViewportBoundsChanged;
        dpanel.DiagramBoundsChanged += this.ObservedPanel_DiagramBoundsChanged;
        dpanel.PartBoundsChanged += this.ObservedPanel_PartBoundsChanged;
        dpanel.PartVisibleChanged += this.ObservedPanel_PartVisibleChanged;
        diagram.TemplatesChanged += this.ObservedDiagram_TemplatesChanged;
        diagram.ModelReplaced += this.ObservedDiagram_ModelReplaced;
        vpanel.ViewportBoundsChanged += this.OverviewPanel_ViewportBoundsChanged;
      }

      UpdateModel();

      UpdateTemplates();

      BindBox();
    }