Пример #1
17
		public TreeViewSection()
		{
			var layout = new DynamicLayout();
			
			layout.BeginHorizontal();
			layout.Add(new Label());
			layout.BeginVertical();
			layout.BeginHorizontal();
			layout.Add(null);
			layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
			layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
			layout.Add(RefreshButton());
			layout.Add(null);
			layout.EndHorizontal();
			layout.EndVertical();
			layout.EndHorizontal();

			treeView = ImagesAndMenu();

			layout.AddRow(new Label{ Text = "Simple" }, Default());
			layout.BeginHorizontal();
			layout.Add(new Panel());
			layout.BeginVertical();
			layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null);
			layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null);
			layout.EndVertical();
			layout.EndHorizontal();
			layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView);
			layout.AddRow(new Panel(), HoverNodeLabel());

			layout.Add(null, false, true);

			Content = layout;
		}
Пример #2
0
 Control Default()
 {
     var control = new TreeView {
         Size = new Size(100, 150)
     };
     LogEvents (control);
     control.DataStore = CreateTreeItem (0, "Item", null);
     return control;
 }
Пример #3
0
        public Channels(Configuration config)
        {
            this.Config = config;
            channelList = new TreeView { Style = "channelList" };
            channelList.DataStore = servers;
            channelList.SelectionChanged += (sender, e) => OnChannelChanged(e);
            channelList.Activated += HandleActivated;
            
            config.ServerAdded += HandleServerAdded;
            config.ServerRemoved += HandleServerRemoved;

            Content = channelList;
        }
Пример #4
0
		public UserList (Channel channel)
		{
			this.Channel = channel;
			tree = new TreeView ();
			tree.Style = "userList";
			tree.Activated += HandleActivated;
			
			items = new TreeItemCollection ();
			items.Add (owners = new TreeItem { Text = "Room Owners", Expanded = true });
			items.Add (online = new TreeItem { Text = "Online", Expanded = true });
			items.Add (away = new TreeItem { Text = "Away", Expanded = true });
			if (Generator.ID == Generators.Mac) {
				foreach (var item in items.OfType<TreeItem>()) {
					item.Text = item.Text.ToUpperInvariant();
				}
			}
			tree.DataStore = items;
			
			this.AddDockedControl (tree);
		}
Пример #5
0
        Control ImagesAndMenu()
        {
            var control = new TreeView {
                Size = new Size(100, 150)
            };

            var menu = new ContextMenu ();
            var item = new ImageMenuItem{ Text = "Click Me!"};
            item.Click += delegate {
                if (control.SelectedItem != null)
                    Log.Write (item, "Click, Rows: {0}", control.SelectedItem.Text);
                else
                    Log.Write (item, "Click, no item selected");
            };
            menu.MenuItems.Add (item);

            control.ContextMenu = menu;

            LogEvents (control);
            control.DataStore = CreateTreeItem (0, "Item", Image);
            return control;
        }
Пример #6
0
        public UserList(Channel channel)
        {
            Channel = channel;
            Size = new Size(150, 100);
            tree = new TreeView();
            tree.Style = "userList";
            tree.Activated += HandleActivated;

            items = new TreeItemCollection();
            items.Add(owners = new TreeItem { Text = "Room Owners", Expanded = true });
            items.Add(online = new TreeItem { Text = "Online", Expanded = true });
            items.Add(away = new TreeItem { Text = "Away", Expanded = true });
            if (Generator.IsMac)
            {
                foreach (var item in items.OfType<TreeItem>())
                {
                    item.Text = item.Text.ToUpperInvariant();
                }
            }
            tree.DataStore = items;
            
            Content = tree;
        }
Пример #7
0
		void LogEvents(TreeView control)
		{
			control.LabelEditing += (sender, e) =>
			{
				if (cancelLabelEdit)
				{
					Log.Write(control, "BeforeLabelEdit (cancelled), Item: {0}", e.Item.Text);
					e.Cancel = true;
				}
				else
					Log.Write(control, "BeforeLabelEdit, Item: {0}", e.Item.Text);
			};
			control.LabelEdited += (sender, e) =>
			{
				Log.Write(control, "AfterLabelEdit, Item: {0}, New Label: {1}", e.Item.Text, e.Label);
			};
			control.Activated += delegate(object sender, TreeViewItemEventArgs e)
			{
				Log.Write(control, "Activated, Item: {0}", e.Item.Text);
			};
			control.SelectionChanged += delegate
			{
				Log.Write(control, "SelectionChanged, Item: {0}", control.SelectedItem != null ? control.SelectedItem.Text : "<none selected>");
			};
			control.Expanding += (sender, e) =>
			{
				Log.Write(control, "Expanding, Item: {0}", e.Item.Text);
				e.Cancel = !(allowExpanding.Checked ?? true);
			};
			control.Expanded += (sender, e) =>
			{
				Log.Write(control, "Expanded, Item: {0}", e.Item.Text);
			};
			control.Collapsing += (sender, e) =>
			{
				Log.Write(control, "Collapsing, Item: {0}", e.Item.Text);
				e.Cancel = !(allowCollapsing.Checked ?? true);
			};
			control.Collapsed += (sender, e) =>
			{
				Log.Write(control, "Collapsed, Item: {0}", e.Item.Text);
			};
		}
Пример #8
0
 void LogEvents(TreeView control)
 {
     control.Activated += delegate(object sender, TreeViewItemEventArgs e) {
         Log.Write (control, "Activated, Item: {0}", e.Item.Text);
     };
     control.SelectionChanged += delegate {
         Log.Write (control, "SelectionChanged, Item: {0}", control.SelectedItem != null ? control.SelectedItem.Text : "<none selected>");
     };
 }
Пример #9
0
		public UnitTestSection()
		{
			startButton = new Button { Text = "Start Tests", Size = new Size(200, 80) };
			useTestPlatform = new CheckBox { Text = "Use Test Platform" };
			var buttons = new StackLayout
			{
				Padding = new Padding(10),
				Spacing = 5,
				HorizontalContentAlignment = HorizontalAlignment.Center,
				Items = { startButton, useTestPlatform }
			};

			if (Platform.Supports<TreeView>())
			{

				search = new SearchBox();
				search.Focus();
				search.KeyDown += (sender, e) =>
				{
					if (e.KeyData == Keys.Enter)
					{	
						startButton.PerformClick();
						e.Handled = true;
					}
				};

				var timer = new UITimer();
				timer.Interval = 0.5;
				timer.Elapsed += (sender, e) =>
				{
					timer.Stop();
					PopulateTree(search.Text);
				};
				search.TextChanged += (sender, e) => {
					if (timer.Started)
						timer.Stop();
					timer.Start();
				};

				tree = new TreeView();

				tree.Activated += (sender, e) =>
				{
					var item = (TreeItem)tree.SelectedItem;
					if (item != null)
					{
						RunTests(item.Tag as CategoryFilter);
					}
				};

				Content = new StackLayout
				{
					Spacing = 5,
					HorizontalContentAlignment = HorizontalAlignment.Stretch,
					Items = { buttons, search, new StackLayoutItem(tree, expand: true) }
				};
			}
			else
				Content = buttons;

			startButton.Click += (s, e) => RunTests();
		}
Пример #10
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;
        }
Пример #11
0
        private void ShowWwwRootDir(TreeView treeView, IEnumerable<string> drives, string wwwRootDir, bool isWin)
        {
            var treeItem = new TreeItem();

            AddDriveInDirTree(treeItem, drives);
            AddDirInDirTree(treeItem, wwwRootDir, isWin);
            treeView.DataStore = treeItem;

            //RefreshAllFiles(GetCurrentDirPath());
            new Actions.ItemRefresh(_status).Execute();
        }
Пример #12
0
		public UnitTestSection()
		{
			startButton = new Button { Text = "Start Tests", Size = new Size(200, 80) };
			useTestPlatform = new CheckBox { Text = "Use Test Platform" };
			var buttons = new TableLayout(
				              TableLayout.AutoSized(startButton, centered: true),
				              TableLayout.AutoSized(useTestPlatform, centered: true)
			              );

			if (Platform.Supports<TreeView>())
			{
				tree = new TreeView();

				tree.Activated += (sender, e) =>
				{
					var item = (TreeItem)tree.SelectedItem;
					if (item != null)
					{
						RunTests(item.Tag as CategoryFilter);
					}
				};

				Content = new TableLayout(
					buttons,
					tree
				);
			}
			else
				Content = new TableLayout(null, buttons, null);

			startButton.Click += (s, e) => RunTests();
		}
Пример #13
0
		void LogEvents (TreeView control)
		{
			control.Activated += delegate(object sender, TreeViewItemEventArgs e) {
				Log.Write (control, "Activated, Item: {0}", e.Item.Text);
			};
			control.SelectionChanged += delegate {
				Log.Write (control, "SelectionChanged, Item: {0}", control.SelectedItem != null ? control.SelectedItem.Text : "<none selected>");
			};
			control.Expanding += (sender, e) => {
				Log.Write (control, "Expanding, Item: {0}", e.Item);
				e.Cancel = !(allowExpanding.Checked ?? true);
			};
			control.Expanded += (sender, e) => {
				Log.Write (control, "Expanded, Item: {0}", e.Item);
			};
			control.Collapsing += (sender, e) => {
				Log.Write (control, "Collapsing, Item: {0}", e.Item);
				e.Cancel = !(allowCollapsing.Checked ?? true);
			};
			control.Collapsed += (sender, e) => {
				Log.Write (control, "Collapsed, Item: {0}", e.Item);
			};
		}
Пример #14
0
        private void CreateOutputSection()
        {
            var outGrp = new GroupBox { Text = "Output" };

            var layout = new DynamicLayout(outGrp);
            layout.BeginVertical();

            var sourceLabel = new Label { Text = "Source: ", Size = new Size(50, 20) };
            _pathLabel = new Label();

            layout.BeginHorizontal();
            layout.AddRow(sourceLabel, _pathLabel);
            layout.EndHorizontal();

            _treeView = new TreeView();
            _treeView.MouseDoubleClick += _treeView_MouseDoubleClick;

            layout.BeginHorizontal();
            layout.AddRow(_treeView);
            layout.EndHorizontal();

            layout.EndVertical();

            _outputSection = outGrp;
        }