void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl_GanttChart = ((DashBoard.UserControl_MyGanttChart)(target));
                return;

            case 2:
                this.ProjectsComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 21 "..\..\..\UserControl\UserControl_GanttChart.xaml"
                this.ProjectsComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ProjectsComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.TimeViewComboBox = ((System.Windows.Controls.ComboBox)(target));

            #line 31 "..\..\..\UserControl\UserControl_GanttChart.xaml"
                this.TimeViewComboBox.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TimeViewComboBox_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.GanttHost = ((System.Windows.Forms.Integration.WindowsFormsHost)(target));
                return;
            }
            this._contentLoaded = true;
        }
Beispiel #2
0
        private void AddUserControlWidgets()
        {
            WidgetsViewModel = new DashboardWidgets(EmployeeID);
            foreach (var item in WidgetsViewModel.Items)
            {
                var newControl = new UserControl();

                if (item.WidgetName.Contains("DateBlock"))
                {
                    newControl = new UserControl_DateBlock();
                }
                else if (item.WidgetName.Contains("BurnDownChart"))
                {
                    newControl = new UserControl_BurnDownChart();
                }
                else if (item.WidgetName.Contains("CriticalPathChart"))
                {
                    newControl = new UserControl_CriticalPathChart();
                }
                else if (item.WidgetName.Contains("GanttChart"))
                {
                    newControl = new UserControl_MyGanttChart();
                }

                newControl.Width  = item.WidgetWidth;
                newControl.Height = item.WidgetHeight;
                this.MainCanvas.Children.Add(newControl);

                Canvas.SetLeft(newControl, item.CanvasLeft);
                Canvas.SetTop(newControl, item.CanvasTop);
                newControl.ContextMenu = SettingMenu;
            }
            foreach (var item in MainCanvas.Children)
            {
                Control control = item as Control;
                if (control == null)
                {
                    continue;
                }
                control.ContextMenu = SettingMenu;
            }
        }
Beispiel #3
0
        private void MainCanvas_Drop(object sender, DragEventArgs e)
        {
            Mouse.Capture(this.MainCanvas);
            Widget widget = e.Data.GetData("myWidget") as Widget;

            if (widget != null)
            {
                var newControl = new UserControl();

                if (widget.WidgetName.Contains("DateBlock"))
                {
                    newControl = new UserControl_DateBlock();
                }
                else if (widget.WidgetName.Contains("BurnDownChart"))
                {
                    newControl = new UserControl_BurnDownChart();
                }
                else if (widget.WidgetName.Contains("CriticalPathChart"))
                {
                    newControl = new UserControl_CriticalPathChart();
                }
                else if (widget.WidgetName.Contains("GanttChart"))
                {
                    newControl = new UserControl_MyGanttChart();
                }
                this.MainCanvas.Children.Add(newControl);
                int column = (int)(((Mouse.GetPosition(this.MainCanvas)).X - 20) / 110);
                int row    = (int)(((Mouse.GetPosition(this.MainCanvas)).Y - 20) / 110);
                Canvas.SetLeft(newControl, column * 110 + 20);
                Canvas.SetTop(newControl, row * 110 + 20);
                newControl.PreviewMouseLeftButtonDown += this.MouseLeftButtonDown;
                newControl.PreviewMouseLeftButtonUp   += this.PreviewMouseLeftButtonUp;
                newControl.Cursor      = Cursors.Hand;
                newControl.ContextMenu = SettingMenu;
            }
            Mouse.Capture(null);
        }