public FrmRealTimeInMineEmp(DockPanel dpnl)
        {
            InitializeComponent();
            try
            {
                cmbSelectCounts.SelectedIndex = 0;
                
                base.Text = "实时人员下井名单";
                base.btnAdd.Hide();
                base.btnLaws.Hide();
                base.btnDelete.Hide();
                base.btnSelectAll.Hide();
                base.btnPrint.Hide();
                base.lblMainTitle.Hide();
                this.DockPnl = dpnl;
                //treeView1.Controls.Add(EmpPL);
                EmpPL.Hide();
                listView1.Columns.Add("姓名");
                listView1.Columns.Add("部门");
                listView1.Columns.Add("职务");
                listView1.Columns.Add("入井时间").AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);


                timer1.Interval = KJ128NInterfaceShow.RefReshTime._rtTime;
                //timer2.Interval = KJ128NInterfaceShow.RefReshTime._rtTime;
                LoadDeptTree();
                loaddutytree();
                LoadStnTree();
            }
            catch (Exception ex)
            { }
            //loadimagelist();

        }
Exemple #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dockPanel">Parent dock panel</param>
 public GridLayout(DockPanel dockPanel)
 {
     Root = dockPanel;
     //Background = Root.Background;
     SetZIndex(this, 0);
     m_children = new List<IDockLayout>();
 }
Exemple #3
0
        /// <summary>
        /// Constructor used when window is created as consequence to user interaction.
        /// </summary>
        /// <param name="root">Parent dock panel</param>
        /// <param name="content">Content to host</param>
        /// <param name="origin">Origin, position on screen</param>
        /// <param name="size">Size of window</param>
        public FloatingWindow(DockPanel root, IDockContent content, Point origin, Size size)
            : this(root)
        {
            Left = origin.X;
            Top = origin.Y;
            Width = size.Width;
            Height = size.Height;
            if (content is TabLayout)
            {
                DockedContent = (TabLayout)content;
            }
            else
            {
                DockedContent = new TabLayout(Root);
                DockedContent.Dock(null, content, DockTo.Center);
            }
            foreach (DockContent subContent in DockedContent.Children)
            {
                subContent.Settings.DockState = DockState.Floating;				
            }
            Content = DockedContent;

            Binding b = new Binding("Header");
            b.Source = DockedContent;
            SetBinding(Window.TitleProperty, b);
        }
 public VS2010AutoHideStrip(DockPanel panel)
     : base(panel)
 {
     SetStyle(ControlStyles.ResizeRedraw |
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.OptimizedDoubleBuffer, true);
     BackColor = DockPanel.Theme.ColorPalette.MainWindowActive.Background;
 }
Exemple #5
0
        public LayoutManager(IDPickerForm mainForm, DockPanel dockPanel, IList<IPersistentForm> persistentForms)
        {
            this.mainForm = mainForm;
            _persistentForms = persistentForms;
            this.dockPanel = dockPanel;

            refreshUserLayoutList();

            tryResetUserLayoutSettings();
        }
 public PeptideAnalysisFrame(PeptideAnalysis peptideAnalysis)
     : base(peptideAnalysis)
 {
     InitializeComponent();
     _dockPanel = new DockPanel
                      {
                          Dock = DockStyle.Fill
                      };
     panel1.Controls.Add(_dockPanel);
 }
Exemple #7
0
		public static void SetSchema( DockPanel dockPanel, Extender.Schema schema ) {
			if( schema == Extender.Schema.VS2005 ) {
				dockPanel.Extender.AutoHideStripFactory = null;
				dockPanel.Extender.DockPaneCaptionFactory = null;
				dockPanel.Extender.DockPaneStripFactory = null;
			} else if( schema == Extender.Schema.VS2003 ) {
				dockPanel.Extender.DockPaneCaptionFactory = new VS2003DockPaneCaptionFactory();
				dockPanel.Extender.AutoHideStripFactory = new VS2003AutoHideStripFactory();
				dockPanel.Extender.DockPaneStripFactory = new VS2003DockPaneStripFactory();
			}
		}
        public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
        {
            for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
            {
                var floatWindow = control as FloatWindow;
                if (floatWindow != null && floatWindow.DockPanel == dockPanel)
                    return floatWindow;
            }

            return null;
        }
        public static FoldChangeGrid ShowFoldChangeGrid(DockPanel dockPanel, Rectangle rcFloating, IDocumentContainer documentContainer,
            string groupComparisonName)
        {
            var grid = FindForm<FoldChangeGrid>(documentContainer, groupComparisonName);
            if (grid != null)
            {
                grid.Activate();
                return grid;
            }

            grid = new FoldChangeGrid();
            grid.SetBindingSource(FindOrCreateBindingSource(documentContainer, groupComparisonName));
            grid.Show(dockPanel, rcFloating);
            return grid;
        }
        public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
        {
            for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
            {
                var content = control as IDockContent;
                if (content != null && content.DockHandler.DockPanel == dockPanel)
                    return content.DockHandler.Pane;

                var pane = control as DockPane;
                if (pane != null && pane.DockPanel == dockPanel)
                    return pane;
            }

            return null;
        }
 public FrmRealInWell(DockPanel dock)
 {
     InitializeComponent();
     dockPanel = dock;
     timer.Interval = KJ128NInterfaceShow.RefReshTime._rtTime;
     timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
     timer.Start();
     this.cmbSelectCounts.Items.Add("全部");
     timerIntervalBll.BindComBoxAddAll(cmbClass);
     cmbSelectCounts.SelectedIndex = 0;
     m_PSize = 40;
     
     BindDeptTree();
     BindData(1);
 }
Exemple #12
0
 private FloatingWindow(DockPanel dockPanel)
 {
     Root = dockPanel;
     ShowInTaskbar = false;
     WindowStyle = WindowStyle.ToolWindow;
     WindowStartupLocation = WindowStartupLocation.Manual;
     m_dockOver = new List<IDockable>();
     Loaded += new RoutedEventHandler(FloatingWindow_Loaded);
     Closing += new System.ComponentModel.CancelEventHandler(FloatingWindow_Closing);
     MouseMove += new MouseEventHandler(FloatingWindow_MouseMove);
     MouseUp += new MouseButtonEventHandler(FloatingWindow_MouseUp);
     MouseLeave += new MouseEventHandler(FloatingWindow_MouseLeave);
     Activated += new EventHandler(FloatingWindow_Activated);
     LocationChanged += new EventHandler(FloatingWindow_LocationChanged);
     SizeChanged += new SizeChangedEventHandler(FloatingWindow_SizeChanged);
 }
Exemple #13
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dockPanel">Root dock panel</param>
 public TabLayout(DockPanel dockPanel)
 {
     Root = dockPanel;
     Header = String.Empty;
     Children = new ObservableCollection<DockContent>();
     ItemsCount = 0;
     SizeChanged += new SizeChangedEventHandler(TabLayout_SizeChanged);
     //PreviewMouseDown += TabControl_PreviewMouseDown;
     MouseMove += TabControl_MouseMove;
     MouseUp += TabControl_MouseUp;
     MouseLeave += TabControl_MouseLeave;
     ItemsSource = Children;
     m_timer = new System.Timers.Timer();
     m_timer.AutoReset = false;
     m_timer.Interval = 500;
     m_timer.Elapsed += new System.Timers.ElapsedEventHandler(Timer_Elapsed);
 }
Exemple #14
0
        public void DockToMainForm(DockManager dockManager)
        {
            SetRootPanelsVisibility(DockVisibility.Hidden);

            m_mainDockManager = dockManager;
            m_settings = m_mainDockManager.AddPanel(DockingStyle.Float);
            m_settings.ControlContainer.Controls.Add(ucSetting);
            m_settings.DockTo(DockingStyle.Left, 0);
            m_timeline = m_mainDockManager.AddPanel(DockingStyle.Float);
            m_timeline.ControlContainer.Controls.Add(ucTimeLine);
            DockPanel bottomPanel = GetPanelByDockingStyle(m_mainDockManager, DockingStyle.Bottom);
            if (bottomPanel != null)
                m_timeline.DockAsTab(bottomPanel, 0);
            else
                m_timeline.DockTo(DockingStyle.Bottom);
            m_channel = m_mainDockManager.AddPanel(DockingStyle.Float);
            m_channel.ControlContainer.Controls.Add(ucChannel);
            m_channel.DockAsTab(m_timeline, 1);
        }
        public A_FrmRTTerritorial(DockPanel dock)
        {
            InitializeComponent();
            dockPanel = dock;
            this.timer_Alarm.Interval = RefReshTime._rtTime;

            //区域
            dmc_Info.Add(pl_RTTerritorial, true);

            //限制区域
            dmc_Info.Add(pl_ConfineArea);

            //重点区域
            dmc_Info.Add(pl_KeyArea);

            //地域
            dmc_Info.Add(pl_DistrictArea);

            dmc_Info.LeftPartResize();
        }
        public MainWindow()
        {
            InitializeComponent();

            gridSizeX = 500;
            gridSizeY = 500;

            for (int i = 0; i < gridSizeX; i++) caGrid.ColumnDefinitions.Add(new ColumnDefinition());
            for (int i = 0; i < gridSizeY; i++) caGrid.RowDefinitions.Add(new RowDefinition());

            cells = new Panel[gridSizeX, gridSizeY];
            for (int i = 0; i < gridSizeX; i++) {
                for (int j = 0; j < gridSizeY; j++) {
                    cells[i,j] = new DockPanel();
                    cells[i,j].Background = Brushes.White;
                    Grid.SetColumn(cells[i,j], i);
                    Grid.SetRow(cells[i,j], j);
                    caGrid.Children.Add(cells[i,j]);
                }
            }
        }
Exemple #17
0
        private FloatingWindow(DockPanel dockPanel)
        {
            Root = dockPanel;
            ShowInTaskbar = false;
            WindowStyle = WindowStyle.ToolWindow;
            WindowStartupLocation = WindowStartupLocation.Manual;
            m_dockOver = new List<IDockable>();
            Loaded += FloatingWindow_Loaded;
            Closing += FloatingWindow_Closing;
            MouseMove += FloatingWindow_MouseMove;
            MouseUp += FloatingWindow_MouseUp;
            MouseLeave += FloatingWindow_MouseLeave;
            Activated += FloatingWindow_Activated;
            LocationChanged += FloatingWindow_LocationChanged;
            SizeChanged += FloatingWindow_SizeChanged;

            // Allow floating windows to handle shortcut keys
            var window = Application.Current.MainWindow;
            if ((window != null) && (window.InputBindings != null))
            {
                InputBindings.AddRange(window.InputBindings);
            }
        }
Exemple #18
0
        public void DockToMainForm(DockManager dockManager)
        {
            m_dockManager = dockManager;

            SceneExplorer sceneExplorer = new SceneExplorer();
            sceneExplorer.Dock = DockStyle.Fill;

            ObjectProperty objProperty = new ObjectProperty();
            objProperty.Dock = DockStyle.Fill;

            m_plExplorer = dockManager.AddPanel(DockingStyle.Float);
            m_plExplorer.Text = "Scene Explorer";
            m_plExplorer.ControlContainer.Controls.Add(sceneExplorer);
            m_plExplorer.Size = new Size(230, 400);
            m_plExplorer.ImageIndex = 14;
            m_plExplorer.DockTo(DockingStyle.Left, 0);

            m_plProperty = dockManager.AddPanel(DockingStyle.Float);
            m_plProperty.Text = "Object Property";
            m_plProperty.ControlContainer.Controls.Add(objProperty);
            m_plProperty.Size = new Size(260, 400);
            m_plProperty.ImageIndex = 0;
            m_plProperty.DockTo(DockingStyle.Right, 0);
        }
Exemple #19
0
        public void Should_Dock_Controls_Vertical_First()
        {
            var target = new DockPanel
            {
                Children = new Controls
                {
                    new Border { Width = 50, Height = 400, [DockPanel.DockProperty] = Dock.Left },
                    new Border { Width = 50, Height = 400, [DockPanel.DockProperty] = Dock.Right },
                    new Border { Width = 500, Height = 50, [DockPanel.DockProperty] = Dock.Top },
                    new Border { Width = 500, Height = 50, [DockPanel.DockProperty] = Dock.Bottom },
                    new Border { },
                }
            };

            target.Measure(Size.Infinity);
            target.Arrange(new Rect(target.DesiredSize));

            Assert.Equal(new Rect(0, 0, 600, 400), target.Bounds);
            Assert.Equal(new Rect(0, 0, 50, 400), target.Children[0].Bounds);
            Assert.Equal(new Rect(550, 0, 50, 400), target.Children[1].Bounds);
            Assert.Equal(new Rect(50, 0, 500, 50), target.Children[2].Bounds);
            Assert.Equal(new Rect(50, 350, 500, 50), target.Children[3].Bounds);
            Assert.Equal(new Rect(50, 50, 500, 300), target.Children[4].Bounds);
        }
Exemple #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VS2012DockWindow"/> class.
 /// </summary>
 /// <param name="dockPanel">The dock panel.</param>
 /// <param name="dockState">State of the dock.</param>
 public VS2012DockWindow(DockPanel dockPanel, DockState dockState) : base(dockPanel, dockState)
 {
 }
Exemple #21
0
            void AddNaviBar(object sender, RoutedEventArgs e)
            {
                _View.VisualElement.Loaded -= AddNaviBar;

                var     view = sender as IWpfTextView ?? _View;
                NaviBar naviBar;

                if ((naviBar = view.VisualElement?.GetParent <Grid>().GetFirstVisualChild <NaviBar>()) != null)
                {
                    naviBar.BindView(view);
                    return;
                }
                var naviBarHolder = view.VisualElement
                                    ?.GetParent <Border>(b => b.Name == "PART_ContentPanel")
                                    ?.GetFirstVisualChild <Border>(b => b.Name == "DropDownBarMargin");

                if (naviBarHolder == null)
                {
                    var viewHost = view.VisualElement.GetParent <Panel>(b => b.GetType().Name == "WpfMultiViewHost");
                    if (viewHost != null)
                    {
                        var b = new MarkdownBar(_View, _TextSearch);
                        DockPanel.SetDock(b, Dock.Top);
                        if (viewHost.Children.Count == 1)
                        {
                            viewHost.Children.Insert(0, b);
                        }
                        else
                        {
                            var c = viewHost.Children[0] as ContentControl;
                            if (c != null && c.Content == null)
                            {
                                c.Content = b;
                            }
                        }
                    }
                    return;
                }
                var dropDown1 = naviBarHolder.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown1");
                var dropDown2 = naviBarHolder.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown2");

                if (dropDown1 == null || dropDown2 == null)
                {
                    return;
                }
                var container = dropDown1.GetParent <Grid>();

                if (container == null)
                {
                    return;
                }
                var bar = new CSharpBar(_View)
                {
                    MinWidth = 200
                };

                bar.SetCurrentValue(Grid.ColumnProperty, 2);
                bar.SetCurrentValue(Grid.ColumnSpanProperty, 3);
                container.Children.Add(bar);
                dropDown1.Visibility    = Visibility.Hidden;
                dropDown2.Visibility    = Visibility.Hidden;
                naviBarHolder.Unloaded += ResurrectNaviBar_OnUnloaded;
            }
        private void AddTab(string tabHeading = null, DockPanel mainContent = null)
        {
            try
            {
                Random rnd      = new Random();
                int    rndvalue = rnd.Next(1000, 9000);



                /////////////////// START : TAB HEADER ///////////////////
                Label lblHeaderLabel = new Label();


                lblHeaderLabel.Content = (tabHeading == null) ? string.Format("Tab {0}", rndvalue) : tabHeading;
                lblHeaderLabel.Name    = string.Format("lblTab{0}", rndvalue);
                lblHeaderLabel.Style   = Resources["styleLblTabHeader"] as Style;

                Label lblHeaderTabClose = new Label();
                lblHeaderTabClose.Content  = " x ";
                lblHeaderTabClose.Name     = string.Format("btnTab{0}", rndvalue);
                lblHeaderTabClose.Style    = Resources["styleBtnTabHeader"] as Style;
                lblHeaderTabClose.MouseUp += tabHeader_BubbledClickEvent;
                lblHeaderTabClose.Tag      = string.Format("tab{0}", rndvalue); // will help to close the corresponding tab


                StackPanel headerStackPanel = new StackPanel();
                headerStackPanel.Orientation = Orientation.Horizontal;
                headerStackPanel.Children.Add(lblHeaderLabel);
                headerStackPanel.Children.Add(lblHeaderTabClose);
                headerStackPanel.Name     = string.Format("spHeadTab{0}", rndvalue);
                headerStackPanel.MouseUp += tabHeader_BubbledClickEvent;

                /////////////////// END : TAB HEADER ///////////////////

                TabItem tab = new TabItem();

                tab.Header              = headerStackPanel;
                tab.Name                = string.Format("tab{0}", rndvalue);
                tab.MouseUp            += tabHeader_BubbledClickEvent;
                tab.Content             = mainContent;
                tab.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                tab.VerticalAlignment   = System.Windows.VerticalAlignment.Stretch;

                tbcPrimary.Items.Add(tab);

                // Select current Tab
                int newIndex = tbcPrimary.Items.Count;
                if (newIndex >= tbcPrimary.Items.Count)
                {
                    --newIndex;
                }
                if (newIndex < 0)
                {
                    newIndex = 0;
                }
                tbcPrimary.SelectedIndex = newIndex;
            }

            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }

            catch (ValidationException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
            catch (ConnectedDalException ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
            catch (Exception ex)
            {
                MessageHandler.ShowErrorMessage(ex.Message);
            }
        }
Exemple #23
0
 // simple helpers to wrap a given control in a DockContent, so it can be docked into a panel.
 static public DockContent WrapDockContent(DockPanel panel, Control c)
 {
     return(WrapDockContent(panel, c, c.Text));
 }
 public FrmWorkSheetEntry(DockPanel _parentdockpanel, BaseForm _owner)
     : base(_parentdockpanel, _owner)
 {
     InitializeComponent();
 }
Exemple #25
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == 161)
     {
         if (!base.IsDisposed)
         {
             uint num = NativeMethods.SendMessage(base.Handle, 132, 0u, (uint)(int)m.LParam);
             if (num == 2 && DockPanel.AllowEndUserDocking && AllowEndUserDocking)
             {
                 Activate();
                 m_dockPanel.BeginDrag(this);
             }
             else
             {
                 base.WndProc(ref m);
             }
         }
     }
     else if (m.Msg == 164)
     {
         uint num = NativeMethods.SendMessage(base.Handle, 132, 0u, (uint)(int)m.LParam);
         if (num == 2)
         {
             DockPane dockPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
             if (dockPane != null && dockPane.ActiveContent != null)
             {
                 dockPane.ShowTabPageContextMenu(this, PointToClient(Control.MousePosition));
                 return;
             }
         }
         base.WndProc(ref m);
     }
     else if (m.Msg == 16)
     {
         if (NestedPanes.Count == 0)
         {
             base.WndProc(ref m);
         }
         else
         {
             for (int num2 = NestedPanes.Count - 1; num2 >= 0; num2--)
             {
                 DockContentCollection contents = NestedPanes[num2].Contents;
                 for (int num3 = contents.Count - 1; num3 >= 0; num3--)
                 {
                     IDockContent dockContent = contents[num3];
                     if (dockContent.DockHandler.DockState == DockState.Float && dockContent.DockHandler.CloseButton)
                     {
                         if (dockContent.DockHandler.HideOnClose)
                         {
                             dockContent.DockHandler.Hide();
                         }
                         else
                         {
                             dockContent.DockHandler.Close();
                         }
                     }
                 }
             }
         }
     }
     else if (m.Msg == 163)
     {
         uint num = NativeMethods.SendMessage(base.Handle, 132, 0u, (uint)(int)m.LParam);
         if (num != 2)
         {
             base.WndProc(ref m);
         }
         else
         {
             DockPanel.SuspendLayout(allWindows: true);
             foreach (DockPane nestedPane in NestedPanes)
             {
                 if (nestedPane.DockState == DockState.Float)
                 {
                     nestedPane.RestoreToPanel();
                 }
             }
             DockPanel.ResumeLayout(performLayout: true, allWindows: true);
         }
     }
     else if (m.Msg == 1025)
     {
         if (NestedPanes.Count == 0)
         {
             Dispose();
         }
     }
     else
     {
         base.WndProc(ref m);
     }
 }
        public InternalOptionsControl(string featureOptionName, OptionStore optionStore)
            : base(optionStore)
        {
            _featureOptionName = featureOptionName;

            // options
            var optionsPanel = new StackPanel();

            this.AddOptions(optionsPanel);

            // scroll
            var viewer = new ScrollViewer()
            {
                VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            viewer.Content = optionsPanel;

            // search
            var searchBox = new TextBox()
            {
                MinWidth = 200, HorizontalAlignment = HorizontalAlignment.Stretch
            };

            var searchButton = new Button()
            {
                Content = "Search"
            };

            searchButton.Click += (o, a) =>
            {
                foreach (var item in optionsPanel.Children.OfType <CheckBox>())
                {
                    var title = item.Content as string;
                    if (title == null)
                    {
                        continue;
                    }

                    // pattern not match
                    if (title.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) < 0)
                    {
                        // hide it
                        item.Visibility = Visibility.Collapsed;
                    }
                    else
                    {
                        item.Visibility = Visibility.Visible;
                    }
                }
            };

            var clearButton = new Button()
            {
                Content = "Clear"
            };

            clearButton.Click += (o, a) => optionsPanel.Children.OfType <CheckBox>().Do(c => c.Visibility = Visibility.Visible);

            var searchPanel = new StackPanel()
            {
                Orientation         = Orientation.Horizontal,
                Margin              = new Thickness(5),
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            searchPanel.Children.Add(searchBox);
            searchPanel.Children.Add(searchButton);
            searchPanel.Children.Add(clearButton);

            // button
            var checkAllButton = new Button()
            {
                Content = "Check All"
            };

            checkAllButton.Click += (o, a) => optionsPanel.Children.OfType <CheckBox>().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = true);

            var uncheckAllButton = new Button()
            {
                Content = "Uncheck All"
            };

            uncheckAllButton.Click += (o, a) => optionsPanel.Children.OfType <CheckBox>().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = false);

            var selectionPanel = new StackPanel()
            {
                Orientation         = Orientation.Horizontal,
                Margin              = new Thickness(5),
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            selectionPanel.Children.Add(checkAllButton);
            selectionPanel.Children.Add(uncheckAllButton);

            // main panel
            var mainPanel = new DockPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            mainPanel.Children.Add(searchPanel);
            mainPanel.Children.Add(selectionPanel);
            mainPanel.Children.Add(viewer);

            DockPanel.SetDock(searchPanel, Dock.Top);
            DockPanel.SetDock(selectionPanel, Dock.Bottom);

            this.Content = mainPanel;
        }
Exemple #27
0
        public MainWindow()
        {
            Title = "Peruse thr Menu";

            // Create DockPanel.
            DockPanel dock = new DockPanel();

            Content = dock;

            // Create Menu docked at top.
            Menu menu = new Menu();

            dock.Children.Add(menu);
            DockPanel.SetDock(menu, Dock.Top);

            // Create TextBlock filling the rest.
            TextBlock text = new TextBlock();

            text.Text          = Title;
            text.FontSize      = 32;
            text.TextAlignment = TextAlignment.Center;
            dock.Children.Add(text);

            // Create File menu.
            MenuItem itemFile = new MenuItem();

            itemFile.Header = "_File";
            menu.Items.Add(itemFile);

            MenuItem itemNew = new MenuItem();

            itemNew.Header = "_New";
            itemNew.Click += UnimplementedOnClick;
            itemFile.Items.Add(itemNew);

            MenuItem itemOpen = new MenuItem();

            itemOpen.Header = "_Open";
            itemOpen.Click += UnimplementedOnClick;
            itemFile.Items.Add(itemOpen);

            MenuItem itemSave = new MenuItem();

            itemSave.Header = "_Save";
            itemSave.Click += UnimplementedOnClick;
            itemFile.Items.Add(itemSave);

            itemFile.Items.Add(new Separator());

            MenuItem itemExit = new MenuItem();

            itemExit.Header = "E_xit";
            itemExit.Click += ExitOnClick;
            itemFile.Items.Add(itemExit);

            // Create Window menu.
            MenuItem itemWindow = new MenuItem();

            itemWindow.Header = "_Window";
            menu.Items.Add(itemWindow);

            MenuItem itemTaskbar = new MenuItem();

            itemTaskbar.Header      = "_Show in Taskbar";
            itemTaskbar.IsCheckable = true;
            itemTaskbar.IsChecked   = ShowInTaskbar;
            itemTaskbar.Click      += TaskbarOnClick;
            itemWindow.Items.Add(itemTaskbar);

            MenuItem itemSize = new MenuItem();

            itemSize.Header      = "Size to _Content";
            itemSize.IsCheckable = true;
            itemSize.IsChecked   = SizeToContent == SizeToContent.WidthAndHeight;
            itemSize.Checked    += SizeOnCheck;
            itemSize.Unchecked  += SizeOnCheck;
            itemWindow.Items.Add(itemSize);

            MenuItem itemResize = new MenuItem();

            itemResize.Header      = "_Resizable";
            itemResize.IsCheckable = true;
            itemResize.IsChecked   = ResizeMode == ResizeMode.CanResize;
            itemResize.Click      += ResizeOnClick;
            itemWindow.Items.Add(itemResize);

            MenuItem itemTopmost = new MenuItem();

            itemTopmost.Header      = "_Topmost";
            itemTopmost.IsCheckable = true;
            itemTopmost.IsChecked   = Topmost;
            itemTopmost.Checked    += TopmostOnCheck;
            itemTopmost.Unchecked  += TopmostOnCheck;
            itemWindow.Items.Add(itemTopmost);
        }
Exemple #28
0
        private void Init()
        {
            this.Title = "Craft the Toolbar";

            RoutedUICommand[] comms =
            {
                ApplicationCommands.New, ApplicationCommands.Open, ApplicationCommands.Save,  ApplicationCommands.Print,
                ApplicationCommands.Cut, ApplicationCommands.Copy, ApplicationCommands.Paste, ApplicationCommands.Delete
            };

            string[] strImages =
            {
                "new.png", "open.png", "save.png",  "print.png",
                "cut.png", "copy.png", "paste.png", "delete.png"
            };

            DockPanel dock = new DockPanel();

            //dock.LastChildFill = false;   //为ture时,最后一个控件将会填满剩余的空间
            this.Content = dock;

            ToolBar toolbar = new ToolBar();

            toolbar.Header = "工具栏";
            dock.Children.Add(toolbar);
            DockPanel.SetDock(toolbar, Dock.Top);

            RichTextBox txtBox = new RichTextBox();

            dock.Children.Add(txtBox);

            for (int i = 0; i < 8; i++)
            {
                if (i == 4)
                {
                    toolbar.Items.Add(new Separator());
                }

                Button btn = new Button();
                btn.Height  = (btn.Width = 36) * 16.0 / 9.0; // Width : Height = 9 : 16
                btn.Command = comms[i];
                toolbar.Items.Add(btn);

                StackPanel stack = new StackPanel();
                stack.Orientation = Orientation.Vertical;
                btn.Content       = stack;

                Image img = new Image();
                img.Source  = new BitmapImage(new Uri($"pack://application:,,/Images/{strImages[i]}"));
                img.Stretch = Stretch.Uniform;
                stack.Children.Add(img);

                TextBlock txtblk = new TextBlock();
                txtblk.Text = comms[i].Text;
                txtblk.HorizontalAlignment = HorizontalAlignment.Center;
                stack.Children.Add(txtblk);

                ToolTip tip = new ToolTip();
                tip.Content = comms[i].Text;
                btn.ToolTip = tip;

                this.CommandBindings.Add(new CommandBinding(comms[i], ToolBarButtonOnClick));
                //快捷键Ctrl+N,Ctrl+O,Ctrl+S,Ctrl+P,Ctrl+X,Ctrl+C,Ctrl+V,Delete也会触发对应的命令
            }

            txtBox.Focus();
        }
Exemple #29
0
        public FunkyWindow()
        {
            Settings_Funky.LoadFunkyConfiguration();

            Owner         = App.Current.MainWindow;
            Title         = "Funky Settings -- " + Bot.Character.Account.CurrentHeroName;
            SizeToContent = SizeToContent.WidthAndHeight;
            ResizeMode    = ResizeMode.CanMinimize;
            Background    = Brushes.Black;
            Foreground    = Brushes.PaleGoldenrod;
            //this.Width=600;
            //this.Height=600;

            ListBox LBWindowContent = new ListBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            Menu Menu_Settings = new Menu
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };
            MenuItem Menu_Defaults = new MenuItem
            {
                Header   = "Settings",
                Height   = 25,
                FontSize = 12,
            };
            MenuItem Menu_Default_Open = new MenuItem
            {
                Header   = "Open File..",
                Height   = 25,
                FontSize = 12,
            };

            Menu_Default_Open.Click += DefaultMenuLoadProfileClicked;
            Menu_Defaults.Items.Add(Menu_Default_Open);
            MenuItem Menu_Default_Leveling = new MenuItem
            {
                Header   = "Use Default Leveling",
                Height   = 25,
                FontSize = 12,
            };

            Menu_Default_Leveling.Click += DefaultMenuLevelingClicked;
            Menu_Defaults.Items.Add(Menu_Default_Leveling);
            MenuItem Menu_ViewSettingFile = new MenuItem
            {
                Header   = "Open Settings File",
                Height   = 25,
                FontSize = 12,
            };

            Menu_ViewSettingFile.Click += DefaultOpenSettingsFileClicked;
            Menu_Defaults.Items.Add(Menu_ViewSettingFile);

            Menu_Settings.Items.Add(Menu_Defaults);
            LBWindowContent.Items.Add(Menu_Settings);

            TabControl tabControl1 = new TabControl
            {
                Width  = 600,
                Height = 600,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                FontSize = 12,
            };

            LBWindowContent.Items.Add(tabControl1);

            #region Combat
            //Character
            TabItem CombatSettingsTabItem = new TabItem();
            CombatSettingsTabItem.Header = "Combat";

            tabControl1.Items.Add(CombatSettingsTabItem);
            CombatTabControl = new TabControl
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
            };

            InitCombatControls();

            InitClusteringControls();

            InitGroupingControls();

            InitAvoidanceControls();

            InitFleeingControls();

            InitPlayerClassControls();



            CombatSettingsTabItem.Content = CombatTabControl;
            #endregion


            #region Targeting
            TabItem TargetTabItem = new TabItem();
            TargetTabItem.Header = "Targeting";
            tabControl1.Items.Add(TargetTabItem);

            tcTargeting = new TabControl
            {
                Height    = 600,
                Width     = 600,
                Focusable = false,
            };

            InitTargetingGeneralControls();
            InitTargetRangeControls();
            InitLOSMovementControls();

            TargetTabItem.Content = tcTargeting;

            #endregion


            #region General
            tcGeneral = new TabControl
            {
                Width  = 600,
                Height = 600,
            };

            TabItem GeneralSettingsTabItem = new TabItem();
            GeneralSettingsTabItem.Header = "General";
            tabControl1.Items.Add(GeneralSettingsTabItem);

            InitGeneralControls();

            GeneralSettingsTabItem.Content = tcGeneral;
            #endregion


            #region Items


            TabItem CustomSettingsTabItem = new TabItem();
            CustomSettingsTabItem.Header = "Items";
            tabControl1.Items.Add(CustomSettingsTabItem);

            tcItems = new TabControl
            {
                Width  = 600,
                Height = 600
            };

            InitItemRulesControls();
            InitLootPickUpControls();
            InitItemScoringControls();

            CustomSettingsTabItem.Content = tcItems;
            #endregion


            TabItem AdvancedTabItem = new TabItem();
            AdvancedTabItem.Header = "Advanced";
            tabControl1.Items.Add(AdvancedTabItem);
            ListBox lbAdvancedContent = new ListBox();

            #region Debug Logging
            StackPanel SPLoggingOptions    = new StackPanel();
            TextBlock  Logging_Text_Header = new TextBlock
            {
                Text                = "Debug Output Options",
                FontSize            = 12,
                Background          = Brushes.LightSeaGreen,
                TextAlignment       = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };
            SPLoggingOptions.Children.Add(Logging_Text_Header);

            CheckBox CBDebugStatusBar = new CheckBox
            {
                Content   = "Enable Debug Status Bar",
                Width     = 300,
                Height    = 20,
                IsChecked = Bot.Settings.Debug.DebugStatusBar,
            };
            CBDebugStatusBar.Checked   += DebugStatusBarChecked;
            CBDebugStatusBar.Unchecked += DebugStatusBarChecked;
            SPLoggingOptions.Children.Add(CBDebugStatusBar);


            TextBlock Logging_FunkyLogLevels_Header = new TextBlock
            {
                Text                = "Funky Logging Options",
                FontSize            = 12,
                Background          = Brushes.MediumSeaGreen,
                TextAlignment       = TextAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch,
            };

            StackPanel panelFunkyLogFlags = new StackPanel
            {
                Orientation       = Orientation.Vertical,
                VerticalAlignment = VerticalAlignment.Stretch,
            };
            panelFunkyLogFlags.Children.Add(Logging_FunkyLogLevels_Header);

            var LogLevels = Enum.GetValues(typeof(LogLevel));
            Logger.GetLogLevelName fRetrieveNames = s => Enum.GetName(typeof(LogLevel), s);

            CBLogLevels = new CheckBox[LogLevels.Length - 2];
            int  counter = 0;
            bool noFlags = Bot.Settings.Debug.FunkyLogFlags.Equals(LogLevel.None);
            foreach (var logLevel in LogLevels)
            {
                LogLevel thisloglevel = (LogLevel)logLevel;
                if (thisloglevel.Equals(LogLevel.None) || thisloglevel.Equals(LogLevel.All))
                {
                    continue;
                }

                string loglevelName = fRetrieveNames(logLevel);
                CBLogLevels[counter] = new CheckBox
                {
                    Name      = loglevelName,
                    Content   = loglevelName,
                    IsChecked = !noFlags?Bot.Settings.Debug.FunkyLogFlags.HasFlag(thisloglevel) : false,
                };
                CBLogLevels[counter].Checked   += FunkyLogLevelChanged;
                CBLogLevels[counter].Unchecked += FunkyLogLevelChanged;

                panelFunkyLogFlags.Children.Add(CBLogLevels[counter]);
                counter++;
            }

            StackPanel  StackPanelLogLevelComboBoxes = new StackPanel();
            RadioButton cbLogLevelNone = new RadioButton
            {
                Name    = "LogLevelNone",
                Content = "None",
            };
            cbLogLevelNone.Checked += FunkyLogLevelComboBoxSelected;
            RadioButton cbLogLevelAll = new RadioButton
            {
                Name    = "LogLevelAll",
                Content = "All",
            };
            cbLogLevelAll.Checked += FunkyLogLevelComboBoxSelected;

            StackPanelLogLevelComboBoxes.Children.Add(cbLogLevelNone);
            StackPanelLogLevelComboBoxes.Children.Add(cbLogLevelAll);
            panelFunkyLogFlags.Children.Add(StackPanelLogLevelComboBoxes);

            SPLoggingOptions.Children.Add(panelFunkyLogFlags);

            lbAdvancedContent.Items.Add(SPLoggingOptions);
            #endregion



            CheckBox CBSkipAhead = new CheckBox
            {
                Content   = "Skip Ahead Feature (TrinityMoveTo/Explore)",
                Width     = 300,
                Height    = 20,
                IsChecked = Bot.Settings.Debug.SkipAhead,
            };
            CBSkipAhead.Checked   += SkipAheadChecked;
            CBSkipAhead.Unchecked += SkipAheadChecked;
            lbAdvancedContent.Items.Add(CBSkipAhead);


            //CheckBox CBLineOfSightBehavior = new CheckBox
            //{
            //    Content = "Enable Line-Of-Sight Behavior",
            //    Width = 300,
            //    Height = 20,
            //    IsChecked = Bot.Settings.Plugin.EnableLineOfSightBehavior,
            //};
            //CBLineOfSightBehavior.Checked += LineOfSightBehaviorChecked;
            //CBLineOfSightBehavior.Unchecked += LineOfSightBehaviorChecked;
            //lbAdvancedContent.Items.Add(CBLineOfSightBehavior);

            AdvancedTabItem.Content = lbAdvancedContent;

            TabItem MiscTabItem = new TabItem();
            MiscTabItem.Header = "Misc";
            tabControl1.Items.Add(MiscTabItem);
            ListBox lbMiscContent = new ListBox();
            try
            {
                GameStats cur = Bot.Game.CurrentGameStats;
                lbMiscContent.Items.Add("\r\n== CURRENT GAME SUMMARY ==");
                lbMiscContent.Items.Add(String.Format("Total Profiles:{0}\r\nDeaths:{1} TotalTime:{2} TotalGold:{3} TotalXP:{4}\r\n{5}",
                                                      cur.Profiles.Count, cur.TotalDeaths, cur.TotalTimeRunning.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), cur.TotalGold, cur.TotalXP, cur.TotalLootTracker.ToString()));

                if (Bot.Game.CurrentGameStats.Profiles.Count > 0)
                {
                    lbMiscContent.Items.Add("\r\n== PROFILES ==");
                    foreach (var item in Bot.Game.CurrentGameStats.Profiles)
                    {
                        lbMiscContent.Items.Add(String.Format("{0}\r\nDeaths:{1} TotalTime:{2} TotalGold:{3} TotalXP:{4}\r\n{5}",
                                                              item.ProfileName, item.DeathCount, item.TotalTimeSpan.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), item.TotalGold, item.TotalXP, item.LootTracker.ToString()));
                    }
                }


                TotalStats all = Bot.Game.TrackingStats;
                lbMiscContent.Items.Add("\r\n== CURRENT GAME SUMMARY ==");
                lbMiscContent.Items.Add(String.Format("Total Games:{0} -- Total Unique Profiles:{1}\r\nDeaths:{2} TotalTime:{3} TotalGold:{4} TotalXP:{5}\r\n{6}",
                                                      all.GameCount, all.Profiles.Count, all.TotalDeaths, all.TotalTimeRunning.ToString(@"hh\ \h\ mm\ \m\ ss\ \s"), all.TotalGold, all.TotalXP, all.TotalLootTracker.ToString()));
            }
            catch
            {
                lbMiscContent.Items.Add("Exception Handled");
            }

            MiscTabItem.Content = lbMiscContent;



            TabItem DebuggingTabItem = new TabItem
            {
                Header = "Debug",
                VerticalContentAlignment = VerticalAlignment.Stretch,
                VerticalAlignment        = VerticalAlignment.Stretch,
            };
            tabControl1.Items.Add(DebuggingTabItem);
            DockPanel DockPanel_Debug = new DockPanel
            {
                LastChildFill = true,
                FlowDirection = FlowDirection.LeftToRight,
            };


            Button btnObjects_Debug = new Button
            {
                Content  = "Object Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "Objects",
            };
            btnObjects_Debug.Click += DebugButtonClicked;
            Button btnObstacles_Debug = new Button
            {
                Content  = "Obstacle Cache",
                Width    = 80,
                FontSize = 10,
                Height   = 25,
                Name     = "Obstacles",
            };
            btnObstacles_Debug.Click += DebugButtonClicked;
            Button btnSNO_Debug = new Button
            {
                Content  = "SNO Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "SNO",
            };
            btnSNO_Debug.Click += DebugButtonClicked;
            Button btnAbility_Debug = new Button
            {
                Content  = "Ability Cache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "Ability",
            };
            btnAbility_Debug.Click += DebugButtonClicked;
            Button btnMGP_Debug = new Button
            {
                Content = "MGP Details",
                Width   = 150,
                Height  = 25,
                Name    = "MGP",
            };
            btnMGP_Debug.Click += DebugButtonClicked;
            Button btnCharacterCache_Debug = new Button
            {
                Content  = "Character",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "CHARACTER",
            };
            btnCharacterCache_Debug.Click += DebugButtonClicked;
            Button btnTargetMovement_Debug = new Button
            {
                Content  = "TargetMove",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "TargetMove",
            };
            btnTargetMovement_Debug.Click += DebugButtonClicked;
            Button btnCombatCache_Debug = new Button
            {
                Content  = "CombatCache",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "CombatCache",
            };
            btnCombatCache_Debug.Click += DebugButtonClicked;
            Button btnTEST_Debug = new Button
            {
                Content  = "Test",
                FontSize = 10,
                Width    = 80,
                Height   = 25,
                Name     = "TEST",
            };
            btnTEST_Debug.Click += DebugButtonClicked;



            StackPanel StackPanel_DebugButtons = new StackPanel
            {
                Height = 40,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                FlowDirection       = FlowDirection.LeftToRight,
                Orientation         = Orientation.Horizontal,
                VerticalAlignment   = VerticalAlignment.Top,
            };
            StackPanel_DebugButtons.Children.Add(btnObjects_Debug);
            StackPanel_DebugButtons.Children.Add(btnObstacles_Debug);
            StackPanel_DebugButtons.Children.Add(btnSNO_Debug);
            StackPanel_DebugButtons.Children.Add(btnAbility_Debug);
            StackPanel_DebugButtons.Children.Add(btnCharacterCache_Debug);
            StackPanel_DebugButtons.Children.Add(btnCombatCache_Debug);
            StackPanel_DebugButtons.Children.Add(btnTEST_Debug);

            //StackPanel_DebugButtons.Children.Add(btnGPC_Debug);

            DockPanel.SetDock(StackPanel_DebugButtons, Dock.Top);
            DockPanel_Debug.Children.Add(StackPanel_DebugButtons);

            LBDebug = new ListBox
            {
                SelectionMode              = SelectionMode.Extended,
                HorizontalAlignment        = HorizontalAlignment.Stretch,
                VerticalAlignment          = VerticalAlignment.Stretch,
                VerticalContentAlignment   = VerticalAlignment.Stretch,
                HorizontalContentAlignment = HorizontalAlignment.Stretch,
                FontSize    = 10,
                FontStretch = FontStretches.SemiCondensed,
                Background  = Brushes.Black,
                Foreground  = Brushes.GhostWhite,
            };

            DockPanel_Debug.Children.Add(LBDebug);

            DebuggingTabItem.Content = DockPanel_Debug;


            AddChild(LBWindowContent);
        }
Exemple #30
0
 void SetupToolbar()
 {
     SetCommands();
     DockPanel.SetDock(toolBar, Dock.Top);
     SetMainMenu();
 }
Exemple #31
0
        public override void OnMouseDown(int button, int shift, int x, int y, double mapX, double mapY)
        {
            DF2DApplication app = DF2DApplication.Application;

            this._dict.Clear();
            bool ready = true;

            if (app == null || app.Current2DMapControl == null || app.Workbench == null)
            {
                return;
            }
            app.Workbench.SetMenuEnable(true);
            m_ActiveView = app.Current2DMapControl.ActiveView;
            IScreenDisplay m_Display = app.Current2DMapControl.ActiveView.ScreenDisplay;

            try
            {
                if (button == 1)
                {
                    ISimpleLineSymbol pLineSym = new SimpleLineSymbol();
                    IRgbColor         pColor   = new RgbColorClass();
                    pColor.Red     = 255;
                    pColor.Green   = 255;
                    pColor.Blue    = 0;
                    pLineSym.Color = pColor;
                    pLineSym.Style = esriSimpleLineStyle.esriSLSSolid;
                    pLineSym.Width = 2;

                    ISimpleFillSymbol pFillSym = new SimpleFillSymbol();

                    pFillSym.Color   = pColor;
                    pFillSym.Style   = esriSimpleFillStyle.esriSFSDiagonalCross;
                    pFillSym.Outline = pLineSym;

                    object      symbol = pFillSym as object;
                    IRubberBand band   = new RubberRectangularPolygonClass();
                    IGeometry   pGeo   = band.TrackNew(m_Display, null);
                    app.Current2DMapControl.DrawShape(pGeo, ref symbol);
                    WaitForm.Start("正在查询...", "请稍后");
                    if (pGeo.IsEmpty)
                    {
                        IPoint searchPoint = new PointClass();
                        searchPoint.PutCoords(mapX, mapY);
                        pGeo = PublicFunction.DoBuffer(searchPoint, PublicFunction.ConvertPixelsToMapUnits(m_ActiveView, GlobalValue.System_Selection_Option().Tolerate));
                        //m_ActiveView.FocusMap.SelectByShape(geo, s, false);
                    }
                    if (ready)
                    {
                        //foreach (LogicGroup lg in LogicDataStructureManage2D.Instance.RootLogicGroups)
                        //{
                        foreach (MajorClass mc in FrmMajorClass.Instance.MajorClasses)
                        {
                            foreach (SubClass sc in mc.SubClasses)
                            {
                                if (!sc.Visible2D)
                                {
                                    continue;
                                }
                                string[] arrFc2DId = mc.Fc2D.Split(';');
                                if (arrFc2DId == null)
                                {
                                    continue;
                                }
                                IFeatureCursor pFeatureCursor = null;
                                IFeature       pFeature       = null;
                                foreach (string fc2DId in arrFc2DId)
                                {
                                    DF2DFeatureClass dffc = DF2DFeatureClassManager.Instance.GetFeatureClassByID(fc2DId);
                                    if (dffc == null)
                                    {
                                        continue;
                                    }
                                    IFeatureClass fc   = dffc.GetFeatureClass();
                                    FacilityClass facc = dffc.GetFacilityClass();
                                    if (facc.Name != "PipeLine")
                                    {
                                        continue;
                                    }
                                    if (fc == null || pGeo == null)
                                    {
                                        continue;
                                    }
                                    ISpatialFilter pSpatialFilter = new SpatialFilter();
                                    pSpatialFilter.Geometry   = pGeo;
                                    pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                                    string whereClause = UpOrDown.DecorateWhereClasuse(fc) + mc.ClassifyField + " =  '" + sc.Name + "'";

                                    pSpatialFilter.WhereClause = whereClause;
                                    pFeatureCursor             = fc.Search(pSpatialFilter, false);
                                    if (pFeatureCursor == null)
                                    {
                                        continue;
                                    }
                                    DataTable dt = new DataTable();
                                    dt.TableName = facc.Name;
                                    DataColumn oidcol = new DataColumn();
                                    oidcol.ColumnName = "oid";
                                    oidcol.Caption    = "ID";
                                    dt.Columns.Add(oidcol);
                                    foreach (DFDataConfig.Class.FieldInfo fitemp in facc.FieldInfoCollection)
                                    {
                                        if (!fitemp.CanQuery)
                                        {
                                            continue;
                                        }
                                        DataColumn col = new DataColumn();
                                        col.ColumnName = fitemp.Name;
                                        col.Caption    = fitemp.Alias;
                                        dt.Columns.Add(col);
                                    }
                                    while ((pFeature = pFeatureCursor.NextFeature()) != null)
                                    {
                                        DataRow dtRow = dt.NewRow();
                                        dtRow["oid"] = pFeature.get_Value(pFeature.Fields.FindField("OBJECTID"));
                                        foreach (DataColumn col in dt.Columns)
                                        {
                                            int index1 = pFeature.Fields.FindField(col.ColumnName);
                                            if (index1 < 0)
                                            {
                                                continue;
                                            }
                                            object obj1 = pFeature.get_Value(index1);
                                            string str  = "";
                                            if (obj1 != null)
                                            {
                                                IField field = pFeature.Fields.get_Field(index1);
                                                switch (field.Type)
                                                {
                                                case esriFieldType.esriFieldTypeBlob:
                                                case esriFieldType.esriFieldTypeGeometry:
                                                case esriFieldType.esriFieldTypeRaster:
                                                    continue;

                                                case esriFieldType.esriFieldTypeDouble:

                                                    double d;
                                                    if (double.TryParse(obj1.ToString(), out d))
                                                    {
                                                        str = d.ToString("0.00");
                                                    }
                                                    break;

                                                default:
                                                    str = obj1.ToString();
                                                    break;
                                                }
                                            }
                                            dtRow[col.ColumnName] = str;
                                        }
                                        dt.Rows.Add(dtRow);
                                    }
                                    if (dt.Rows.Count > 0)
                                    {
                                        this._dict.Add(sc.Name, dt);
                                    }
                                }
                            }
                        }
                    }
                    WaitForm.Stop();
                    try
                    {
                        this._uPanel               = new UIDockPanel("查询结果", "查询结果", this.Location, this._width, this._height);
                        this._dockPanel            = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right);
                        this._dockPanel.Visibility = DockVisibility.Visible;
                        this._dockPanel.FloatSize  = new System.Drawing.Size(this._width, this._height);
                        this._dockPanel.Width      = this._width;
                        this._dockPanel.Height     = this._height;
                        if (this._ucPropInfo2D == null)
                        {
                            this._ucPropInfo2D = new UCPropertyInfo2D();
                        }
                        this._ucPropInfo2D.Dock = System.Windows.Forms.DockStyle.Fill;
                        this._uPanel.RegisterEvent(new PanelClose(this.Close));
                        this._dockPanel.Controls.Add(this._ucPropInfo2D);
                        this._ucPropInfo2D.Init();
                        this._ucPropInfo2D.SetPropertyInfo(this._dict);
                    }
                    catch
                    {
                    }
                }
                //}
            }
            catch
            {
            }
            finally
            {
                WaitForm.Stop();
            }
        }
        private void SerializeDockPanel(string path)
        {
            var state = DockPanel.GetDockPanelState();

            SerializerHelper.Serialize(state, path);
        }
 private void BuildWindowMenu()
 {
     mnuProject.Checked = DockPanel.ContainsContent(_dockProject);
 }
        public void CreateContent()
        {
            this.Text = "DockPanelSuite TestApp";
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize          = new System.Drawing.Size(800, 600);
            //
            var dockPanel = new DockPanel();

            dockPanel.AllowDrop                 = true;
            dockPanel.TabIndex                  = 1;
            dockPanel.DocumentStyle             = DocumentStyle.DockingWindow;
            dockPanel.AllowEndUserDocking       = true;
            dockPanel.AllowEndUserNestedDocking = true;
            dockPanel.Dock = DockStyle.Fill;
            this.Controls.Add(dockPanel);
            //
            var dc = new DockContent();

            dc.TabText   = "Hello Doc!";
            dc.DockPanel = dockPanel;
            dc.DockAreas = DockAreas.Document;
            var rtb = new RichTextBox();

            rtb.Dock = DockStyle.Fill;
            dc.Controls.Add(rtb);
            dc.Show();
            //
            DockContent dc2 = new DockContent();

            dc2.TabText   = "Hello Doc!";
            dc2.DockPanel = dockPanel;
            dc2.DockAreas = DockAreas.Document;
            var rtb2 = new RichTextBox();

            rtb2.Dock = DockStyle.Fill;
            dc2.Controls.Add(rtb2);
            dc2.Show();
            //
            DockContent dc3 = new DockContent();

            dc3.AllowEndUserDocking = true;
            dc3.AllowDrop           = true;
            dc3.TabText             = "Hello Tab!";
            dc3.DockPanel           = dockPanel;
            dc3.DockAreas           = DockAreas.DockBottom | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop;
            dc3.DockState           = DockState.DockRight;
            var rtb3 = new RichTextBox();

            rtb3.Dock = DockStyle.Fill;
            dc3.Controls.Add(rtb3);
            dc3.Show();
            //
            DockContent dc4 = new DockContent();

            dc4.AllowEndUserDocking = true;
            dc4.AllowDrop           = true;
            dc4.TabText             = "Hello Tab!";
            dc4.DockPanel           = dockPanel;
            dc4.DockAreas           = DockAreas.DockBottom | DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.Float;
            dc4.DockState           = DockState.DockBottomAutoHide;
            var rtb4 = new RichTextBox();

            rtb4.Dock = DockStyle.Fill;
            dc4.Controls.Add(rtb4);
            dc4.Show();
        }
        private void UpdateItemList()
        {
            listViewItems.Items.Clear();
            selectedIndex = -1;
            selectedItem  = null;

            for (int i = 0; i < pocket.SlotsUsed; i++)
            {
                Item item = pocket[i];
                if (!item.ItemData.IsImportant && (item.ID < 121 || (item.ID > 132 && item.ID < 500)))
                {
                    ListViewItem listViewItem = new ListViewItem();
                    listViewItem.Tag = item;
                    listViewItem.SnapsToDevicePixels = true;
                    listViewItem.UseLayoutRounding   = true;
                    DockPanel dockPanel = new DockPanel();
                    dockPanel.Width = 170;

                    Image image = new Image();
                    image.Width               = 12;
                    image.Height              = 12;
                    image.Source              = ItemDatabase.GetItemImageFromID(item.ID);
                    image.Stretch             = Stretch.Uniform;
                    image.SnapsToDevicePixels = true;
                    image.UseLayoutRounding   = true;
                    image.HorizontalAlignment = HorizontalAlignment.Center;
                    image.VerticalAlignment   = VerticalAlignment.Center;

                    TextBlock itemName = new TextBlock();
                    itemName.VerticalAlignment = VerticalAlignment.Center;
                    itemName.Text         = ItemDatabase.GetItemFromID(item.ID).Name;
                    itemName.TextTrimming = TextTrimming.CharacterEllipsis;
                    itemName.Margin       = new Thickness(4, 0, 0, 0);

                    TextBlock itemX = new TextBlock();
                    itemX.VerticalAlignment   = VerticalAlignment.Center;
                    itemX.HorizontalAlignment = HorizontalAlignment.Right;
                    itemX.TextAlignment       = TextAlignment.Right;
                    itemX.Text     = "x";
                    itemX.Width    = Double.NaN;
                    itemX.MinWidth = 10;

                    TextBlock itemCount = new TextBlock();
                    itemCount.VerticalAlignment   = VerticalAlignment.Center;
                    itemCount.HorizontalAlignment = HorizontalAlignment.Right;
                    itemCount.TextAlignment       = TextAlignment.Right;
                    itemCount.Width = 30;
                    itemCount.Text  = item.Count.ToString();

                    listViewItem.ToolTip = item.ItemData.Description;
                    listViewItem.Content = dockPanel;
                    listViewItems.Items.Add(listViewItem);
                    dockPanel.Children.Add(image);
                    dockPanel.Children.Add(itemName);

                    DockPanel.SetDock(image, Dock.Left);

                    if (!item.ItemData.IsImportant)
                    {
                        dockPanel.Children.Add(itemCount);
                        dockPanel.Children.Add(itemX);
                        DockPanel.SetDock(itemCount, Dock.Right);
                    }
                }
            }
        }
Exemple #36
0
        private void OnAddListViewItem(object sender, MailboxEventArgs e)
        {
            ListViewItem listViewItem = new ListViewItem();

            listViewItem.SnapsToDevicePixels = true;
            listViewItem.UseLayoutRounding   = true;
            DockPanel dockPanel = new DockPanel();

            dockPanel.Width = 300;

            Image image = new Image();

            image.Source              = ItemDatabase.GetItemImageFromID(e.Mail.MailItemID);
            image.Stretch             = Stretch.None;
            image.SnapsToDevicePixels = true;
            image.UseLayoutRounding   = true;

            TextBlock fromName = new TextBlock();

            fromName.VerticalAlignment = VerticalAlignment.Center;
            fromName.Text         = "From " + e.Mail.TrainerName;
            fromName.TextTrimming = TextTrimming.CharacterEllipsis;
            fromName.Margin       = new Thickness(4, 0, 0, 0);

            /*TextBlock blockLv = new TextBlock();
             * blockLv.VerticalAlignment	= VerticalAlignment.Center;
             * blockLv.HorizontalAlignment = HorizontalAlignment.Right;
             * blockLv.TextAlignment = TextAlignment.Right;
             * blockLv.Text = "Lv";
             * blockLv.Width = Double.NaN;
             * blockLv.MinWidth = 10;
             *
             * TextBlock blockLevel = new TextBlock();
             * blockLevel.VerticalAlignment	= VerticalAlignment.Center;
             * blockLevel.HorizontalAlignment = HorizontalAlignment.Right;
             * blockLevel.TextAlignment = TextAlignment.Right;
             * blockLevel.Width = 30;
             * blockLevel.Text = e.Pokeblock.Level.ToString();*/

            listViewItem.Content = dockPanel;
            mailbox.ListViewItems.Insert(e.Index, listViewItem);
            dockPanel.Children.Add(image);
            dockPanel.Children.Add(fromName);
            //dockPanel.Children.Add(blockLevel);
            //dockPanel.Children.Add(blockLv);


            ContextMenu contextMenu = new ContextMenu();

            MenuItem menuPokeblockSendTo = new MenuItem();

            menuPokeblockSendTo.Header = "Send To";
            menuPokeblockSendTo.Click += OnMailSendTo;
            contextMenu.Items.Add(menuPokeblockSendTo);

            MenuItem menuPokeblockToss = new MenuItem();

            menuPokeblockToss.Header = "Return to Inventory";
            menuPokeblockToss.Click += OnMailReturnToInventory;
            contextMenu.Items.Add(menuPokeblockToss);

            listViewItem.ContextMenu = contextMenu;


            //DockPanel.SetDock(image, Dock.Left);
            //DockPanel.SetDock(blockLevel, Dock.Right);

            UpdateDetails();
        }
Exemple #37
0
 protected internal FloatWindow(DockPanel dockPanel, DockPane pane)
 {
     InternalConstruct(dockPanel, pane, boundsSpecified: false, Rectangle.Empty);
 }
Exemple #38
0
 public AuthorithManager(DockPanel dockPanel)
 {
     InitializeComponent();
     this.dockPanel = dockPanel;
 }
Exemple #39
0
 public DockPanelLayoutLock(DockPanel dockPanel, bool startLocked = false)
 {
     _dockPanel = dockPanel;
     if (startLocked)
         EnsureLocked();
 }
Exemple #40
0
 protected internal FloatWindow(DockPanel dockPanel, DockPane pane, Rectangle bounds)
 {
     InternalConstruct(dockPanel, pane, boundsSpecified: true, bounds);
 }
Exemple #41
0
 public override void CleanUp(DockPanel dockPanel)
 {
     PaintingService.CleanUp();
     base.CleanUp(dockPanel);
 }
Exemple #42
0
			public AutoHideStripBase CreateAutoHideStrip( DockPanel panel ) {
				return new VS2003AutoHideStrip( panel );
			}
Exemple #43
0
 void ILandpriceView.SetContainer(DevExpress.XtraBars.Docking.DockPanel dockpanel)
 {
     this._containerDockpanel=dockpanel;
 }
Exemple #44
0
        private static FrameworkElement CreateElement(
            ImmutableArray <TaggedText> taggedTexts,
            IWpfTextView textView,
            TextFormattingRunProperties format,
            IClassificationFormatMap formatMap,
            ClassificationTypeMap typeMap,
            bool classify)
        {
            // Constructs the hint block which gets assigned parameter name and fontstyles according to the options
            // page. Calculates a inline tag that will be 3/4s the size of a normal line. This shrink size tends to work
            // well with VS at any zoom level or font size.

            var block = new TextBlock
            {
                FontFamily = format.Typeface.FontFamily,
                FontSize   = 0.75 * format.FontRenderingEmSize,
                FontStyle  = FontStyles.Normal,
                Foreground = format.ForegroundBrush,

                // Adds a little bit of padding to the left of the text relative to the border to make the text seem
                // more balanced in the border
                Padding = new Thickness(left: 2, top: 0, right: 2, bottom: 0)
            };

            var(trimmedTexts, leftPadding, rightPadding) = Trim(taggedTexts);

            foreach (var taggedText in trimmedTexts)
            {
                var run = new Run(taggedText.ToVisibleDisplayString(includeLeftToRightMarker: true));

                if (classify && taggedText.Tag != TextTags.Text)
                {
                    var properties = formatMap.GetTextProperties(typeMap.GetClassificationType(taggedText.Tag.ToClassificationTypeName()));
                    var brush      = properties.ForegroundBrush.Clone();
                    run.Foreground = brush;
                }

                block.Inlines.Add(run);
            }

            // Encapsulates the textblock within a border. Gets foreground/background colors from the options menu.

            // If the tag is started or followed by a space, we trim that off but represent the space as buffer on hte
            // left or right side.
            var left  = leftPadding * 5;
            var right = rightPadding * 5;

            var border = new Border
            {
                Background        = format.BackgroundBrush,
                Child             = block,
                CornerRadius      = new CornerRadius(2),
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin            = new Thickness(left, top: 0, right, bottom: 0),
            };

            border.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
            // gets pixel distance of baseline to top of the font height
            var dockPanelHeight = format.Typeface.FontFamily.Baseline * format.FontRenderingEmSize;

            var dockPanel = new DockPanel
            {
                Height        = dockPanelHeight,
                LastChildFill = false,
                // VerticalAlignment is set to Top because it will rest to the top relative to the stackpanel
                VerticalAlignment = VerticalAlignment.Top
            };

            dockPanel.Children.Add(border);
            DockPanel.SetDock(border, Dock.Bottom);

            var stackPanel = new StackPanel
            {
                // Height set to align the baseline of the text within the TextBlock with the baseline of text in the editor
                Height      = dockPanelHeight + (block.DesiredSize.Height - (block.FontFamily.Baseline * block.FontSize)),
                Orientation = Orientation.Vertical
            };

            stackPanel.Children.Add(dockPanel);
            // Need to set these properties to avoid unnecessary reformatting because some dependancy properties
            // affect layout
            TextOptions.SetTextFormattingMode(stackPanel, TextOptions.GetTextFormattingMode(textView.VisualElement));
            TextOptions.SetTextHintingMode(stackPanel, TextOptions.GetTextHintingMode(textView.VisualElement));
            TextOptions.SetTextRenderingMode(stackPanel, TextOptions.GetTextRenderingMode(textView.VisualElement));

            return(stackPanel);
        }
 public SecurityManager(DockPanel ActiveDockPanel)
 {
     m_dockPanel = ActiveDockPanel;
 }
Exemple #46
0
 /// <summary>
 /// Constructor when deserializing
 /// </summary>
 /// <param name="dockPanel">Parent dock panel</param>
 /// <param name="reader">Source xml</param>
 public GridLayout(DockPanel dockPanel, XmlReader reader)
     : this(dockPanel)
 {
     ReadXml(reader);
 }
Exemple #47
0
 /// <summary>
 /// Initializes the form components
 /// </summary>
 private void InitializeComponents()
 {
     this.quickFind = new QuickFind();
     this.dockPanel = new DockPanel();
     this.statusStrip = new StatusStrip();
     this.toolStripPanel = new ToolStripPanel();
     this.menuStrip = StripBarManager.GetMenuStrip(FileNameHelper.MainMenu);
     this.toolStrip = StripBarManager.GetToolStrip(FileNameHelper.ToolBar);
     this.editorMenu = StripBarManager.GetContextMenu(FileNameHelper.ScintillaMenu);
     this.tabMenu = StripBarManager.GetContextMenu(FileNameHelper.TabMenu);
     this.toolStripStatusLabel = new ToolStripStatusLabel();
     this.toolStripProgressLabel = new ToolStripStatusLabel();
     this.toolStripProgressBar = new ToolStripProgressBar();
     this.printPreviewDialog = new PrintPreviewDialog();
     this.saveFileDialog = new SaveFileDialog();
     this.openFileDialog = new OpenFileDialog();
     this.colorDialog = new ColorDialog();
     this.printDialog = new PrintDialog();
     this.SuspendLayout();
     //
     // toolStripPanel
     //
     this.toolStripPanel.Dock = DockStyle.Top;
     this.toolStripPanel.Controls.Add(this.toolStrip);
     this.toolStripPanel.Controls.Add(this.menuStrip);
     this.tabMenu.Font = Globals.Settings.DefaultFont;
     this.toolStrip.Font = Globals.Settings.DefaultFont;
     this.menuStrip.Font = Globals.Settings.DefaultFont;
     this.editorMenu.Font = Globals.Settings.DefaultFont;
     this.toolStrip.Renderer = new DockPanelStripRenderer(false);
     this.toolStrip.Padding = new Padding(0, 1, 0, 0);
     this.toolStrip.Size = new Size(500, 26);
     this.toolStrip.Stretch = true;
     // 
     // openFileDialog
     //
     this.openFileDialog.Title = " " + TextHelper.GetString("Title.OpenFileDialog");
     this.openFileDialog.Filter = TextHelper.GetString("Info.FileDialogFilter") + "|*.*";
     this.openFileDialog.RestoreDirectory = true;
     //
     // colorDialog
     //
     this.colorDialog.FullOpen = true;
     this.colorDialog.ShowHelp = false;
     // 
     // printPreviewDialog
     //
     this.printPreviewDialog.Enabled = true;
     this.printPreviewDialog.Name = "printPreviewDialog";
     this.printPreviewDialog.StartPosition = FormStartPosition.CenterParent;
     this.printPreviewDialog.TransparencyKey = Color.Empty;
     this.printPreviewDialog.Visible = false;
     // 
     // saveFileDialog
     //
     this.saveFileDialog.Title = " " + TextHelper.GetString("Title.SaveFileDialog");
     this.saveFileDialog.Filter = TextHelper.GetString("Info.FileDialogFilter") + "|*.*";
     this.saveFileDialog.RestoreDirectory = true;
     // 
     // dockPanel
     //
     this.dockPanel.TabIndex = 2;
     this.dockPanel.DocumentStyle = DocumentStyle.DockingWindow;
     this.dockPanel.DockWindows[DockState.Document].Controls.Add(this.quickFind);
     this.dockPanel.Dock = DockStyle.Fill;
     this.dockPanel.Name = "dockPanel";
     //
     // toolStripStatusLabel
     //
     this.toolStripStatusLabel.Name = "toolStripStatusLabel";
     this.toolStripStatusLabel.TextAlign = ContentAlignment.MiddleLeft;
     this.toolStripStatusLabel.Spring = true;
     //
     // toolStripProgressLabel
     //
     this.toolStripProgressLabel.AutoSize = true;
     this.toolStripProgressLabel.Name = "toolStripProgressLabel";
     this.toolStripProgressLabel.TextAlign = ContentAlignment.MiddleRight;
     this.toolStripProgressLabel.Visible = false;
     //
     // toolStripProgressBar
     //
     this.toolStripProgressBar.Name = "toolStripProgressBar";
     this.toolStripProgressBar.ControlAlign = ContentAlignment.MiddleRight;
     this.toolStripProgressBar.ProgressBar.Width = 120;
     this.toolStripProgressBar.Visible = false;
     // 
     // statusStrip
     //
     this.statusStrip.TabIndex = 3;
     this.statusStrip.Name = "statusStrip";
     this.statusStrip.Items.Add(this.toolStripStatusLabel);
     this.statusStrip.Items.Add(this.toolStripProgressLabel);
     this.statusStrip.Items.Add(this.toolStripProgressBar);
     this.statusStrip.Font = Globals.Settings.DefaultFont;
     this.statusStrip.Stretch = true;
     // 
     // MainForm
     //
     this.AllowDrop = true;
     this.Name = "MainForm";
     this.Text = "FlashDevelop";
     this.Size = new Size(500, 350);
     this.Controls.Add(this.dockPanel);
     this.Controls.Add(this.toolStripPanel);
     this.Controls.Add(this.statusStrip);
     this.MainMenuStrip = this.menuStrip;
     this.Size = this.appSettings.WindowSize;
     this.Font = this.appSettings.DefaultFont;
     this.StartPosition = FormStartPosition.Manual;
     this.Closing += new CancelEventHandler(this.OnMainFormClosing);
     this.Activated += new EventHandler(this.OnMainFormActivate);
     this.Shown += new EventHandler(this.OnMainFormShow);
     this.Load += new EventHandler(this.OnMainFormLoad);
     this.LocationChanged += new EventHandler(this.OnMainFormLocationChange);
     this.GotFocus += new EventHandler(this.OnMainFormGotFocus);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Exemple #48
0
            //

            public _StatisticsResultItem(StatisticsResultOfBasicRank statisticsResult)
            {
                Rank basicRank = statisticsResult.BasicRank;

                _ThemeColor = basicRank.GetThemeColor();

                _Container  = new DockPanel();
                _DetailText = new List <(Border border, TextBlock rank, TextBlock count)>();

                //

                _TitleText = new TextBlock()
                {
                    Text              = basicRank.IsUnranked() ? "未指定" : basicRank.IsClade() ? "未分级演化支" : basicRank.GetChineseName(),
                    Margin            = new Thickness(9, 0, 9, 0),
                    VerticalAlignment = VerticalAlignment.Center
                };

                _TitleBorder = new Border()
                {
                    Child        = _TitleText,
                    CornerRadius = new CornerRadius(3),
                    Margin       = new Thickness(0, 0, 6, 0)
                };

                _Container.Children.Add(_TitleBorder);

                //

                _TotalText = new TextBlock()
                {
                    Text   = $"总计:   {statisticsResult.TaxonCount}",
                    Margin = new Thickness(0, 4, 7, 2),
                    HorizontalAlignment = HorizontalAlignment.Right
                };

                _TotalBorder = new Border()
                {
                    Child           = _TotalText,
                    BorderThickness = new Thickness(0, 0, 0, 2)
                };

                if (basicRank.IsPrimaryOrSecondaryRank())
                {
                    StackPanel detailsStackPanel = new StackPanel();

                    int       detailsCount   = statisticsResult.Details.Count + 1; // 把"总计"放在最后一个
                    Grid      grid           = null;
                    const int maxColumnCount = 3;
                    int       columnCount    = 0;
                    int       columnId       = 0;

                    Thickness detailTextMargin = new Thickness(6, 3, 6, 3);

                    for (int i = 0; i < detailsCount; i++)
                    {
                        if (grid is null)
                        {
                            grid = new Grid()
                            {
                                Margin = new Thickness(0, i > 0 ? 3 : 0, 0, 0)
                            };

                            // 避免"总计"单独放在一行
                            if (detailsCount - i == maxColumnCount + 1)
                            {
                                columnCount = maxColumnCount - 1;
                            }
                            else
                            {
                                columnCount = Math.Min(maxColumnCount, detailsCount - i);
                            }

                            if (columnCount > 1)
                            {
                                grid.ColumnDefinitions.Add(new ColumnDefinition());

                                for (int c = 1; c < columnCount; c++)
                                {
                                    grid.ColumnDefinitions.Add(new ColumnDefinition()
                                    {
                                        Width = new GridLength(3)
                                    });
                                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                                }
                            }
                        }

                        if (i < detailsCount - 1)
                        {
                            StatisticsResultOfRank detail = statisticsResult.Details[i];

                            TextBlock rankText = new TextBlock()
                            {
                                Text   = detail.Rank.GetChineseName(),
                                Margin = detailTextMargin
                            };

                            TextBlock countText = new TextBlock()
                            {
                                Text   = detail.TaxonCount.ToString(),
                                Margin = detailTextMargin,
                                HorizontalAlignment = HorizontalAlignment.Right
                            };

                            if (detail.Rank.IsBasicPrimaryRank())
                            {
                                rankText.FontWeight = countText.FontWeight = FontWeights.Bold;
                            }

                            Grid detailGrid = new Grid();
                            detailGrid.Children.Add(rankText);
                            detailGrid.Children.Add(countText);

                            Border detailBorder = new Border()
                            {
                                Child               = detailGrid,
                                CornerRadius        = new CornerRadius(3),
                                BorderThickness     = new Thickness(1),
                                SnapsToDevicePixels = true
                            };

                            detailBorder.SetValue(Grid.ColumnProperty, 2 * columnId);

                            _DetailText.Add((detailBorder, rankText, countText));

                            grid.Children.Add(detailBorder);
                        }
                        else
                        {
                            _TotalBorder.SetValue(Grid.ColumnProperty, 2 * columnId);

                            grid.Children.Add(_TotalBorder);
                        }

                        columnId++;

                        if (columnId >= columnCount)
                        {
                            detailsStackPanel.Children.Add(grid);

                            grid     = null;
                            columnId = 0;
                        }
                    }

                    _Container.Children.Add(detailsStackPanel);
                }
                else
                {
                    _Container.Children.Add(_TotalBorder);
                }

                _UpdateTheme();
            }
Exemple #49
0
 public void Dispose()
 {
     if (_locked && _dockPanel != null)
     {
         _dockPanel.ResumeLayout(true, true);
         _coverControl.Dispose();
         var cursorControl = _dockPanel.TopLevelControl ?? _dockPanel;
         cursorControl.Cursor = _cursorBegin;
     }
     _dockPanel = null;  // Only once
 }
Exemple #50
0
 /// <summary>
 /// Constructor used when deserialising</summary>
 /// <param name="dockPanel">Root dock panel</param>
 /// <param name="reader">Source XML</param>
 public TabLayout(DockPanel dockPanel, XmlReader reader)
     : this(dockPanel)
 {
     ReadXml(reader);
 }
        public void Detach()
        {
            StoreConfiguration();

            DetachPadContents(true);
            DetachViewContents(true);

            try
            {
                if (dockPanel != null)
                {
                    dockPanel.Dispose();
                    dockPanel = null;
                }
            }
            catch (Exception e)
            {
                MessageService.ShowError(e);
            }
            if (contentHash != null)
            {
                contentHash.Clear();
            }

            wbForm.Controls.Clear();
        }
        private void CreateNavMenuItem(NavMenuItemData item, Panel toAdd, int offset = 0)
        {
            #region создание самого элемента


            DockPanel dock = new DockPanel()
            {
                Height     = ItemHeight,
                Background = new SolidColorBrush(item.IsSelected ? SelectedItemBackground : Background)
            };

            Image icon = null;
            try
            {
                icon = new Image()
                {
                    Height = IconSize,
                    Width  = IconSize,
                    Margin = new Thickness((DropdownIconSectionWidth - IconSize) / 2 + offset, (ItemHeight - IconSize) / 2, (DropdownIconSectionWidth - IconSize) / 2, (ItemHeight - IconSize) / 2),
                    Source = new BitmapImage(item.ImageSource)
                };
                DockPanel.SetDock(icon, Dock.Left);
                dock.Children.Add(icon);
            }
            catch { }


            TextBlock text = new TextBlock()
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Left,
                Text       = item.Text,
                Foreground = item.IsSelected ? new SolidColorBrush(SelectedItemTextColor) : new SolidColorBrush(ItemTextColor),
                FontFamily = ItemTextFontFamily,
                FontSize   = ItemTextFontSize,
                FontWeight = ItemTextFontWeight,
                Margin     = new Thickness(0, 0, (ItemHeight - ItemTextFontSize) / 2, 0)
            };
            DockPanel.SetDock(text, Dock.Left);
            dock.Children.Add(text);



            ColorAnimation mouseEnterAnimation = new ColorAnimation()
            {
                From     = item.IsSelected ? SelectedItemBackground : Background,
                To       = MouseInItemBackground,
                Duration = MouseInOverAnimationDuration
            };
            ColorAnimation mouseEnterTextAnimation = new ColorAnimation()
            {
                From     = item.IsSelected ? SelectedItemTextColor : ItemTextColor,
                To       = MouseInItemTextColor,
                Duration = MouseInOverAnimationDuration
            };
            dock.MouseEnter += (object sender, MouseEventArgs e) =>
            {
                if (!this.IsEnabled)
                {
                    return;
                }

                dock.Background.BeginAnimation(SolidColorBrush.ColorProperty, mouseEnterAnimation);
                text.Foreground.BeginAnimation(SolidColorBrush.ColorProperty, mouseEnterTextAnimation);
            };

            ColorAnimation mouseLeaveAnimation = new ColorAnimation()
            {
                From     = MouseInItemBackground,
                To       = item.IsSelected ? SelectedItemBackground : Background,
                Duration = MouseInOverAnimationDuration
            };
            ColorAnimation mouseLeaveTextAnimation = new ColorAnimation()
            {
                To       = item.IsSelected ? SelectedItemTextColor : ItemTextColor,
                From     = MouseInItemTextColor,
                Duration = MouseInOverAnimationDuration
            };
            dock.MouseLeave += (object sender, MouseEventArgs e) =>
            {
                if (!this.IsEnabled)
                {
                    return;
                }

                dock.Background.BeginAnimation(SolidColorBrush.ColorProperty, mouseLeaveAnimation);
                text.Foreground.BeginAnimation(SolidColorBrush.ColorProperty, mouseLeaveTextAnimation);
            };

            MouseClickManager clickManager = new MouseClickManager(200, () => { return(this.IsEnabled); });
            dock.MouseLeftButtonDown += clickManager.OnMouseLeftButtonDown;
            dock.MouseLeftButtonUp   += clickManager.OnMouseLeftButtonUp;

            //обработчик кликов во вне
            clickManager.Click += (object sender, MouseButtonEventArgs e) => { RaiseClickedEvent(item); };

            item.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                _context?.Post((s) =>
                {
                    if (sender is NavMenuItemData data)
                    {
                        if (e.PropertyName == "ImageSource")
                        {
                            if (icon != null)
                            {
                                icon.Source = new BitmapImage(data.ImageSource);
                            }
                        }

                        if (e.PropertyName == "Text")
                        {
                            if (text != null)
                            {
                                text.Text = data.Text;
                            }
                        }

                        if (e.PropertyName == "IsSelected")
                        {
                            if (text != null)
                            {
                                text.Foreground = data.IsSelected ? new SolidColorBrush(SelectedItemTextColor) : new SolidColorBrush(ItemTextColor);
                            }

                            if (dock != null)
                            {
                                dock.Background = new SolidColorBrush(data.IsSelected ? SelectedItemBackground : Background);
                            }

                            if (mouseEnterAnimation != null)
                            {
                                mouseEnterAnimation.From = data.IsSelected ? SelectedItemBackground : Background;
                            }

                            if (mouseEnterTextAnimation != null)
                            {
                                mouseEnterTextAnimation.From = data.IsSelected ? SelectedItemTextColor : ItemTextColor;
                            }

                            if (mouseLeaveAnimation != null)
                            {
                                mouseLeaveAnimation.To = data.IsSelected ? SelectedItemBackground : Background;
                            }

                            if (mouseLeaveTextAnimation != null)
                            {
                                mouseLeaveTextAnimation.To = data.IsSelected ? SelectedItemTextColor : ItemTextColor;
                            }
                        }
                    }
                }, null);
            };


            toAdd.Children.Add(dock);

            #endregion

            #region создание подменю

            bool isAnimatedNow = false;
            if (item.IsDropdownItem && item.DropdownItems != null)
            {
                Image dropdownIcon;
                try
                {
                    dropdownIcon = new Image()
                    {
                        Height = DropdownIconSize,
                        Width  = DropdownIconSize,
                        Margin =
                            new Thickness((ItemHeight - DropdownIconSize) / 2.0 > DropdownIconMinLeftOffset ? (ItemHeight - DropdownIconSize) / 2.0 : DropdownIconMinLeftOffset,
                                          (ItemHeight - DropdownIconSize) / 2,
                                          (ItemHeight - DropdownIconSize) / 2,
                                          (ItemHeight - DropdownIconSize) / 2),

                        HorizontalAlignment = HorizontalAlignment.Right,
                        Source          = new BitmapImage(DropdownIconSource),
                        RenderTransform = new RotateTransform(0, DropdownIconSize / 2, DropdownIconSize / 2),
                        Name            = "dropdownIcon"
                    };
                    DockPanel.SetDock(dropdownIcon, Dock.Right);
                    dock.Children.Add(dropdownIcon);
                }
                catch { }


                DoubleAnimation rotateAnimation = new DoubleAnimation()
                {
                    Duration       = DropdownMenuAnimationDuration,
                    EasingFunction = DropdownMenuFunction,
                };

                StackPanel dropdownMenu = new StackPanel()
                {
                    Orientation = Orientation.Vertical,
                    MaxHeight   = 0
                };



                foreach (var el in item.DropdownItems)
                {
                    CreateNavMenuItem(el, dropdownMenu, offset + DropdownMenuLeftOffset);
                }


                DoubleAnimation dropupAnimation = new DoubleAnimation()
                {
                    Duration       = DropdownMenuAnimationDuration,
                    EasingFunction = DropdownMenuFunction
                };

                DoubleAnimationUsingKeyFrames dropdownAnimation = new DoubleAnimationUsingKeyFrames();
                dropdownAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)), Value = 0, EasingFunction = DropdownMenuFunction
                });
                dropdownAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(DropdownMenuAnimationDuration.Milliseconds - 1)), EasingFunction = DropdownMenuFunction
                });
                dropdownAnimation.KeyFrames.Add(new EasingDoubleKeyFrame()
                {
                    KeyTime = KeyTime.FromTimeSpan(DropdownMenuAnimationDuration), Value = 100000
                });

                this.IsEnabledChanged += (object sender, DependencyPropertyChangedEventArgs e) =>
                {
                    if (!(bool)e.NewValue && dropdownMenu.MaxHeight > 0)
                    {
                        dropupAnimation.From = dropdownMenu.RenderSize.Height;
                        dropupAnimation.To   = 0;
                        dropdownMenu.BeginAnimation(Panel.MaxHeightProperty, dropupAnimation);
                    }
                };


                #region обработчик кликов для скрытия/раскрытия меню

                rotateAnimation.Completed += (object sender, EventArgs e) => { isAnimatedNow = false; };

                clickManager.Click += (object sender, MouseButtonEventArgs e) =>
                {
                    if (!isAnimatedNow && (sender is Panel senderPanel))
                    {
                        if (senderPanel.Parent is Panel parentPanel)
                        {
                            var submenu = parentPanel.Children[parentPanel.Children.IndexOf(senderPanel) + 1];

                            if (submenu is Panel submenuPanel)
                            {
                                isAnimatedNow = true;
                                if (submenuPanel.MaxHeight <= 0.1)
                                {
                                    rotateAnimation.From = 0;
                                    rotateAnimation.To   = 180;
                                    dropdownAnimation.KeyFrames[1].Value = submenuPanel.RenderSize.Height;
                                    submenuPanel.BeginAnimation(Panel.MaxHeightProperty, dropdownAnimation);
                                }
                                else
                                {
                                    rotateAnimation.From = 180;
                                    rotateAnimation.To   = 360;
                                    dropupAnimation.From = submenuPanel.RenderSize.Height;
                                    dropupAnimation.To   = 0;
                                    submenuPanel.BeginAnimation(Panel.MaxHeightProperty, dropupAnimation);
                                }


                                if ((LogicalTreeHelper.FindLogicalNode(senderPanel, "dropdownIcon") is Image img) && (img.RenderTransform is RotateTransform transform))
                                {
                                    transform.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation);
                                }
                            }
                        }
                    }
                };
                #endregion

                toAdd.Children.Add(dropdownMenu);
            }

            #endregion
        }
Exemple #53
0
        //creates the quick info panel for the airport
        private ScrollViewer createQuickInfoPanel()
        {
            ScrollViewer scroller = new ScrollViewer();

            scroller.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            scroller.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
            scroller.MaxHeight = GraphicsHelpers.GetContentHeight() / 2;

            StackPanel panelInfo = new StackPanel();

            scroller.Content = panelInfo;

            TextBlock txtHeader = new TextBlock();

            txtHeader.Uid = "1006";
            txtHeader.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            txtHeader.SetResourceReference(TextBlock.BackgroundProperty, "HeaderBackgroundBrush");
            txtHeader.TextAlignment = TextAlignment.Left;
            txtHeader.FontWeight    = FontWeights.Bold;
            txtHeader.Text          = Translator.GetInstance().GetString("PageAirport", txtHeader.Uid);

            panelInfo.Children.Add(txtHeader);

            DockPanel grdQuickInfo = new DockPanel();

            grdQuickInfo.Margin = new Thickness(0, 5, 0, 0);

            panelInfo.Children.Add(grdQuickInfo);

            Image imgAirport = new Image();

            imgAirport.Source = this.Airport.Profile.Logo.Length > 0 ? new BitmapImage(new Uri(this.Airport.Profile.Logo, UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri(@"/Data/images/airport.png", UriKind.Relative));
            imgAirport.Width  = 110;
            imgAirport.Margin = new Thickness(0, 0, 5, 0);
            imgAirport.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            RenderOptions.SetBitmapScalingMode(imgAirport, BitmapScalingMode.HighQuality);
            grdQuickInfo.Children.Add(imgAirport);

            StackPanel panelQuickInfo = new StackPanel();

            grdQuickInfo.Children.Add(panelQuickInfo);

            ListBox lbQuickInfo = new ListBox();

            lbQuickInfo.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbQuickInfo.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            panelQuickInfo.Children.Add(lbQuickInfo);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1007"), UICreator.CreateTextBlock(this.Airport.Profile.Name)));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1008"), UICreator.CreateTextBlock(new AirportCodeConverter().Convert(this.Airport).ToString())));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1009"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Type).ToString())));


            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1010"), UICreator.CreateTownPanel(this.Airport.Profile.Town)));



            ContentControl lblFlag = new ContentControl();

            lblFlag.SetResourceReference(ContentControl.ContentTemplateProperty, "CountryFlagLongItem");
            lblFlag.Content = new CountryCurrentCountryConverter().Convert(this.Airport.Profile.Country);//this.Airport.Profile.Country is TemporaryCountry ? ((TemporaryCountry)this.Airport.Profile.Country).getCurrentCountry(GameObject.GetInstance().GameTime) : this.Airport.Profile.Country;

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1011"), lblFlag));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1022"), UICreator.CreateTextBlock(this.Airport.Profile.Period.From.ToShortDateString())));

            if (GameObject.GetInstance().GameTime.AddDays(14) > this.Airport.Profile.Period.To)
            {
                TextBlock txtClosingDate = UICreator.CreateTextBlock(this.Airport.Profile.Period.To.ToShortDateString());
                txtClosingDate.Foreground = Brushes.DarkRed;

                lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1024"), txtClosingDate));
            }

            GameTimeZone tz = this.Airport.Profile.TimeZone;

            TextBlock txtTimeZone = UICreator.CreateTextBlock(tz.DisplayName);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1012"), txtTimeZone));

            txtLocalTime = UICreator.CreateTextBlock(string.Format("{0} {1}", MathHelpers.ConvertDateTimeToLoalTime(GameObject.GetInstance().GameTime, tz).ToShortTimeString(), tz.ShortName));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1013"), txtLocalTime));
            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1019"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Season).ToString())));

            WrapPanel panelCoordinates = new WrapPanel();

            Image imgMap = new Image();

            imgMap.Source     = new BitmapImage(new Uri(@"/Data/images/map.png", UriKind.RelativeOrAbsolute));
            imgMap.Height     = 16;
            imgMap.MouseDown += new MouseButtonEventHandler(imgMap_MouseDown);
            RenderOptions.SetBitmapScalingMode(imgMap, BitmapScalingMode.HighQuality);

            imgMap.Margin = new Thickness(0, 0, 5, 0);
            panelCoordinates.Children.Add(imgMap);

            TextBlock txtCoordinates = UICreator.CreateLink(this.Airport.Profile.Coordinates.ToString());

            ((Hyperlink)txtCoordinates.Inlines.FirstInline).Click += new RoutedEventHandler(PageAirport_Click);
            txtCoordinates.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;
            panelCoordinates.Children.Add(txtCoordinates);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1014"), panelCoordinates));
            //  lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1015"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Size).ToString())));
            //   lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1021"), UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Cargo).ToString())));

            WrapPanel panelSize = new WrapPanel();

            Image imgPassenger = new Image();

            imgPassenger.Source = new BitmapImage(new Uri(@"/Data/images/passenger.png", UriKind.RelativeOrAbsolute));
            imgPassenger.Height = 16;
            RenderOptions.SetBitmapScalingMode(imgPassenger, BitmapScalingMode.HighQuality);

            panelSize.Children.Add(imgPassenger);

            TextBlock txtPassengerSize = UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Size).ToString());

            txtPassengerSize.Margin            = new Thickness(2, 0, 0, 0);
            txtPassengerSize.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelSize.Children.Add(txtPassengerSize);

            Image imgCargo = new Image();

            imgCargo.Margin = new Thickness(10, 0, 0, 0);
            imgCargo.Source = new BitmapImage(new Uri(@"/Data/images/cargo.png", UriKind.RelativeOrAbsolute));
            imgCargo.Height = 16;
            RenderOptions.SetBitmapScalingMode(imgCargo, BitmapScalingMode.HighQuality);

            panelSize.Children.Add(imgCargo);

            TextBlock txtCargoSize = UICreator.CreateTextBlock(new TextUnderscoreConverter().Convert(this.Airport.Profile.Cargo).ToString());

            txtCargoSize.Margin            = new Thickness(2, 0, 0, 0);
            txtCargoSize.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelSize.Children.Add(txtCargoSize);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1015"), panelSize));

            TextBlock txtAirportIncome = UICreator.CreateTextBlock(new ValueCurrencyConverter().Convert(this.Airport.Income).ToString());

            txtAirportIncome.Foreground = new ValueIsMinusConverter().Convert(this.Airport.Income) as Brush;

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1023"), txtAirportIncome));

            WrapPanel panelTerminals = new WrapPanel();

            Image imgMapOverview = new Image();

            imgMapOverview.Source     = new BitmapImage(new Uri(@"/Data/images/info.png", UriKind.RelativeOrAbsolute));
            imgMapOverview.Height     = 16;
            imgMapOverview.MouseDown += new MouseButtonEventHandler(imgMapOverview_MouseDown);
            RenderOptions.SetBitmapScalingMode(imgMapOverview, BitmapScalingMode.HighQuality);

            imgMapOverview.Margin     = new Thickness(5, 0, 0, 0);
            imgMapOverview.Visibility = this.Airport.Profile.Map != null ? Visibility.Visible : System.Windows.Visibility.Collapsed;

            panelTerminals.Children.Add(UICreator.CreateTextBlock(string.Format("{0} ({1} {2})", this.Airport.Terminals.getNumberOfGates(), this.Airport.Terminals.getNumberOfAirportTerminals(), Translator.GetInstance().GetString("PageAirport", "1018"))));

            panelTerminals.Children.Add(imgMapOverview);

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1016"), panelTerminals));

            lbQuickInfo.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageAirport", "1017"), UICreator.CreateTextBlock(this.Airport.Runways.Count.ToString())));

            return(scroller);
        }
Exemple #54
0
        private void ChangeMenu(Food f)
        {
            ScrollViewer viewer = new ScrollViewer();

            viewer.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            Grid grid = new Grid();

            grid.Tag        = f.Name;
            grid.Height     = 100;
            grid.Background = new SolidColorBrush(Colors.AntiqueWhite);
            grid.MouseDown += new MouseButtonEventHandler(FoodClick);

            ColumnDefinition gridCol1 = new ColumnDefinition();
            ColumnDefinition gridCol2 = new ColumnDefinition();

            gridCol1.Width = new GridLength(100, GridUnitType.Pixel);
            gridCol2.Width = new GridLength(525, GridUnitType.Pixel);
            grid.ColumnDefinitions.Add(gridCol1);
            grid.ColumnDefinitions.Add(gridCol2);

            Image image = new Image
            {
                Source = new BitmapImage(new Uri(f.Img, UriKind.RelativeOrAbsolute))
            };

            image.Stretch = Stretch.Fill;
            Grid.SetColumn(image, 0);
            grid.Children.Add(image);

            DockPanel dp = new DockPanel();

            TextBlock price = new TextBlock
            {
                Text  = f.Price.ToString(),
                Width = 30
            };

            DockPanel.SetDock(price, Dock.Right);
            dp.Children.Add(price);

            TextBlock name = new TextBlock
            {
                Text = f.Name
            };

            name.TextAlignment = TextAlignment.Left;
            DockPanel.SetDock(name, Dock.Top);
            dp.Children.Add(name);

            TextBlock category = new TextBlock
            {
                Text = f.SubCtgr.ToString()
            };

            category.TextAlignment = TextAlignment.Left;
            DockPanel.SetDock(category, Dock.Top);
            dp.Children.Add(category);

            TextBlock desc = new TextBlock
            {
                Text = f.Description
            };

            desc.TextAlignment = TextAlignment.Left;
            dp.Children.Add(desc);

            Grid.SetColumn(dp, 1);
            grid.Children.Add(dp);

            grids.Add(grid);

            Menu.Children.Add(grid);
        }
        //private void btnLoadRoute_Click(object sender, EventArgs e)
        //{
        //    if (MapGis.RouteList.Count == 0)
        //    {
        //        DataTable stationposition = dpicbll.GetStationPositionByFileID(this.FileID);
        //        DataTable routedt = dpicbll.GetRouteInfoPositionByFileID(this.FileID);
        //        if (routedt.Rows.Count > 0)
        //        {
        //            this.MapGis.ClareRouteModelList();
        //            this.MapGis.ClearAllStation();
        //            for (int i = 0; i < stationposition.Rows.Count; i++)
        //            {
        //                string stationname = stationposition.Rows[i][0].ToString();
        //                PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString()));
        //                MapGis.AddConfigStation(stationname, p);
        //            }
        //            for (int i = 0; i < routedt.Rows.Count; i++)
        //            {
        //                if (i % 2 != 0)
        //                {
        //                    ZzhaControlLibrary.RouteModel rm = new RouteModel();
        //                    string from = routedt.Rows[i][0].ToString();
        //                    string[] fromxy = from.Split(',');
        //                    rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1]));
        //                    string to = routedt.Rows[i][1].ToString();
        //                    string[] toxy = to.Split(',');
        //                    rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1]));
        //                    rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString());
        //                    MapGis.AddConfigRouteModel(rm);
        //                }
        //            }
        //            MapGis.FlashAll();
        //            this.btnCreate.Enabled = true;
        //            this.btnLoadRoute.Enabled = false;
        //        }
        //        else
        //        {
        //            MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK);
        //        }
        //    }
        //}

        private void btnComplete_Click(object sender, EventArgs e)
        {

            btnSave_Click(sender, e);
            if (IsSuccessful)
            {
                btnCreate_Click(sender, e);
                A_DPic_DivConfig DivConfig = new A_DPic_DivConfig(treeNode, Convert.ToDouble(500), Convert.ToDouble(20000), frmMain.ConfigXml, treeView, frmMain);

                DivConfig.btnSelectAll_Click(sender, e);
                DivConfig.btnSave_Click(sender, e);
                if (!DivConfig.IsSuccessful)
                {
                    return;
                }

                DivConfig.btnClose_Click(sender, e);
                frmMain.FileID = FileID;
                frmMain.NowBtn = new Button();
                frmMain.NowBtn.Text = "新建图形";
                frmMain.btnSaveConfig_Click(sender, e);
                //frmMain.FrmCreateConfig_Load(sender, e);
                dockp = frmMain.Dockpanel;
                frmMain.Close();

                //A_FrmDCreateConfig frmCreateConfig = new A_FrmDCreateConfig();

                //frmCreateConfig.Show(dockp, DockState.Document);

                this.Close();
            }
            else
            {
                MessageBox.Show("保存失败!");
            }

            
        }
        public WebPage(TabControl addTo, Dictionary <string, string> favourites, string startWebSite = "http://www.google.com")
        {
            // Setting up favourite pages

            _favouritePages = favourites;

            // Adding tabControl reference

            _tabControl = addTo;

            // Forming panels

            DockPanel newPage = new DockPanel();

            _formPage          = new DockPanel();
            _formPage.MinWidth = 300;
            _formPage.Margin   = new Thickness(5);

            // Adding buttons for upper menu

            _formPage.Children.Add(new Button());
            _formPage.Children.Add(new Button());
            _formPage.Children.Add(new Button());
            _formPage.Children.Add(new Button());
            _formPage.Children.Add(new Button());
            _formPage.Children.Add(new Button());

            _textUrl = new TextBox();
            _formPage.Children.Add(_textUrl);

            int width  = 20;
            int height = 20;

            (_formPage.Children[0] as Button).Margin     = new Thickness(3);
            (_formPage.Children[0] as Button).Click     += buttonClose_Click;
            (_formPage.Children[0] as Button).Background = new ImageBrush(new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/SimpleWeb;component/Resources/Undo.png")));
            DockPanel.SetDock(_formPage.Children[1], Dock.Left);

            (_formPage.Children[2] as Button).Margin     = new Thickness(5);
            (_formPage.Children[2] as Button).Click     += buttonRedo_Click;
            (_formPage.Children[2] as Button).Background = new ImageBrush(new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/SimpleWeb;component/Resources/Home.png")));
            DockPanel.SetDock(_formPage.Children[3], Dock.Left);

            (_formPage.Children[4] as Button).Margin     = new Thickness(5);
            (_formPage.Children[4] as Button).Click     += buttonFavourite_Click;
            (_formPage.Children[4] as Button).Background = new ImageBrush(new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/SimpleWeb;component/Resources/Refr.png")));
            DockPanel.SetDock(_formPage.Children[5], Dock.Left);

            for (int i = 0; i < 6; i++)
            {
                (_formPage.Children[i] as Button).Width  = width;
                (_formPage.Children[i] as Button).Height = height;
            }


            (_formPage.Children[0] as Button).Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));

            (_formPage.Children[4] as Button).Foreground = new SolidColorBrush(Color.FromRgb(255, 210, 0));

            (_formPage.Children[6] as TextBox).Margin           = new Thickness(5);
            (_formPage.Children[6] as TextBox).Text             = startWebSite;
            (_formPage.Children[6] as TextBox).KeyUp           += txtUrl_KeyUp;
            (_formPage.Children[6] as TextBox).MouseEnter      += txtUrl_MouseEnter;
            (_formPage.Children[6] as TextBox).GotMouseCapture += txtUrl_GotMouseCapture;
            DockPanel.SetDock(_formPage.Children[6], Dock.Right);

            DockPanel.SetDock(_formPage, Dock.Top);

            newPage.Children.Add(_formPage);

            // Border setup

            Border bord = new Border();

            bord.Background      = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            bord.BorderThickness = new Thickness(10);
            DockPanel.SetDock(bord, Dock.Top);

            newPage.Children.Add(bord);

            // Web browser setup

            _webComp = new WebBrowser();
            newPage.Children.Add(_webComp);

            (newPage.Children[2] as WebBrowser).Source     = new Uri(startWebSite);
            (newPage.Children[2] as WebBrowser).Navigated += WebBrowser_Navigated;

            // Tab item to add
            _tabItem = new TabItem();

            _tabItem.Content = newPage;

            addTo.Items.Insert(addTo.Items.Count - 1, _tabItem);
        }
Exemple #57
0
        public Manager( DockPanel dockPanel )
        {
            this.dockPanel = dockPanel;
            dataSourceMap = new DataSourceMap();

            DockPanel.ActivePaneChanged += new EventHandler( form_GotFocus );

            spectrumProcessingForm = new SpectrumProcessingForm();
            spectrumProcessingForm.ProcessingChanged += new EventHandler( spectrumProcessingForm_ProcessingChanged );
            //spectrumProcessingForm.GlobalProcessingOverrideButton.Click += new EventHandler( processingOverrideButton_Click );
            //spectrumProcessingForm.RunProcessingOverrideButton.Click += new EventHandler( processingOverrideButton_Click );
            spectrumProcessingForm.GotFocus += new EventHandler( form_GotFocus );
            spectrumProcessingForm.HideOnClose = true;

            spectrumAnnotationForm = new SpectrumAnnotationForm();
            spectrumAnnotationForm.AnnotationChanged += new EventHandler( spectrumAnnotationForm_AnnotationChanged );
            spectrumAnnotationForm.GotFocus += new EventHandler( form_GotFocus );
            spectrumAnnotationForm.HideOnClose = true;

            spectrumGlobalDataProcessing = new DataProcessing();

            ShowChromatogramListForNewSources = true;
            ShowSpectrumListForNewSources = true;

            OpenFileUsesCurrentGraphForm = false;
            OpenFileGivesFocus = true;

            LoadDefaultAnnotationSettings();
        }
Exemple #58
0
        private void navView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (navView.SelectedItem == null)
            {
                return;
            }
            TreeViewItem tvi = (TreeViewItem)navView.SelectedItem;

            if (tvi.Tag == null || tvi.Tag.ToString().Contains(".vsd") == false)
            {
                return;
            }
            StackPanel panel  = (StackPanel)tvi.Header;
            TextBlock  tbk    = (TextBlock)panel.Children[1];
            string     header = tbk.Text;
            string     name   = header;
            bool       isopen = false;

            foreach (object o in mainTab.Items)
            {
                TabItem item = o as TabItem;
                if (item != null)
                {
                    if (item.Header.ToString().CompareTo(header) == 0)
                    {
                        isopen = true;
                        mainTab.SelectedItem = item;
                        curvisio             = name + "1";
                        break;
                    }
                }
            }

            if (!isopen)
            {
                TabItem ti = new TabItem();
                ti.Header = header;
                ti.Tag    = tvi.Tag;
                DockPanel sp = new DockPanel();
                sp.Margin = new Thickness(0, 0, 0, 0);
                //sp.Orientation = Orientation.Vertical;
                ti.Content = sp;
                string vsdFile = ti.Tag.ToString();
                try
                {
                    if (tvi.Tag != null)
                    {
                        string vname = tvi.Tag.ToString();
                        ti.Tag = vname;
                        try
                        {
                            VisioDrawing v = new VisioDrawing();

                            string        dir     = System.IO.Path.GetDirectoryName(vsdFile);
                            DirectoryInfo dirInfo = new DirectoryInfo(dir);

                            v.dbFile = dir + @"\" + dirInfo.Name + ".accdb";
                            ((System.ComponentModel.ISupportInitialize)v).BeginInit();
                            sp.Children.Add(v);
                            ((System.ComponentModel.ISupportInitialize)v).EndInit();
                            curvisio = name + "1";
                            if (FindName(curvisio) == null)
                            {
                                RegisterName(curvisio, v);
                            }
                            closeSharedFile(vname);
                            v.vName = vname;
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }
                    mainTab.Items.Add(ti);
                    mainTab.SelectedItem = ti;
                }
                catch (Exception ex2)
                {
                    MessageBox.Show(ex2.ToString());
                }
            }
            if (this.centerdockpanel.Visibility != Visibility.Visible)
            {
                centerdockpanel.Visibility = Visibility.Visible;
            }
        }
Exemple #59
0
        private GridControl GetGridControlFromPanel(DockPanel dockPanel, out System.Drawing.Rectangle rect)
        {
            GridControl retval = null;
            rect = new System.Drawing.Rectangle(0, 0, 10, 10);
            foreach (Control c in dockPanel.Controls)
            {
                if (c is ControlContainer)
                {
                    ControlContainer cc = (ControlContainer)c;
                    foreach (Control c2 in cc.Controls)
                    {
                        if (c2 is T7.MapViewerEx)
                        {
                            MapViewerEx mapex = (MapViewerEx)c2;
                            foreach (Control c3 in mapex.Controls)
                            {
                                if (c3 is DevExpress.XtraEditors.GroupControl)
                                {
                                    DevExpress.XtraEditors.GroupControl gc = (DevExpress.XtraEditors.GroupControl)c3;
                                    foreach (Control c4 in gc.Controls)
                                    {
                                        if (c4 is System.Windows.Forms.SplitContainer)
                                        {
                                            System.Windows.Forms.SplitContainer sc = (System.Windows.Forms.SplitContainer)c4;
                                            foreach (Control c5 in sc.Panel1.Controls)
                                            {
                                                if (c5 is System.Windows.Forms.Panel)
                                                {
                                                    System.Windows.Forms.Panel pnl = (System.Windows.Forms.Panel)c5;
                                                    foreach (Control c6 in pnl.Controls)
                                                    {
                                                        if (c6 is DevExpress.XtraGrid.GridControl)
                                                        {
                                                            retval = (DevExpress.XtraGrid.GridControl)c6;
                                                            rect = new System.Drawing.Rectangle(retval.Left + cc.Left + mapex.Left + gc.Left + sc.Left + pnl.Left, retval.Top + cc.Top + mapex.Top + gc.Top + sc.Top + pnl.Top, retval.Width, retval.Height);
                                                        }
                                                    }
                                                }

                                            }
                                            foreach (Control c5 in sc.Panel2.Controls)
                                            {
                                                if (c5 is System.Windows.Forms.Panel)
                                                {
                                                    System.Windows.Forms.Panel pnl = (System.Windows.Forms.Panel)c5;
                                                    foreach (Control c6 in pnl.Controls)
                                                    {
                                                        logger.Debug("MapViewerEx:GroupControl:SplitContainer.Panel2.Panel:" + c6.GetType().ToString());
                                                    }
                                                }
                                            }
                                        }

                                    }
                                }

                            }
                        }
                        else if (c2 is T7.MapViewer)
                        {
                            MapViewer map = (MapViewer)c2;
                            foreach (Control c3 in map.Controls)
                            {
                                DevExpress.XtraEditors.GroupControl gc = (DevExpress.XtraEditors.GroupControl)c3;
                                foreach (Control c4 in gc.Controls)
                                {
                                    if (c4 is System.Windows.Forms.SplitContainer)
                                    {
                                        System.Windows.Forms.SplitContainer sc = (System.Windows.Forms.SplitContainer)c4;
                                        foreach (Control c5 in sc.Panel1.Controls)
                                        {
                                            if (c5 is System.Windows.Forms.Panel)
                                            {
                                                System.Windows.Forms.Panel pnl = (System.Windows.Forms.Panel)c5;
                                                foreach (Control c6 in pnl.Controls)
                                                {
                                                    if (c6 is DevExpress.XtraGrid.GridControl)
                                                    {
                                                        retval = (DevExpress.XtraGrid.GridControl)c6;
                                                        rect = new System.Drawing.Rectangle(retval.Left + cc.Left + map.Left + gc.Left + sc.Left + pnl.Left, retval.Top + cc.Top + map.Top + gc.Top + sc.Top + pnl.Top, retval.Width, retval.Height);
                                                    }
                                                }
                                            }

                                        }
                                        foreach (Control c5 in sc.Panel2.Controls)
                                        {
                                            if (c5 is System.Windows.Forms.Panel)
                                            {
                                                System.Windows.Forms.Panel pnl = (System.Windows.Forms.Panel)c5;
                                                foreach (Control c6 in pnl.Controls)
                                                {
                                                    logger.Debug("MapViewer:GroupControl:SplitContainer.Panel2.Panel:" + c6.GetType().ToString());
                                                }
                                            }
                                        }
                                    }

                                }
                            }

                        }
                        else if (c2 is T7.ctrlAirmassResult)
                        {
                            ctrlAirmassResult airmass = (ctrlAirmassResult)c2;
                            foreach (Control c3 in airmass.Controls)
                            {
                                if (c3 is DevExpress.XtraTab.XtraTabControl)
                                {
                                    DevExpress.XtraTab.XtraTabControl tabctrl = (DevExpress.XtraTab.XtraTabControl)c3;
                                    foreach (Control c4 in tabctrl.SelectedTabPage.Controls)
                                    {
                                        //DevExpress.XtraGrid.GridControl
                                        if (c4 is DevExpress.XtraGrid.GridControl)
                                        {
                                            retval = (DevExpress.XtraGrid.GridControl)c4;
                                            rect = new System.Drawing.Rectangle(retval.Left + cc.Left + airmass.Left + tabctrl.Left + tabctrl.SelectedTabPage.Left, retval.Top + cc.Top + airmass.Top + tabctrl.Top + tabctrl.SelectedTabPage.Top, retval.Width, retval.Height);

                                        }
                                        else
                                        {
                                            logger.Debug("ctrlAirmassResult:XtraTab:" + c4.GetType().ToString());
                                        }
                                    }
                                }

                            }
                        }
                        else if (c2 is DevExpress.XtraGrid.GridControl)
                        {
                            retval = (DevExpress.XtraGrid.GridControl)c2;
                            rect = new System.Drawing.Rectangle(retval.Left + cc.Left, retval.Top + cc.Top, retval.Width, retval.Height);

                        }
                        else
                        {
                            logger.Debug("Unsupported screenshot control: " + c2.GetType().ToString());
                        }
                    }

                }
            }
            return retval;
        }
Exemple #60
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="dockPanel">Parent dock panel</param>
 /// <param name="child">First child</param>
 public GridLayout(DockPanel dockPanel, IDockLayout child)
     : this(dockPanel)
 {
     AddFirstChild(child);
 }