/// <summary>
        /// Adjusts the colors to match the current color theme.
        /// </summary>
        /// <param name="callBase">Calls the base functionality.</param>
        /// <param name="officeTheme">The current <see cref="OfficeTheme"/>.</param>
        public virtual void AdjustColorsForColorTheme(bool callBase, OfficeTheme officeTheme)
        {
            BackColor = officeTheme?.BodyBackgroundColor ?? SystemColors.Control;
            var hotLabels = this.GetChildControlsOfType <HotLabel>();

            foreach (var hotLabel in hotLabels)
            {
                hotLabel.AdjustColorsForColorTheme(officeTheme);
            }

            var listViews = this.GetChildControlsOfType <MySqlListView>();

            foreach (var listView in listViews)
            {
                listView.AdjustColorsForColorTheme(officeTheme);
            }

            var searchEdits = this.GetChildControlsOfType <SearchEdit>();

            foreach (var searchEdit in searchEdits)
            {
                searchEdit.AdjustColorsForColorTheme(officeTheme);
            }

            var panels = this.GetChildControlsOfType <Panel>();

            foreach (var panel in panels)
            {
                panel.BackColor = officeTheme?.BodyBackgroundColor ?? SystemColors.Control;
            }
        }
        public GroupingViewModel()
        {
            // Apply new theme, Snapsettings, Ruler  for Diagram.
            Theme = new OfficeTheme();

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.ShowLines,
            };

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            NodeViewModel Node1 = CreateNode(100, 100, "Rectangle", "");
            NodeViewModel Node2 = CreateNode(300, 100, "RoundedRectangle", "");
            NodeViewModel Node3 = CreateNode(100, 250, "Ellipse", "Start/Stop");
            NodeViewModel Node4 = CreateNode(300, 250, "PredefinedProcess", "Decision");
            NodeViewModel Node5 = CreateNode(100, 400, "Rectangle", "Process");

            CreateGroup(Node1, Node2);
        }
Exemple #3
0
        public UserHandlesDiagramViewModel()
        {
            #region Properties

            first = true;

            // Initialize value for Commands , properies of DiagramViewModel

            DuplicateCommand = new Command(OnDuplicateCommand);

            DeleteCommand = new Command(OnDeleteCommand);

            ItemSelectedCommand = new Command(OnItemSelectedCommand);

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.Rotator | SelectorConstraints.HideDisabledResizer,
            };

            Theme = new OfficeTheme();

            #endregion
        }
        public DiagramVM()
        {
            Theme            = new OfficeTheme();
            CollisionNode1   = CreateNode(100, 100, 650, 100, "CollisionNode1");
            CollisionNode2   = CreateNode(100, 100, 650, 350, "CollisionNode2");
            IgnoredNode      = CreateNode(100, 100, 650, 650, "IgnoreNode");
            IntersectingNode = CreateNode(60, 60, 100, 100, "Drag object");

            (Nodes as NodeCollection).Add(CollisionNode1);
            (Nodes as NodeCollection).Add(CollisionNode2);
            (Nodes as NodeCollection).Add(IgnoredNode);
            (Nodes as NodeCollection).Add(IntersectingNode);

            CollisionConnector1 = new ConnectorViewModel()
            {
                SourceNode = CollisionNode1,
                TargetNode = CollisionNode2,
            };

            CollisionConnector2 = new ConnectorViewModel()
            {
                SourceNode = CollisionNode2,
                TargetNode = IgnoredNode,
            };

            (Connectors as ConnectorCollection).Add(CollisionConnector1);
            (Connectors as ConnectorCollection).Add(CollisionConnector2);

            SelectorChangedCommand = new Command(OnSelectorChanged);
        }
Exemple #5
0
    private static Color GetThemedColor(int colorThemeIndex, double tintAndShade, Document doc)
    {
        // translate from wdThemeColorIndex to MsoThemeColorSchemeIndex
        MsoThemeColorSchemeIndex colorSchemeIndex = ThemeIndexToSchemeIndex(colorThemeIndex);
        // get color scheme by this index and take its RGB property, but this RGB still OLE RGB - i.e. BGR -> need to convert it to real RGB, i.e. use ColorTranslator.FromOle() and ToArgb after
        OfficeTheme      theme  = doc.DocumentTheme;
        ThemeColorScheme scheme = theme.ThemeColorScheme;
        ThemeColor       color  = scheme.Colors(colorSchemeIndex);
        int colorSchemeRGB      = ColorTranslator.FromOle(color.RGB).ToArgb();

        Marshal.ReleaseComObject(color);
        Marshal.ReleaseComObject(scheme);
        Marshal.ReleaseComObject(theme);

        // do RGB -> HSL translation to apply tint/shade
        HSL colorSchemeHSL = RGBtoHSL(colorSchemeRGB);

        // apply it
        if (tintAndShade > 0)
        {
            colorSchemeHSL.L += (1 - colorSchemeHSL.L) * tintAndShade;
        }
        else
        {
            colorSchemeHSL.L *= 1 - Math.Abs(tintAndShade);
        }

        // do backward HSL -> RGB translation
        int tintedAndShadedRGB = HSLtoRGB(colorSchemeHSL);

        return(Color.FromArgb(tintedAndShadedRGB));
    }
Exemple #6
0
 public BrainstormingVM(string file, bool isValidXml) : base(file, isValidXml)
 {
     LevelStyles = new Dictionary <int, System.Tuple <string, StyleId> >();
     LevelStyles.Add(0, new System.Tuple <string, StyleId>("Oval", StyleId.Variant1));
     LevelStyles.Add(1, new System.Tuple <string, StyleId>("Rectangle", StyleId.Variant1));
     LevelStyles.Add(2, new System.Tuple <string, StyleId>("Rectangle", StyleId.Variant1));
     LevelStyles.Add(3, new System.Tuple <string, StyleId>("Rectangle", StyleId.Variant1));
     DiagramType               = DiagramType.Brainstorming;
     this.Nodes                = new NodeVMCollection();
     this.Connectors           = new ConnectorVMCollection();
     Theme                     = new OfficeTheme();
     Constraints              |= GraphConstraints.Events;
     Constraints              &= ~GraphConstraints.Undoable;
     this.DefaultConnectorType = ConnectorType.Orthogonal;
     #region Diagram Commands
     this.ItemSelectedCommand      = new DelegateCommand <object>(ItemSelectedCommandExecute);
     this.AnnotationChangedCommand = new DelegateCommand <object>(AnnotationChangedCommandExecute);
     this.ItemDeletingCommand      = new DelegateCommand <object>(ItemDeletingCommandExecute);
     this.ItemDeletedCommand       = new DelegateCommand <object>(ItemDeletedCommandExecute);
     this.NodeChangedCommand       = new DelegateCommand <object>(NodeChangedCommandExecute);
     this.HorizontalRuler          = new Ruler()
     {
         Orientation     = Orientation.Horizontal,
         BorderBrush     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D4D4D4")),
         BorderThickness = new Thickness(0, 0, 0, 1)
     };
     this.VerticalRuler = new Ruler()
     {
         Orientation     = Orientation.Vertical,
         BorderBrush     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D4D4D4")),
         BorderThickness = new Thickness(0, 0, 1, 0)
     };
     if (this.SelectedItems is ISelectorVM)
     {
         (this.SelectedItems as ISelectorVM).SelectorConstraints |= SelectorConstraints.HideDisabledResizer;
     }
     //this.ExpandCollapse = new DelegateCommand<object>(ExpandCollapseCommandExecute);
     #endregion
     if (file == null)
     {
         AddRootNode();
     }
     this.LayoutManager = new Syncfusion.UI.Xaml.Diagram.Layout.LayoutManager()
     {
         Layout = new BrainStormingLayout()
         {
             LayoutRoot        = Rootnode,
             HorizontalSpacing = 25,
             VerticalSpacing   = 65
         }
     };
     CommandManager          = new Syncfusion.UI.Xaml.Diagram.CommandManager();
     CommandManager.Commands = new CommandCollection();
     AddKeyCommands();
     PageSettings = new PageVM();
     (PageSettings as PageVM).InitDiagram(this);
 }
        /// <summary>
        /// Adjusts the colors to match the current color theme.
        /// </summary>
        /// <param name="callBase">Calls the base functionality.</param>
        /// <param name="officeTheme">The current <see cref="OfficeTheme"/>.</param>
        public override void AdjustColorsForColorTheme(bool callBase, OfficeTheme officeTheme)
        {
            if (callBase)
            {
                base.AdjustColorsForColorTheme(false, officeTheme);
            }

            ConnectionInfoLabel.ForeColor =
                UserLabel.ForeColor       = officeTheme != null && officeTheme.ThemeColor.IsThemeColorDark()
          ? Color.LightGray
          : SystemColors.ControlDarkDark;
        }
Exemple #8
0
        /// <summary>
        /// Adjusts the colors to match the current color theme.
        /// </summary>
        /// <param name="officeTheme">Flag indicating whether the current color theme is dark.</param>
        public void AdjustColorsForColorTheme(OfficeTheme officeTheme)
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => AdjustColorsForColorTheme(officeTheme)));
                return;
            }

            var panels = this.GetChildControlsOfType <AutoStyleableBasePanel>();

            foreach (var panel in panels)
            {
                panel.AdjustColorsForColorTheme(true, officeTheme);
            }
        }
Exemple #9
0
        public UserHandlesDiagramViewModel()
        {
            #region Properties

            first = true;

            // Initialize value for Commands , properies of DiagramViewModel
            DuplicateCommand = new Command(OnDuplicateCommand);
            DeleteCommand    = new Command(OnDeleteCommand);

            SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~SelectorConstraints.Rotator | SelectorConstraints.HideDisabledResizer,
                Commands            = new QuickCommandCollection()
                {
                    new QuickCommandViewModel()
                    {
                        Shape               = App.Current.Resources["Ellipse"],
                        ShapeStyle          = App.Current.Resources["QuickCommandShapestyle"] as Style,
                        OffsetX             = 1,
                        OffsetY             = 1,
                        Command             = DuplicateCommand,
                        Content             = "M0,2.4879999 L0.986,2.4879999 0.986,9.0139999 6.9950027,9.0139999 6.9950027,10 0.986,10 C0.70400238,10 0.47000122,9.9060001 0.28100207,9.7180004 0.09400177,9.5300007 0,9.2959995 0,9.0139999 z M3.0050011,0 L9.0140038,0 C9.2960014,0 9.5300026,0.093999863 9.7190018,0.28199956 9.906002,0.47000027 10,0.70399952 10,0.986 L10,6.9949989 C10,7.2770004 9.906002,7.5160007 9.7190018,7.7110004 9.5300026,7.9069996 9.2960014,8.0049992 9.0140038,8.0049992 L3.0050011,8.0049992 C2.7070007,8.0049992 2.4650002,7.9069996 2.2770004,7.7110004 2.0890007,7.5160007 1.9950027,7.2770004 1.9950027,6.9949989 L1.9950027,0.986 C1.9950027,0.70399952 2.0890007,0.47000027 2.2770004,0.28199956 2.4650002,0.093999863 2.7070007,0 3.0050011,0 z",
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment   = VerticalAlignment.Center,
                        Margin              = new Thickness(20, 20, 0, 0),
                    }
                },
            };

            ItemAddedCommand = new Command(OnItemAdded);

            PageSettings = new PageSettings()
            {
                PageBackground  = new SolidColorBrush(Colors.Transparent),
                PageBorderBrush = new SolidColorBrush(Colors.Transparent),
            };

            SnapSettings = new SnapSettings()
            {
                SnapToObject    = SnapToObject.All,
                SnapConstraints = SnapConstraints.All,
            };

            Theme = new OfficeTheme();

            #endregion
        }
        public DiagramVM()
        {
            ZoomIn           = new Command(OnZoomIn);
            ZoomOut          = new Command(OnZoomOut);
            ZoomTo           = new Command(OnZoomTo);
            VerticalScroll   = new Command(OnVerticalScroll);
            HorizontalScroll = new Command(OnHorizontalScroll);
            Pan   = new Command(OnPan);
            Reset = new Command(OnReset);

            Nodes = new NodeCollection();
            Theme = new OfficeTheme();

            NodeViewModel node1 = new NodeViewModel()
            {
                OffsetX    = 300,
                OffsetY    = 100,
                UnitHeight = 40,
                UnitWidth  = 80,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node2 = new NodeViewModel()
            {
                OffsetX    = 400,
                OffsetY    = 100,
                UnitHeight = 40,
                UnitWidth  = 80,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node3 = new NodeViewModel()
            {
                OffsetX    = 350,
                OffsetY    = 200,
                UnitHeight = 40,
                UnitWidth  = 80,
                Shape      = App.Current.Resources["Rectangle"],
            };

            (Nodes as NodeCollection).Add(node1);
            (Nodes as NodeCollection).Add(node2);
            (Nodes as NodeCollection).Add(node3);
        }
Exemple #11
0
        public GroupingViewModel()
        {
            // Apply new theme, Snapsettings, Ruler  for Diagram.
            Theme = new OfficeTheme();

            HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };

            VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };

            NodeViewModel Node1 = CreateNode(600, 150, "Rectangle", "");
            NodeViewModel Node2 = CreateNode(800, 150, "RoundedRectangle", "");
            NodeViewModel Node3 = CreateNode(600, 300, "Ellipse", "Start/Stop");
            NodeViewModel Node4 = CreateNode(800, 300, "PredefinedProcess", "Decision");
            NodeViewModel Node5 = CreateNode(600, 450, "Rectangle", "Process");

            CreateGroup(Node1, Node2);
        }
        public CustomDiagramViewModel()
        {
            Symbolfilters = new SymbolFilters();

            SymbolFilterProvider basicshapes = new SymbolFilterProvider {
                Content = "Basic Shapes", SymbolFilter = Filter
            };
            SymbolFilterProvider flowshapes = new SymbolFilterProvider {
                Content = "Flow Shapes", SymbolFilter = Filter
            };
            SymbolFilterProvider dataflowshapes = new SymbolFilterProvider {
                Content = "DataFlow Shapes", SymbolFilter = Filter
            };
            SymbolFilterProvider arrowshapes = new SymbolFilterProvider {
                Content = "Arrow Shapes", SymbolFilter = Filter
            };

            Theme = new OfficeTheme();
            this.Symbolfilters.Add(basicshapes);
            this.Symbolfilters.Add(flowshapes);
            this.symbolfilters.Add(dataflowshapes);
            this.Symbolfilters.Add(arrowshapes);
            this.Selectedfilter = Symbolfilters[0];
        }
Exemple #13
0
        public OrganizationChartDiagramVM(string file, bool isValidXml) : base(file, isValidXml)
        {
            Theme = new OfficeTheme();
            this.DefaultConnectorType = ConnectorType.Orthogonal;
            DiagramType               = DiagramType.OrganizationChart;
            this.Constraints         |= GraphConstraints.Undoable;
            this.Connectors           = new ConnectorVMCollection();
            this.Nodes                = new NodeVMCollection();
            this.GetLayoutInfoCommand = new DelegateCommand <object>(OnGetLayoutInfoChanged);
            this.Orgchartcommand      = new DelegateCommand <object>(OrgchartcommandExecute);
            this.IncreaseSpacing      = new DelegateCommand <object>(IncreaseSpacingExecute);
            this.DecreaseSpacing      = new DelegateCommand <object>(DecreaseSpacingExecute);
            this.ExpandCollapse       = new DelegateCommand <object>(ExpandCollapseExecute);
            this.InsertPicture        = new DelegateCommand <object>(InsertPictureExecute);
            this.DeletePicture        = new DelegateCommand <object>(DeletePictureExecute);
            this.ShowhidePicture      = new DelegateCommand <object>(ShowhidePictureExecute);
            this.QuickShape           = new DelegateCommand <object>(OnQuickShapeExecute);

            if (file == null)
            {
                AddRootNode();
            }
            this.LayoutManager = new LayoutManager()
            {
                Layout = new OrganizationChartLayout()
                {
                    Type              = LayoutType.Organization,
                    Orientation       = TreeOrientation.TopToBottom,
                    HorizontalSpacing = 50,
                    VerticalSpacing   = 50,
                }
            };

            this.DataSourceSettings = new DataSourceSettings()
            {
                DataSource = OrgNodeCollection,
                Id         = "ID",
                ParentId   = "ParentID",
            };
            this.ItemSelectedCommand = new DelegateCommand <object>(ItemSelectedCommandExecute);
            this.HorizontalRuler     = new Ruler()
            {
                Orientation     = Orientation.Horizontal,
                BorderBrush     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D4D4D4")),
                BorderThickness = new Thickness(0, 0, 0, 1)
            };
            this.VerticalRuler = new Ruler()
            {
                Orientation     = Orientation.Vertical,
                BorderBrush     = (SolidColorBrush)(new BrushConverter().ConvertFrom("#D4D4D4")),
                BorderThickness = new Thickness(0, 0, 1, 0)
            };
            if (this.SelectedItems is ISelectorVM)
            {
                (this.SelectedItems as ISelectorVM).SelectorConstraints |= SelectorConstraints.Resizer;
            }

            CommandManager          = new Syncfusion.UI.Xaml.Diagram.CommandManager();
            CommandManager.Commands = new CommandCollection();
            PageSettings            = new PageVM();
            (PageSettings as PageVM).InitDiagram(this);
        }
Exemple #14
0
        // Constructor
        public DiagramVM()
        {
            //Adding ItemAddedCommand, DropCommand, SelectorChangedCommand, SelectorChangedCommand
            ItemAddedCommand       = new DelegateCommand(OnItemAddedCommand);
            DropCommand            = new DelegateCommand(OnDropCommand);
            SelectorChangedCommand = new DelegateCommand(OnSelectorChangedCommand);
            ItemDeletingCommand    = new DelegateCommand(OnItemDeletingCommand);
            //Removing quick commands, rotators from selector.
            this.SelectedItems = new SelectorViewModel()
            {
                SelectorConstraints = SelectorConstraints.Default & ~(SelectorConstraints.QuickCommands | SelectorConstraints.Rotator),
            };

            //Adding vertical and horizontal rulers.
            VerticalRuler = new Syncfusion.UI.Xaml.Diagram.Controls.Ruler()
            {
                Orientation = System.Windows.Controls.Orientation.Vertical,
            };

            HorizontalRuler = new Syncfusion.UI.Xaml.Diagram.Controls.Ruler()
            {
                Orientation = System.Windows.Controls.Orientation.Vertical,
            };

            //Adding gridlines to diagram.
            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
            };

            //Defining default connector type as line.
            DefaultConnectorType = ConnectorType.Line;

            //Initialize nodes, groups and connectors collection
            Nodes      = new NodeCollection();
            Connectors = new ConnectorCollection();
            Groups     = new GroupCollection();

            //Adding Office Theme to the diagram
            DiagramTheme theme = new OfficeTheme();

            this.Theme = theme;

            //Creating car nodes and adding nodes into nodes collection.
            NodeViewModel car = CreateNodes(150, 40, 500, 200, "Car");

            (this.Nodes as NodeCollection).Add(car);

            NodeViewModel carInfo = CreateNodes(150, 20, 500, 230, "Car Info");

            (this.Nodes as NodeCollection).Add(carInfo);

            NodeViewModel carDetails = CreateNodes(150, 20, 500, 250, "Car Details");

            (this.Nodes as NodeCollection).Add(carDetails);

            //Creating group for Car related nodes and adding group to GroupsCollection.
            GroupViewModel CarGroup = new GroupViewModel()
            {
                Nodes = new NodeCollection()
                {
                    car,
                    carInfo,
                    carDetails,
                },
            };

            (this.Groups as GroupCollection).Add(CarGroup);

            //Creating body parts nodes and adding nodes into nodes collection.
            NodeViewModel BodyParts = CreateNodes(150, 40, 300, 500, "Body Parts");

            (this.Nodes as NodeCollection).Add(BodyParts);

            NodeViewModel BodyPartsInfo = CreateNodes(150, 20, 300, 530, "Body Parts Info");

            (this.Nodes as NodeCollection).Add(BodyPartsInfo);

            //Creating group for body parts related nodes and adding group to GroupsCollection.
            GroupViewModel BodyPartsGroup = new GroupViewModel()
            {
                Nodes = new NodeCollection()
                {
                    BodyParts,
                    BodyPartsInfo,
                },
            };

            (this.Groups as GroupCollection).Add(BodyPartsGroup);

            //Creating nodes for other parts related nodes and adding nodes to NodesCollection.
            NodeViewModel OtherParts = CreateNodes(150, 40, 500, 500, "Other Parts");

            (this.Nodes as NodeCollection).Add(OtherParts);

            NodeViewModel OtherPartsInfo = CreateNodes(150, 20, 500, 530, "Others Parts Info");

            (this.Nodes as NodeCollection).Add(OtherPartsInfo);

            //Creating group for other parts related nodes and adding nodes to GroupsCollection.
            GroupViewModel OtherPartsGroup = new GroupViewModel()
            {
                Nodes = new NodeCollection()
                {
                    OtherParts,
                    OtherPartsInfo,
                },
            };

            (this.Groups as GroupCollection).Add(OtherPartsGroup);

            //Creating nodes for engine parts related nodes and adding nodes to NodesCollection.
            NodeViewModel Engine = CreateNodes(150, 40, 700, 500, "Engine Parts");

            (this.Nodes as NodeCollection).Add(Engine);

            NodeViewModel EngineInfo = CreateNodes(150, 20, 700, 530, "Engine Parts Info");

            (this.Nodes as NodeCollection).Add(EngineInfo);

            GroupViewModel EngineGroup = new GroupViewModel()
            {
                Nodes = new NodeCollection()
                {
                    Engine,
                    EngineInfo,
                },
            };

            (this.Groups as GroupCollection).Add(EngineGroup);

            //Creating connectors.
            ConnectorViewModel CarToBodyParts  = CreateConnector(BodyPartsGroup, CarGroup);
            ConnectorViewModel CarToOtherParts = CreateConnector(OtherPartsGroup, CarGroup);
            ConnectorViewModel CarToEngine     = CreateConnector(EngineGroup, CarGroup);

            //Adding connector to the collection.
            (this.Connectors as ConnectorCollection).Add(CarToBodyParts);
            (this.Connectors as ConnectorCollection).Add(CarToOtherParts);
            (this.Connectors as ConnectorCollection).Add(CarToEngine);
        }
Exemple #15
0
        public DiagramVM()
        {
            CanZoomIn           = new Command(OnCanZoomIn);
            FitToWidth          = new Command(OnFitToWidth);
            FitToHeight         = new Command(OnFitToHeight);
            FitToPage           = new Command(OnFitToPage);
            PageSettingsCommand = new Command(OnPageSettings);
            Content             = new Command(OnContentCommand);
            CustomRegion        = new Command(OnCustomRegion);

            Nodes                       = new NodeCollection();
            Theme                       = new OfficeTheme();
            PageSettings                = new PageSettings();
            PageSettings.PageHeight     = 1000;
            PageSettings.PageWidth      = 800;
            PageSettings.MultiplePage   = true;
            PageSettings.ShowPageBreaks = true;


            NodeViewModel node1 = new NodeViewModel()
            {
                OffsetX    = 300,
                OffsetY    = 100,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node2 = new NodeViewModel()
            {
                OffsetX    = 700,
                OffsetY    = 900,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node3 = new NodeViewModel()
            {
                OffsetX    = 1500,
                OffsetY    = 200,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node4 = new NodeViewModel()
            {
                OffsetX    = 500,
                OffsetY    = 300,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node5 = new NodeViewModel()
            {
                OffsetX    = 900,
                OffsetY    = 400,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            NodeViewModel node6 = new NodeViewModel()
            {
                OffsetX    = 400,
                OffsetY    = 500,
                UnitHeight = 100,
                UnitWidth  = 100,
                Shape      = App.Current.Resources["Rectangle"],
            };

            (Nodes as NodeCollection).Add(node1);
            (Nodes as NodeCollection).Add(node2);
            (Nodes as NodeCollection).Add(node3);
            (Nodes as NodeCollection).Add(node4);
            (Nodes as NodeCollection).Add(node5);
            (Nodes as NodeCollection).Add(node6);
        }
Exemple #16
0
        //StorageFile file,
        public DiagramVM(string file, bool isValidXml)
        {
            _isValidXml    = isValidXml;
            _file          = file;
            Title          = "Page";
            DiagramType    = DiagramType.Blank;
            Nodes          = new ObservableCollection <NodeVM>();
            Connectors     = new ObservableCollection <ConnectorVM>();
            Groups         = new ObservableCollection <GroupVM>();
            SelectedItems  = new SelectorVM(this);
            PortVisibility = PortVisibility.MouseOverOnConnect;
            Select         = new Command(param => IsSelected = true);
            FirstLoad      = new Command(OnViewLoaded);
            HistoryManager = new customManager();
            SnapSettings   = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All
            };
            Theme           = new OfficeTheme();
            PreviewSettings = new PreviewSettings()
            {
                PreviewMode = PreviewMode.Preview
            };

            PageSettings = new PageVM();

            (PageSettings as PageVM).InitDiagram(this);

            this.HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            this.VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0xEC, G = 0xEC, B = 0xEC });
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0x2D, G = 0x2D, B = 0x2D });
            InitLocation();
            PrintingService = new PrintingService();
            ExportSettings  = new ExportSettings()
            {
                ImageStretch = Stretch.Uniform,
                ExportMode   = ExportMode.PageSettings
            };
#if SyncfusionFramework4_5_1
            ExportSettings = new ExportSettings()
            {
                ImageStretch = Stretch.Uniform,
                ExportMode   = ExportMode.PageSettings
            };
            PrintingService = new PrintingService();
#endif
            FlipCommand            = new Command(OnFlipCommand);
            ExportCommand          = new Command(OnExportCommand);
            PrintCommand           = new Command(OnPrintCommand);
            Captures               = new Command(OnCapturesCommand);
            ClearDiagram           = new Command(OnClearCommand);
            Upload                 = new Command(Onuploadcommand);
            Draw                   = new Command(OnDrawCommand);
            SingleSelect           = new Command(OnSingleSelectCommand);
            SelectAll              = new Command(OnSelectAllCommand);
            Manipulate             = new Command(OnManipulateCommand);
            LoadExt                = new Command(OnLoadExt);
            AddImageNode           = new Command(OnAddImageNodeCommand);
            PageOrientationCommand = new Command(OnPageOrientationCommand);
            PageSizeCommand        = new Command(OnPageSizeCommand);
            ConnectTypeCommand     = new Command(OnConnectTypeCommand);
            RotateTextCommand      = new Command(OnRotateTextCommand);
            //SelectTextCommand = new Command(OnSelectTextCommand);
            SizeandPositionCommand = new Command(OnSizeandPositionCommand);
            PanZoomCommand         = new Command(OnPanZoomCommand);
            FitToWidthCommand      = new Command(OnFitToWidthCommand);
            FitToPageCommand       = new Command(OnFitToPageCommand);
            this.Constraints      |= GraphConstraints.Undoable;

            //Tool = Tool.ZoomPan | Tool.SingleSelect;
            ;

            //ConnectorVM c = new ConnectorVM()
            //{
            //    SourcePoint = new Point(100, 100),
            //    TargetPoint = new Point(300, 300)
            //};

            //(this.ConnectorCollection as ICollection<ConnectorVM>).Add(c);
        }
Exemple #17
0
 public ExcelAddInPane(OfficeTheme officeTheme) : this()
 {
     AdjustColorsForColorTheme(officeTheme);
 }