コード例 #1
1
ファイル: ChannelListDialog.cs プロジェクト: neiz/JabbR.Eto
		public ChannelListDialog (Server server)
		{
			this.ClientSize = new Size (600, 400);
			this.Resizable = true;
			this.Title = "Channel List";
			
			grid = new GridView {
				AllowMultipleSelection = false
			};
			grid.MouseDoubleClick += HandleMouseDoubleClick;
			grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("Name"), HeaderText = "Channel", Width = 150, AutoSize = false });
			grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false });
			grid.Columns.Add (new GridColumn { DataCell = new TextBoxCell ("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false });
			
			var layout = new DynamicLayout (this);
			
			layout.Add (grid, yscale: true);
			layout.BeginVertical ();
			layout.AddRow (null, this.CancelButton (), this.OkButton ("Join Channel", CanJoin));
			layout.EndVertical ();
			
			var channelTask = server.GetChannelList ();
			channelTask.ContinueWith (task => {
				Application.Instance.AsyncInvoke (delegate {
					grid.DataStore = new GridItemCollection (task.Result.OrderBy (r => r.Name).OrderByDescending (r => r.UserCount));
				});
			}, System.Threading.Tasks.TaskContinuationOptions.OnlyOnRanToCompletion);
		}
コード例 #2
0
ファイル: GridViewSection.cs プロジェクト: M1C/Eto
        GridView Default()
        {
            var control = new GridView {
                Size = new Size (300, 100)
            };
            LogEvents (control);

            var dropDown = MyDropDown ();
            control.Columns.Add (new GridColumn{ DataCell = new CheckBoxCell (), Editable = true, AutoSize = true, Resizable = false});
            control.Columns.Add (new GridColumn{ HeaderText = "Image", DataCell = new ImageCell () });
            control.Columns.Add (new GridColumn{ HeaderText = "Text", Editable = true});
            control.Columns.Add (new GridColumn{ HeaderText = "Drop Down", DataCell = dropDown, Editable = true });

            var image1 = Bitmap.FromResource ("Eto.Test.TestImage.png");
            var image2 = Icon.FromResource ("Eto.Test.TestIcon.ico");
            var items = new GridItemCollection ();
            var rand = new Random ();
            for (int i = 0; i < 10000; i++) {
                var val = rand.Next (3);
                var boolVal = val == 0 ? (bool?)false : val == 1 ? (bool?)true : null;

                val = rand.Next (3);
                var image = val == 0 ? (Image)image1 : val == 1 ? (Image)image2 : null;

                var txt = string.Format ("Col 1 Row {0}", i);

                val = rand.Next (dropDown.DataStore.Count + 1);
                var combo = val == 0 ? null : dropDown.DataStore [val - 1].Key;

                items.Add (new LogGridItem (boolVal, image, txt, combo){ Row = i });
            }
            control.DataStore = items;

            return control;
        }
コード例 #3
0
		public ChildWidthSection()
			: base(1, 3)
		{
			var table = new GridView();
			table.Columns.Add(new GridColumn { AutoSize = false, Width = 1000, HeaderText = "Title", DataCell = new TextBoxCell("FormattedTitle"), Editable = false, Sortable = true });

			this.Add(new TextBox { Text = "This is a textbox" }, 0, 0);
			this.Add(new Label { Text = "This is a label" }, 0, 1);
			this.Add(table, 0, 2);
		}
コード例 #4
0
		void Init()
		{
			//_contextMenuRightMenu
			_contextMenuRightMenu = new ContextMenu();
			var addItem = new ButtonMenuItem {Text = "Add"};
			addItem.Click += addItem_Click;
			var delItem = new ButtonMenuItem {Text = "Delete"};
			delItem.Click += delItem_Click;
			_contextMenuRightMenu.Items.Add(addItem);
			_contextMenuRightMenu.Items.Add(delItem);

			//_gridViewHeader
			_gridViewHeader = new GridView
			{
				AllowMultipleSelection = false,
				BackgroundColor = Colors.White,
				Size = new Size(200, 200),
				ShowCellBorders = true
			};
			//_gridViewHeader.CellEditing += _gridViewHeader_CellEditing;
			//_gridViewHeader.CellEdited += _gridViewHeader_CellEdited;

			_gridViewHeader.Columns.Add(new GridColumn
			{
				HeaderText = "Key",
				DataCell = new TextBoxCell("Key"),
				Editable = true,
				Sortable = true,
				AutoSize = true
			});
			_gridViewHeader.Columns.Add(new GridColumn
			{
				HeaderText = "Value",
				DataCell = new TextBoxCell("Value"),
				Editable = true,
				Sortable = true,
				AutoSize = false,
				Width = 200
			});
			_gridViewHeader.ContextMenu = _contextMenuRightMenu;
			_gridViewHeader.MouseUp += (sender, e) =>
			{
				if (e.Buttons == MouseButtons.Alternate)
				{
					if (_gridViewHeader.ContextMenu != null)
						_gridViewHeader.ContextMenu.Show(this);
				}
			};

			var layout = new DynamicLayout { Padding = new Padding(20, 20), Spacing = new Size(10, 10) };
			layout.AddRow(_gridViewHeader);
			layout.Add(null);

			this.Content = layout;
		}
コード例 #5
0
		protected override void LogEvents (GridView control)
		{
			control.RowHeight = 36;
			var font = Fonts.Serif (18, FontStyle.Italic);
			control.CellFormatting += (sender, e) => {
				// Log.Write (control, "Formatting Row: {1}, Column: {2}, Item: {0}", e.Item, e.Row, control.Columns.IndexOf (e.Column));
				e.Font = font;
				e.BackgroundColor = Colors.Blue;
				e.ForegroundColor = Colors.Lime;
			};
		}
コード例 #6
0
ファイル: GridViewSelectionTests.cs プロジェクト: Exe0/Eto
		public void Setup()
		{
			Application.Instance.Invoke(() =>
			{
				grid = new GridView();
				handler = (IGridView)grid.Handler;
				model = GridViewUtils.CreateModel();
				grid.DataStore = model;
				grid.SelectionChanged += (s, e) => selectionChangedCount++;
			});
		}
コード例 #7
0
ファイル: GridViewSection.cs プロジェクト: M1C/Eto
 void LogEvents(GridView control)
 {
     control.BeginCellEdit += (sender, e) => {
         Log.Write (control, "BeginCellEdit, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
     };
     control.EndCellEdit += (sender, e) => {
         Log.Write (control, "EndCellEdit, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
     };
     control.SelectionChanged += delegate {
         Log.Write (control, "Selection Changed, Rows: {0}", SelectedRowsString (control));
     };
 }
コード例 #8
0
ファイル: GridViewSelectTests.cs プロジェクト: mhusen/Eto
		public void Setup()
		{
			TestUtils.Invoke(() =>
			{
				grid = new GridView();
				// Some platforms need at least one column for selection to work
				grid.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Id") });
				model = GridViewUtils.CreateModel();
				grid.DataStore = model;
				grid.SelectionChanged += (s, e) => selectionChangedCount++;
				selectionChangedCount = 0;
			});
		}
コード例 #9
0
ファイル: DeviceAlarmsTab.cs プロジェクト: LorenVS/bacstack
            /// <summary>
            /// Constructs a new device info tab panel
            /// </summary>
            /// <param name="device">The device to show information for</param>
            public Panel(ObjectInfo device)
            {
                this._device = device;
                var layout = new DynamicLayout();
                this.Content = layout;

                _gridView = new GridView();
                layout.AddRow(_gridView);
                _gridView.Columns.Add(new GridColumn()
                {
                    HeaderText = "State",
                    DataCell = new TextBoxCell("AlarmState")
                });

                layout.AddRow();
            }
コード例 #10
0
        public TransactionsView()
        {
            Spacing = Utilities.Spacing3;

            GridViewTransactions = Utilities.CreateGridView(
                DataSourceAccountTransactions,
                new GridColumn {
                    DataCell = new TextBoxCell { Binding = Binding.Delegate<Transaction, string>(o => o.Number.ToString(Utilities.InvariantCulture)) },
                    HeaderText = "#"
                },
                new GridColumn {
                    DataCell = new TextBoxCell { Binding = Binding.Delegate<Transaction, string>(o => MoneroAPI.Utilities.CoinAtomicValueToString(o.AmountSpendable)) },
                    HeaderText = "Spendable" // TODO: Localization
                },
                new GridColumn {
                    DataCell = new TextBoxCell { Binding = Binding.Delegate<Transaction, string>(o => MoneroAPI.Utilities.CoinAtomicValueToString(o.AmountUnspendable)) },
                    HeaderText = "Not spendable" // TODO: Localization
                },
                new GridColumn {
                    DataCell = new TextBoxCell { Binding = Binding.Property<Transaction, string>(o => o.TransactionId) },
                    HeaderText = Desktop.Properties.Resources.TransactionsTransactionId
                }
            );

            Rows.Add(
                new TableRow(
                    GridViewTransactions
                ) { ScaleHeight = true }
            );

            Rows.Add(
                new TableLayout(
                    new TableRow(
                        new TableCell { ScaleWidth = true },

                        new TableCell(
                            Utilities.CreateButton(() =>
                                Desktop.Properties.Resources.TextExport,
                                null,
                                Utilities.LoadImage("Export"),
                                OnButtonExportClick
                            )
                        )
                    )
                )
            );
        }
コード例 #11
0
ファイル: GridViewFilterTests.cs プロジェクト: mhusen/Eto
		public void Setup()
		{
			TestUtils.Invoke(() =>
			{
				grid = new GridView();
				// Some platforms need at least one column for selection to work
				grid.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Id") });
				model = GridViewUtils.CreateModel();

				// create our filtered collection
				filtered = new FilterCollection<DataItem>(model);
				filtered.Change = () => grid.SelectionPreserver;
				grid.DataStore = filtered;
				grid.SelectionChanged += (s, e) => selectionChangedCount++;
				selectionChangedCount = 0;
			});
		}
コード例 #12
0
ファイル: RouterSettings.cs プロジェクト: LorenVS/bacstack
        public RouterSettings(RouterProcess process)
        {
            _process = process;

            _name = new TextBox();
            _name.Bind(
                tb => tb.Text,
                _process,
                proc => proc.Name,
                DualBindingMode.TwoWay);

            _processId = new NumericUpDown();
            _processId.Bind(
                nud => nud.Value,
                _process,
                proc => proc.ProcessId,
                DualBindingMode.TwoWay);

            this.BeginVertical();
            this.AddRow(new Label() { Text = Constants.ProcessNameLabel }, _name);
            this.AddRow(new Label() { Text = Constants.ProcessIdLabel }, _processId);
            this.EndVertical();

            GridView gv = new GridView();
            gv.DataStore = process.PortMappings;

            gv.Columns.Add(new GridColumn()
            {
                HeaderText = "Port Id",
                DataCell = new TextBoxCell("PortId"),
                Editable = true
            });
            gv.Columns.Add(new GridColumn()
            {
                HeaderText = "Network Number",
                DataCell = new TextBoxCell("Network"),
                Editable = true
            });

            this.BeginVertical();
            this.AddRow(gv);
            this.EndVertical();

            this.AddRow();
        }
コード例 #13
0
ファイル: GridViewSection.cs プロジェクト: mhusen/Eto
		StackLayout CreateOptions(GridView grid, SelectableFilterCollection<MyGridItem> filtered)
		{
			return new StackLayout
			{
				Spacing = 5,
				HorizontalContentAlignment = HorizontalAlignment.Stretch,
				Items =
				{
					new StackLayout
					{
						Orientation = Orientation.Horizontal,
						Spacing = 5,
						Items =
						{
							null,
							EnabledCheckBox(grid),
							EditableCheckBox(grid),
							AllowMultiSelectCheckBox(grid),
							ShowHeaderCheckBox(grid),
							GridLinesDropDown(grid),
							null
						}
					},
					new StackLayout 
					{
						Orientation = Orientation.Horizontal,
						Spacing = 5,
						Items =
						{
							null,
							AddItemButton(filtered),
							CreateScrollToRow(grid),
							CreateBeginEditButton(grid),
							null
						}
					},
					CreateSearchBox(filtered)
				}
			};
		}
コード例 #14
0
        public ChannelListDialog(Server server)
        {
            this.ClientSize = new Size(600, 400);
            this.Resizable = true;
            this.Title = "Channel List";
            this.server = server;
            
            grid = new GridView { AllowMultipleSelection = false };
            grid.MouseDoubleClick += HandleMouseDoubleClick;
            grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Name"), HeaderText = "Channel", Width = 150, AutoSize = false });
            grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("UserCount"), HeaderText = "Users", Width = 60, AutoSize = false });
            grid.Columns.Add(new GridColumn { DataCell = new TextBoxCell ("Topic"), HeaderText = "Topic", Width = 350, AutoSize = false });
            
            var layout = new DynamicLayout();
            
            layout.Add(grid, yscale: true);
            layout.BeginVertical();
            layout.AddRow(null, this.CancelButton(), this.OkButton("Join Channel", CanJoin));
            layout.EndVertical();

            Content = layout;
        }
コード例 #15
0
ファイル: GridViewTests.cs プロジェクト: Exe0/Eto
		public void GridView_SetSortBeforeDataStore_NoException()
		{
			var g = new GridView();
			g.SortComparer = GridViewUtils.SortItemsAscending;
			g.DataStore = GridViewUtils.CreateModel();
		}
コード例 #16
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Button CreateScrollToRow(GridView grid)
		{
			var control = new Button { Text = "ScrollToRow" };
			control.Click += (sender, e) =>
			{
				var row = new Random().Next(((ICollection)grid.DataStore).Count - 1);
				Log.Write(grid, "ScrollToRow: {0}", row);
				grid.ScrollToRow(row);
			};
			return control;
		}
コード例 #17
0
ファイル: GridViewTests.cs プロジェクト: Exe0/Eto
		public void GridView_SetFilterBeforeDataStore_NoException()
		{
			var g = new GridView();
			g.Filter = GridViewUtils.KeepOddItemsFilter; 
			g.DataStore = GridViewUtils.CreateModel();
		}
コード例 #18
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		static string SelectedRowsString(GridView grid)
		{
			return string.Join(",", grid.SelectedRows.Select(r => r.ToString()).OrderBy(r => r));
		}
コード例 #19
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Button CreateBeginEditButton(GridView grid)
		{
			var control = new Button { Text = "Begin Edit Row:1, Column:2" };
			control.Click += (sender, e) => grid.BeginEdit(1, 2);
			return control;
		}
コード例 #20
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		ContextMenu CreateContextMenu(GridView grid, SelectableFilterCollection<MyGridItem> filtered)
		{
			// Context menu
			var menu = new ContextMenu();
			var item = new ButtonMenuItem { Text = "Click Me!" };
			item.Click += (sender, e) =>
			{
				if (grid.SelectedRows.Any())
					Log.Write(item, "Click, Rows: {0}", SelectedRowsString(grid));
				else
					Log.Write(item, "Click, no item selected");
			};
			menu.Items.Add(item);

			// Delete menu item: deletes the item from the store, the UI updates via the binding.
			var deleteItem = new ButtonMenuItem { Text = "Delete Item" };
			deleteItem.Click += (s, e) =>
			{
				var i = grid.SelectedItems.First() as MyGridItem;
				if (i != null)
					filtered.Remove(i);
			};
			menu.Items.Add(deleteItem);

			// Insert item: inserts an item into the store, the UI updates via the binding.
			var insertItem = new ButtonMenuItem { Text = "Insert Item at the start of the list" };
			insertItem.Click += (s, e) =>
			{
				var i = grid.SelectedItems.First() as MyGridItem;
				if (i != null)
					filtered.Insert(0, new MyGridItem(new Random(), 0));
			};
			menu.Items.Add(insertItem);

			var subMenu = menu.Items.GetSubmenu("Sub Menu");
			item = new ButtonMenuItem { Text = "Item 5" };
			item.Click += (s, e) => Log.Write(item, "Clicked");
			subMenu.Items.Add(item);
			item = new ButtonMenuItem { Text = "Item 6" };
			item.Click += (s, e) => Log.Write(item, "Clicked");
			subMenu.Items.Add(item);

			return menu;
		}
コード例 #21
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		protected virtual void LogEvents(GridView control)
		{
			control.CellEditing += (sender, e) => Log.Write(control, "BeginCellEdit, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
			control.CellEdited += (sender, e) => Log.Write(control, "EndCellEdit, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
			control.SelectionChanged += (sender, e) => Log.Write(control, "Selection Changed, Rows: {0}", SelectedRowsString(control));
			control.ColumnHeaderClick += (sender, e) => Log.Write(control, "Column Header Clicked: {0}", e.Column.HeaderText);
			control.CellClick += (sender, e) => Log.Write(control, "Cell Clicked, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
			control.CellDoubleClick += (sender, e) => Log.Write(control, "Cell Double Clicked, Row: {0}, Column: {1}, Item: {2}, ColInfo: {3}", e.Row, e.Column, e.Item, e.GridColumn);
		}
コード例 #22
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Control EditableCheckBox(GridView grid)
		{
			var control = new CheckBox { Text = "Editable" };
			control.CheckedBinding.Bind(() => grid.Columns.First().Editable, v =>
			{
				foreach (var col in grid.Columns)
				{
					col.Editable = v ?? false;
				}
			});
			return control;
		}
コード例 #23
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		GridView CreateGrid()
		{
			var control = new GridView
			{
				Size = new Size(300, 100)
			};
			LogEvents(control);

			var dropDown = MyDropDown("DropDownKey");
			control.Columns.Add(new GridColumn { DataCell = new CheckBoxCell("Check"), AutoSize = true, Resizable = false });
			control.Columns.Add(new GridColumn { HeaderText = "Image", DataCell = new ImageViewCell("Image") });
			control.Columns.Add(new GridColumn { HeaderText = "ImageText", DataCell = new ImageTextCell("Image", "Text") });
			control.Columns.Add(new GridColumn { HeaderText = "Text", DataCell = new TextBoxCell("Text"), Sortable = true });
			control.Columns.Add(new GridColumn { HeaderText = "Progress", DataCell = new ProgressCell("Progress") });
			control.Columns.Add(new GridColumn { HeaderText = "Drop Down", DataCell = dropDown, Sortable = true });

			if (Platform.Supports<DrawableCell>())
			{
				var drawableCell = new DrawableCell();
				drawableCell.Paint += (sender, e) =>
				{
					var m = e.Item as MyGridItem;
					if (m != null)
					{
						if (e.CellState.HasFlag(DrawableCellStates.Selected))
							e.Graphics.FillRectangle(Colors.Blue, e.ClipRectangle);
						else
							e.Graphics.FillRectangle(Brushes.Cached(m.Color), e.ClipRectangle);
						var rect = e.ClipRectangle;
						rect.Inflate(-5, -5);
						e.Graphics.DrawRectangle(Colors.White, rect);
						e.Graphics.DrawLine(Colors.White, rect.Left, rect.Bottom, rect.MiddleX, rect.Top);
						e.Graphics.DrawLine(Colors.White, rect.Right, rect.Bottom, rect.MiddleX, rect.Top);
					}
				};
				control.Columns.Add(new GridColumn
				{
					HeaderText = "Owner drawn",
					DataCell = drawableCell
				});
			}

			return control;
		}
コード例 #24
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Control GridLinesDropDown(GridView grid)
		{
			var control = new EnumDropDown<GridLines>();
			control.SelectedValueBinding.Bind(grid, r => r.GridLines);
			return new StackLayout
			{
				Orientation = Orientation.Horizontal,
				Spacing = 5,
				Items = { "GridLines", control }
			};
		}
コード例 #25
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Control EnabledCheckBox(GridView grid)
		{
			var control = new CheckBox { Text = "Enabled" };
			control.CheckedBinding.Bind(grid, r => r.Enabled);
			return control;
		}
コード例 #26
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Control ShowHeaderCheckBox(GridView grid)
		{
			var control = new CheckBox { Text = "ShowHeader" };
			control.CheckedBinding.Bind(grid, r => r.ShowHeader);
			return control;
		}
コード例 #27
0
ファイル: GridViewSection.cs プロジェクト: GilbertoBotaro/Eto
		Control AllowMultiSelectCheckBox(GridView grid)
		{
			var control = new CheckBox { Text = "AllowMultipleSelection" };
			control.CheckedBinding.Bind(grid, r => r.AllowMultipleSelection);
			return control;
		}
コード例 #28
0
ファイル: FindObject.cs プロジェクト: LorenVS/bacstack
            public FindObjectPanel()
            {
                _layout = new DynamicLayout();
                _search = new SearchBox();
                _search.PlaceholderText = Constants.ObjectNameSearchPlaceholder;
                _search.TextChanged += _searchChanged;
                _grid = new GridView();

                // helps drastically with layout performance,
                // specifically on WPF
                _grid.RowHeight = 19;

                _grid.AllowMultipleSelection = false;

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = "Device",
                    Editable = false,
                    Width = 100,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(oi => oi.DeviceInstance.ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectTypeHeaderText,
                    Editable = false,
                    Width = 100,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => ((ObjectType)oi.ObjectIdentifier.Type).ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectInstanceHeaderText,
                    Editable = false,
                    Width = 75,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => oi.ObjectIdentifier.Instance.ToString())
                    }
                });

                _grid.Columns.Add(new GridColumn()
                {
                    HeaderText = Constants.ObjectNameHeaderText,
                    Editable = false,
                    DataCell = new TextBoxCell()
                    {
                        Binding = new LambdaBinding<ObjectInfo, string>(
                            oi => oi.Name)
                    }
                });

                _grid.SelectedItemsChanged += delegate (object s, EventArgs e)
                {
                    var item = _grid.SelectedItem as ObjectInfo;
                    if (item != null)
                    {
                        var stack = MainForm.Current.Stack;
                        stack.PopUntil<FindObjectPanel>();
                        stack.Push(new ObjectPanel(item));
                    }
                };

                _layout.BeginVertical();
                _layout.AddRow(_search);
                _layout.AddRow(_grid);
                _layout.EndVertical();

                this.Content = _layout;
            }
コード例 #29
0
ファイル: PanelDbManager.UI.cs プロジェクト: SunHuawei/Altman
        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;
        }
コード例 #30
0
        void Init()
        {
            //page1
            var page1 = new DynamicLayout();
            _gridViewInstalled = new GridView();
            _gridViewInstalled.ColumnHeaderClick += _gridViewInstalled_ColumnHeaderClick;
            _gridViewInstalled.Columns.Add(new GridColumn()
            {
                DataCell = new CheckBoxCell("Checked"),
                HeaderText = StrRes.GetString("StrChecked","Checked"),
                Editable = true
            });
            _gridViewInstalled.Columns.Add(new GridColumn()
            {
                ID = "Name",
                DataCell = new TextBoxCell("Name"),
                HeaderText = StrRes.GetString("StrName", "Name"),
                Sortable = true,
                AutoSize = false,
                Width = 150
            });
            _gridViewInstalled.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("Author"),
                HeaderText = StrRes.GetString("StrAuthor","Author"),
                AutoSize = false,
                Width = 100
            });
            _gridViewInstalled.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("InstalledVersion"),
                HeaderText = StrRes.GetString("StrInstalledVersion","InstalledVersion"),
                AutoSize = false,
                Width = 150
            });
            _gridViewInstalled.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("FileName"),
                HeaderText = StrRes.GetString("StrFileName","FileName"),
                AutoSize = false,
                Width = 150
            });
            _gridViewInstalled.SelectionChanged += _gridViewInstalled_SelectionChanged;
            _textAreatInstalledDes = new TextArea();
            _buttonRemove = new Button {Text = StrRes.GetString("StrRemove","Remove")};
            _buttonRemove.Click += _buttonRemove_Click;
            page1.Add(_gridViewInstalled, true, true);
            page1.Add(_textAreatInstalledDes, true, false);
            page1.AddSeparateRow(null, _buttonRemove);

            //page2
            var page2 = new DynamicLayout();
            _gridViewAvailable = new GridView();
            _gridViewAvailable.ColumnHeaderClick += _gridViewAvailable_ColumnHeaderClick;
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                DataCell = new CheckBoxCell("Checked"),
                HeaderText = StrRes.GetString("StrChecked","Checked"),
                Editable = true
            });
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                ID = "Name",
                DataCell = new TextBoxCell("Name"),
                HeaderText = StrRes.GetString("StrName","Name"),
                Sortable = true,
                AutoSize = false,
                Width = 150
            });
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("Author"),
                HeaderText = StrRes.GetString("StrAuthor","Author"),
                AutoSize = false,
                Width = 100
            });
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("AvailableVersion"),
                HeaderText = StrRes.GetString("StrAvailableVersion","AvailableVersion"),
                AutoSize = false,
                Width = 150
            });
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("RequiredVersion"),
                HeaderText = StrRes.GetString("StrRequiredVersion","RequiredVersion"),
                AutoSize = false,
                Width = 150
            });
            _gridViewAvailable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("CanInstall"),
                HeaderText = StrRes.GetString("StrCanInstall","CanInstall"),
                AutoSize = false,
                Width = 100
            });
            _gridViewAvailable.SelectionChanged += _gridViewAvailable_SelectionChanged;
            _textAreatAvailableDes = new TextArea();
            _buttonRefresh = new Button {Text = StrRes.GetString("StrRefresh","Refresh")};
            _buttonRefresh.Click += _buttonRefresh_Click;
            _buttonInstall = new Button {Text = StrRes.GetString("StrInstall","Install")};
            _buttonInstall.Click += _buttonInstall_Click;
            page2.Add(_gridViewAvailable, true, true);
            page2.Add(_textAreatAvailableDes, true, false);
            page2.AddSeparateRow(null, _buttonRefresh, _buttonInstall);

            //page3
            var page3 = new DynamicLayout();
            _gridViewUpdatable = new GridView();
            _gridViewUpdatable.ColumnHeaderClick += _gridViewUpdatable_ColumnHeaderClick;
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                DataCell = new CheckBoxCell("Checked"),
                HeaderText = StrRes.GetString("StrChecked","Checked"),
                Editable = true
            });
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                ID = "Name",
                DataCell = new TextBoxCell("Name"),
                HeaderText = StrRes.GetString("StrName","Name"),
                Sortable = true,
                AutoSize = false,
                Width = 150
            });
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("Author"),
                HeaderText = StrRes.GetString("StrAuthor","Author"),
                AutoSize = false,
                Width = 100
            });
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("InstalledVersion"),
                HeaderText = StrRes.GetString("StrInstalledVersion","InstalledVersion"),
                AutoSize = false,
                Width = 150
            });
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("AvailableVersion"),
                HeaderText = StrRes.GetString("StrAvailableVersion","AvailableVersion"),
                AutoSize = false,
                Width = 150
            });
            _gridViewUpdatable.Columns.Add(new GridColumn()
            {
                DataCell = new TextBoxCell("CanUpdate"),
                HeaderText = StrRes.GetString("StrCanUpdate","CanUpdate"),
                AutoSize = false,
                Width = 100
            });
            _gridViewUpdatable.SelectionChanged += _gridViewUpdatable_SelectionChanged;
            _textAreatUpdatesDes = new TextArea();
            _buttonUpdate = new Button {Text = StrRes.GetString("StrUpdate","Update")};
            _buttonUpdate.Click += _buttonUpdate_Click;
            page3.Add(_gridViewUpdatable, true, true);
            page3.Add(_textAreatUpdatesDes, true, false);
            page3.AddSeparateRow(null, _buttonUpdate);

            //_tabPageInstalled
            _tabPageInstalled = new TabPage {Text = StrRes.GetString("StrInstalled","Installed")};
            _tabPageInstalled.Content = page1;

            //_tabPageAvailable
            _tabPageAvailable = new TabPage {Text = StrRes.GetString("StrAvailable","Available")};
            _tabPageAvailable.Content = page2;

            //_tabPageUpdatable
            _tabPageUpdatable = new TabPage {Text = StrRes.GetString("StrUpdatable","Updatable")};
            _tabPageUpdatable.Content = page3;

            //_tabControl
            _tabControl = new TabControl();
            _tabControl.Pages.Add(_tabPageInstalled);
            _tabControl.Pages.Add(_tabPageAvailable);
            _tabControl.Pages.Add(_tabPageUpdatable);
            _tabControl.SelectedIndexChanged += _tabControl_SelectedIndexChanged;

            //_buttonSetting
            _buttonSetting = new Button {Text = StrRes.GetString("StrSetting","Setting")};
            _buttonSetting.Click += _buttonSetting_Click;

            //_buttonClose
            _buttonClose = new Button {Text = StrRes.GetString("StrClose","Close")};
            _buttonClose.Click += _buttonClose_Click;

            //_labelMsg
            _labelMsg = new Label
            {
                TextColor = Colors.Red,
                Text =
                    StrRes.GetString("StrYourOperationWillTakeEffectWhenTheProgramStartNextTime",
                        "Your operation will take effect when the program start next time.")
            };
            _labelMsg.Visible = false;

            var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) };
            layout.Add(_tabControl, true, true);
            layout.AddSeparateRow(_buttonSetting, _labelMsg, null, _buttonClose);

            Content = layout;
            Size = new Size(610, 430);
            Title = "PluginManager";
            Icon = Application.Instance.MainForm.Icon;
        }