Пример #1
0
        void Init()
        {
            //_buttonConnect
            _buttonConnect = new Button { Text = StrRes.GetString("StrConnect","Connect"), Image = Icons.ConnectIcon };
            _buttonConnect.Click += ButtonConnect_Click;

            //_buttonDisconnect
            _buttonDisconnect = new Button { Text = StrRes.GetString("StrDisconnect","Disconnect"), Image = Icons.DisconnectIcon };
            _buttonDisconnect.Click += _buttonDisconnect_Click;

            //_dropDownDbs
            _dropDownDbs = new DropDown {Width = 200};

            //_buttonRunScript
            _buttonRunScript = new Button {Text = StrRes.GetString("StrExecute","Execute"), Image = Icons.RunScripIcon};
            _buttonRunScript.Click += _buttonRunScript_Click;

            //_itemSaveAsCsv
            _itemSaveAsCsv = new ButtonMenuItem { Text = StrRes.GetString("StrSaveAsCsv","SaveAs .Csv") };
            _itemSaveAsCsv.Click += _itemSaveAsCsv_Click;

            //_itemViewTable
            _itemViewTable = new ButtonMenuItem { Text = StrRes.GetString("StrViewTable","ViewTable") };
            _itemViewTable.Click += _itemViewTable_Click;
            _itemViewTable.Enabled = false;

            //_itemCopyName
            _itemCopyName = new ButtonMenuItem { Text = StrRes.GetString("StrCopyName","CopyName") };
            _itemCopyName.Click += _itemCopyName_Click;

            //_menuDbView
            _menuDbView = new ContextMenu();
            _menuDbView.Items.Add(_itemCopyName);
            _menuDbView.Items.Add(_itemViewTable);

            //_menuResultView
            _menuResultView = new ContextMenu();
            _menuResultView.Items.Add(_itemSaveAsCsv);

            //_treeViewDbs
            _treeViewDbs = new TreeView();
            _treeViewDbs.ContextMenu = _menuDbView;
            _treeViewDbs.SelectionChanged += _treeViewDbs_SelectionChanged;
            _treeViewDbs.Activated += _treeViewDbs_Activated;
            _treeViewDbs.MouseUp += (sender, e) =>
            {
                if (e.Buttons == MouseButtons.Alternate)
                {
                    _treeViewDbs.ContextMenu.Show(_treeViewDbs);
                }
            };

            //_textAreaSql
            _textAreaSql = new TextArea {Font = new Font(FontFamilies.Sans, 12, FontStyle.Bold | FontStyle.Italic)};

            //_gridViewResult
            _gridViewResult = new GridView();
            _gridViewResult.ContextMenu = _menuResultView;
            _gridViewResult.Style = "GridViewResult";
            _gridViewResult.MouseUp += (sender, e) =>
            {
                if (e.Buttons == MouseButtons.Alternate)
                {
                    _gridViewResult.ContextMenu.Show(_treeViewDbs);
                }
            };

            //topLayout
            var topLayout = new DynamicLayout();
            topLayout.BeginHorizontal();
            topLayout.AddCentered(_buttonConnect, horizontalCenter: false);
            topLayout.AddCentered(_buttonDisconnect, horizontalCenter: false);
            topLayout.AddCentered(_dropDownDbs, horizontalCenter: false);
            topLayout.AddCentered(_buttonRunScript, horizontalCenter: false);
            topLayout.Add(null);
            topLayout.EndVertical();

            //rightPanel
            var rightPanel = new Splitter
            {
                Panel1 = _textAreaSql,
                Panel2 = _gridViewResult,
                Orientation = SplitterOrientation.Vertical,
                Position = 100
            };

            //mainLayout
            var mainLayout = new Splitter
            {
                Panel1 = _treeViewDbs,
                Panel2 = rightPanel,
                Orientation = SplitterOrientation.Horizontal,
                Position = 200
            };

            //layout
            var layout = new DynamicLayout { Padding = new Padding(0, 0), Spacing = new Size(5, 5) };
            layout.AddRow(topLayout);
            layout.AddRow(mainLayout);
            Content = layout;
        }
Пример #2
0
			/// <summary>
			/// Raises the click event.
			/// </summary>
			public void OnClick(MenuItem widget, EventArgs e)
			{
				widget.Platform.Invoke(() => widget.OnClick(e));
			}
Пример #3
0
			/// <summary>
			/// Raises the validate event.
			/// </summary>
			public void OnValidate(MenuItem widget, EventArgs e)
			{
				widget.Platform.Invoke(() => widget.OnValidate(e));
			}
Пример #4
0
		void LogClickEvents(MenuItem item)
		{
			LogEvents(item as ISubmenu);
			LogEvents(item as CheckMenuItem);
			LogEvents(item as RadioMenuItem);
			item.Click += delegate
			{
				Log.Write(item, "Click, Item: {0}", item.Text);
			};
		}