Ejemplo n.º 1
0
		void Init()
		{
			var label1 = new Label
			{
				Text = "Welcome to",
				Font = new Font(FontFamilies.Monospace, 30)
			};
			var labelTitle = new Label
			{
				Text = "Altman3",
				Font = new Font(FontFamilies.Monospace, 60)
			};

			var layout = new PixelLayout();
			layout.Add(label1, new Point(70, 50));
			layout.Add(labelTitle, new Point(100, 120));

			var logo = PluginServiceProvider.GetService("ToFingerBinary");
			if (logo != null)
			{
				var rnd = new Random();
				var par = new PluginParameter();
				par.AddParameter("str", rnd.Next(1, 1023));
				var ret = logo(par);
				var tmp = new Label
				{
					Text = ret,
					Font = new Font(FontFamilies.Monospace, 10)
				};
				layout.Add(tmp, new Point(300, 220));
			}

			Content = layout;
		}
Ejemplo n.º 2
0
		public CursorSection()
		{
			var layout = new TableLayout();
			layout.Spacing = new Size(20, 20);

			TableRow row;

			layout.Rows.Add(row = new TableRow());

			foreach (var type in Enum.GetValues(typeof(CursorType)).OfType<CursorType?>())
			{
				var label = new Label
				{ 
					Size = new Size(100, 50), 
					Text = type.ToString(),
					VerticalAlignment = VerticalAlignment.Center,
					TextAlignment = TextAlignment.Center,
					BackgroundColor = Colors.Silver
				};
				if (type == null)
					label.Cursor = null;
				else
					label.Cursor = new Cursor(type.Value);
				row.Cells.Add(label);

				if (row.Cells.Count > 3)
					layout.Rows.Add(row = new TableRow());
			}

			Content = TableLayout.AutoSized(layout, centered: true);

		}
Ejemplo n.º 3
0
		protected override Forms.Window GetWindow()
		{
			// Add splitters like this:
			// |---------------------------
			// |        |      |          |
			// |  P0    |  P2  |   P4     |
			// | -------|      |          |  <== These are on MainPanel
			// |  P1    |------|          |
			// |        |  P3  |          |
			// |---------------------------
			// |         status0..4,      |  <== These are on StatusPanel
			// ----------------------------

			Label[] status = new Label[] { new Label(), new Label(), new Label(), new Label(), new Label() };

			// Status bar
			var statusPanel = new Panel { };
			var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty);
			statusLayout.BeginHorizontal();
			for (var i = 0; i < status.Length; ++i)
				statusLayout.Add(status[i], xscale: true);
			statusLayout.EndHorizontal();
			statusPanel.Content = statusLayout;

			// Splitter windows
			Panel[] p = new Panel[] { new Panel(), new Panel(), new Panel(), new Panel(), new Panel() };
			var colors = new Color[] { Colors.PaleTurquoise, Colors.Olive, Colors.NavajoWhite, Colors.Purple, Colors.Orange };
			var count = 0;
			for (var i = 0; i < p.Length; ++i)
			{
				var temp = i;
				//p[i].BackgroundColor = colors[i];
				var button = new Button { Text = "Click to update status " + i.ToString(), BackgroundColor = colors[i] };
				button.Click += (s, e) => status[temp].Text = "New count: " + (count++).ToString();
				p[i].Content = button;
			}

			var p0_1 = new Splitter { Panel1 = p[0], Panel2 = p[1], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p2_3 = new Splitter { Panel1 = p[2], Panel2 = p[3], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = SplitterOrientation.Horizontal, Position = 200};
			var p0123_4 = new Splitter { Panel1 = p01_23, Panel2 = p[4], Orientation = SplitterOrientation.Horizontal, Position = 400 };

			// Main panel
			var mainPanel = new Panel();
			mainPanel.Content = p0123_4;

			// Form's content
			var layout = new DynamicLayout();
			layout.Add(mainPanel, yscale: true);
			layout.Add(statusPanel);
			layout.Generate();
			var form = new Form 
			{ 
				Size = new Size(800, 600),
				Content = layout
			};
			return form;
		}
Ejemplo n.º 4
0
        public HiSumDisplay()
        {
            // sets the client (inner) size of the window for your content
            ClientSize = new Eto.Drawing.Size(600, 400);

            Title = "HiSum";
            TreeGridView view = new TreeGridView(){Height = 500};

            view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false });
            var textbox = new TextBox() {Width = 1000};
            var button = new Button(){Text = "Go", Width = 15};
            var label = new Label() {Width = 100};
            var tbResult = new TextArea() {Width = 1000};

            button.Click += (sender, e) =>
            {
                Reader reader = new Reader();
                List<int> top100 = reader.GetTop100();
                List<FullStory> fullStories = new List<FullStory>();
                foreach (int storyID in top100.Take(30))
                {
                    FullStory fullStory = reader.GetStoryFull(storyID);
                    fullStories.Add(fullStory);
                }
                TreeGridItemCollection data = GetTree(fullStories);
                view.DataStore = data;
            };
            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(10, 10, 10, 10), // space around the table's sides
                Rows = {
                    new TableRow(
                        new Label{Text = "Input URL from Hacker News: ",Width=200},
                        textbox,
                        button,
                        label
                    ),
                    new TableRow(
                        null,
                        tbResult,
                        null,
                        null
                        ),
                    new TableRow(
                        new Label(),
                        view
                    ),

                    // by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
                    // otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
                    new TableRow { ScaleHeight = true }
                }
            };
        }
Ejemplo n.º 5
0
		Control WebView()
		{
			try
			{
				webView = new WebView();

				webView.Navigated += (sender, e) =>
				{
					Log.Write(webView, "Navigated, Uri: {0}", e.Uri);
					UpdateButtons();
				};
				webView.DocumentLoading += (sender, e) =>
				{
					Log.Write(webView, "DocumentLoading, Uri: {0}, IsMainFrame: {1}", e.Uri, e.IsMainFrame);
					e.Cancel = cancelLoad.Checked ?? false;
					if (!e.Cancel)
					{
						UpdateButtons();
						stopButton.Enabled = true;
					}
				};
				webView.DocumentLoaded += (sender, e) =>
				{
					Log.Write(webView, "DocumentLoaded, Uri: {0}", e.Uri);
					UpdateButtons();
					stopButton.Enabled = false;
				};
				webView.OpenNewWindow += (sender, e) =>
				{
					Log.Write(webView, "OpenNewWindow: {0}, Url: {1}", e.NewWindowName, e.Uri);
				};
				webView.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e)
				{
					titleLabel.Text = e.Title;
				};
				return webView;

			}
			catch (Exception)
			{
				var control = new Label
				{
					Text = string.Format("WebView not supported on this platform with the {0} generator", Platform.ID),
					BackgroundColor = Colors.Red,
					TextAlignment = TextAlignment.Center,
					VerticalAlignment = VerticalAlignment.Center,
					TextColor = Colors.White
				};
				if (Platform.IsGtk)
					Log.Write(this, "You must install webkit-sharp for WebView to work under GTK. Note that GTK does not support webkit-sharp on any platform other than Linux.");
				return control;
			}


		}
Ejemplo n.º 6
0
Archivo: Main.cs Proyecto: mhusen/Eto
		public MyForm()
		{
			// Set ClientSize instead of Size, as each platform has different window border sizes
			ClientSize = new Size(600, 400);

			// Title to show in the title bar
			Title = "Hello, Eto.Forms";

			// Content of the form
			Content = new Label { Text = "Some content", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center };
		}
Ejemplo n.º 7
0
		Control HoverNodeLabel()
		{
			hoverNodeLabel = new Label();

			treeView.MouseMove += (sender, e) => {
				var node = treeView.GetNodeAt(e.Location);
				hoverNodeLabel.Text = "Item under mouse: " + (node != null ? node.Text : "(no node)");
			};

			return hoverNodeLabel;
		}
Ejemplo n.º 8
0
		public DesignerUserControl()
		{
			BackgroundColor = Colors.White;
			Padding = new Padding(20);
			Content = label = new Label
			{
				VerticalAlignment = VerticalAlignment.Center,
				TextAlignment = TextAlignment.Center,
				Font = SystemFonts.Default(8),
				Text = "[User Control]"
			};
		}
Ejemplo n.º 9
0
        Control CreateAccountButton()
        {
            var control = new Label { Text = "Create a New Account", TextColor = Colors.Blue };
            control.MouseDown += (sender, e) => {
                var uri = new UriBuilder(this.serverAddress.Text) {
                    Path = "account/register"
                };

                Application.Instance.Open(uri.ToString());
            };
            return control;
        }
Ejemplo n.º 10
0
		public static void AddLabelledSection (this DynamicLayout layout, string text, Control control)
		{
			var label = new Label { Text = text, VerticalAlign = VerticalAlign.Middle };
#if DESKTOP
			layout.AddRow (Label, control);
#elif MOBILE
			layout.BeginVertical ();
			layout.Add (label);
			layout.Add (control);
			layout.EndVertical ();
#endif
		}
Ejemplo n.º 11
0
		public MaskedTextBoxSection()
		{
			Spacing = 5;
			Padding = new Padding(10);
			var tb = new NumericMaskedTextBox<decimal> { Value = 123.456M };
			var l = new Label();
			l.TextBinding.Bind(Binding.Property(tb, c => c.Value).Convert(r => "Value: " + Convert.ToString(r)));
			Items.Add(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { tb, l } });
			Items.Add(new MaskedTextBox(new FixedMaskedTextProvider("(999) 000-0000")) { ShowPromptOnFocus = true, PlaceholderText = "(123) 456-7890" });
			Items.Add(new MaskedTextBox<DateTime>(new FixedMaskedTextProvider<DateTime>("&&/90/0000") { ConvertToValue = DateTime.Parse }));
			Items.Add(new MaskedTextBox(new FixedMaskedTextProvider(">L0L 0L0")));
			Items.Add(new MaskedTextBox { InsertMode = InsertKeyMode.Toggle });
		}
Ejemplo n.º 12
0
		private void Construct()
		{
			Title = "My Eto Form";
			ClientSize = new Size(400, 350);

            lblContent = new Label { Text = "Hello World!" };
            prgBar = new ProgressBar();

			// scrollable region as the main content
			Content = new Scrollable
			{
				// table with three rows
				Content = new TableLayout(
					null,
					// row with three columns
					new TableRow(null, lblContent, null),
                    new TableRow(null, prgBar, null)
				)
			};

			// create a few commands that can be used for the menu and toolbar
            cmdButton = new Command { MenuText = "Click Me!", ToolBarText = "Click Me!" };

			var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q };
			quitCommand.Executed += (sender, e) => Application.Instance.Quit();

			var aboutCommand = new Command { MenuText = "About..." };
			aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app...");

			// create menu
			Menu = new MenuBar
			{
				Items =
				{
					// File submenu
					new ButtonMenuItem { Text = "&File", Items = { cmdButton } },
					// new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
					// new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } },
				},
				ApplicationItems =
				{
					// application (OS X) or file menu (others)
					new ButtonMenuItem { Text = "&Preferences..." },
				},
				QuitItem = quitCommand,
				AboutItem = aboutCommand
			};

			// create toolbar			
            ToolBar = new ToolBar { Items = { cmdButton } };
		}
Ejemplo n.º 13
0
		public SystemColorSection()
		{
			var layout = new StackLayout
			{
				Spacing = 10,
				HorizontalContentAlignment = HorizontalAlignment.Stretch
			};

			var type = typeof(SystemColors);

			var properties = type.GetRuntimeProperties();

			var skip = new List<PropertyInfo>();
			var colorProperties = properties.Where(r => r.PropertyType == typeof(Color)).OrderBy(r => r.Name).ToList();
			foreach (var property in colorProperties)
			{
				if (skip.Contains(property))
					continue;
				var color = (Color)property.GetValue(null);
				var label = new Label { Text = property.Name };
				var panel = new Panel
				{ 
					Content = label,
					Padding = new Padding(10),
				};

				bool isTextColor = property.Name.EndsWith("Text");

				if (isTextColor)
					label.TextColor = color;
				else
				{
					panel.BackgroundColor = color;
					var textProp = colorProperties.FirstOrDefault(r => r.Name == property.Name + "Text");
					if (textProp != null)
					{
						label.TextColor = (Color)textProp.GetValue(null);
						label.Text += " && " + textProp.Name;
						skip.Add(textProp);
					}
					else if (color.ToHSB().B < 0.5)
						label.TextColor = Colors.White;
				}

				layout.Items.Add(panel);
			}

			Content = new Scrollable { Content = TableLayout.AutoSized(layout, centered: true) };

		}
Ejemplo n.º 14
0
        void Init()
        {
            //_labelDownload
            _labelDownload = new Label();

            //_progressBarDownload
            _progressBarDownload = new ProgressBar();

            var layout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)};
            layout.AddRow(_labelDownload);
            layout.AddRow(_progressBarDownload);

            Content = layout;
            Icon = Application.Instance.MainForm.Icon;
        }
Ejemplo n.º 15
0
        public About()
        {
            /* dialog attributes */

            this.Title = "About Notedown";
            this.MinimumSize = new Size(300, 0);
            this.Resizable = false;

            /* dialog controls */

            var imageView = new ImageView();
            imageView.Image = Icon.FromResource("Icon.ico");
            imageView.Size = new Size(128, 128);

            var labelTitle = new Label();
            labelTitle.Text = "Notedown";
            labelTitle.Font = new Font(FontFamilies.Sans, 16);
            labelTitle.HorizontalAlign = HorizontalAlign.Center;

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var labelVersion = new Label();
            labelVersion.Text = string.Format("Version {0}", version);
            labelVersion.HorizontalAlign = HorizontalAlign.Center;

            var labelCopyright = new Label();
            labelCopyright.Text = "Copyright by Andre Straubmeier";
            labelCopyright.HorizontalAlign = HorizontalAlign.Center;

            var button = new Button();
            button.Text = "Close";
            button.Click += (sender, e) => Close();

            /* dialog layout */

            Content = new TableLayout
            {
                Padding = new Padding(10),
                Spacing = new Size(5, 5),
                Rows =
                {
                    imageView, labelTitle, labelVersion, labelCopyright,
                    TableLayout.AutoSized(button, centered: true)
                }
            };

            AbortButton = DefaultButton = button;
        }
Ejemplo n.º 16
0
		Control ContextMenuPanel ()
		{
			var label = new Label{ 
				Size = new Size(100, 100), 
				BackgroundColor = Color.Blue,
				TextColor = Color.White,
				HorizontalAlign = HorizontalAlign.Center,
				VerticalAlign = VerticalAlign.Middle,
				Text = "Click on me!"
			};
			
			label.MouseDown += delegate(object sender, MouseEventArgs e) {
				var menu = CreateMenu ();
				menu.Show (label);
			};
			return label;
		}
Ejemplo n.º 17
0
		Control ContextMenuPanel()
		{
			var label = new Label
			{
				Size = new Size(100, 100),
				BackgroundColor = Colors.Blue,
				TextColor = Colors.White,
				TextAlignment = TextAlignment.Center,
				VerticalAlignment = VerticalAlignment.Center,
				Text = "Click on me!"
			};
			label.MouseDown += (sender, e) =>
			{
				var menu = CreateMenu();
				menu.Show(label);
			};
			return label;
		}
Ejemplo n.º 18
0
        public About()
        {
            /* dialog attributes */

            this.Text = "About Notedown";
            this.ClientSize = new Size(300, 280);
            this.Resizable = false;

            /* dialog controls */

            var imageView = new ImageView();
            imageView.Image = Icon.FromResource("Icon.ico");
            imageView.Size = new Size(128, 128);

            var labelTitle = new Label();
            labelTitle.Text = "Notedown";
            labelTitle.Size = new Size(240, 24);
            labelTitle.Font = new Font(FontFamily.Sans, 16);
            labelTitle.HorizontalAlign = HorizontalAlign.Center;

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var labelVersion = new Label();
            labelVersion.Text = string.Format("Version {0}", version);
            labelVersion.HorizontalAlign = HorizontalAlign.Center;

            var labelCopyright = new Label();
            labelCopyright.Text = "Copyright by Andre Straubmeier";
            labelCopyright.HorizontalAlign = HorizontalAlign.Center;

            var button = new Button();
            button.Text = "Close";
            button.Size = new Size(90, 26);
            button.Click += delegate
            {
                Close();
            };

            /* dialog layout */

            var layout = new DynamicLayout(this);
            layout.AddColumn(imageView, labelTitle, labelVersion, labelCopyright);
            layout.AddCentered(button);
        }
Ejemplo n.º 19
0
		Control WebView ()
		{
			try {
				var control = webView = new WebView ();
			
				control.DocumentLoading += delegate(object sender, WebViewLoadingEventArgs e) {
					Log.Write (control, "Document loading, Uri: {0}, IsMainFrame: {1}", e.Uri, e.IsMainFrame);
					UpdateButtons ();
					stopButton.Enabled = true;
				};
				control.DocumentLoaded += delegate(object sender, WebViewLoadedEventArgs e) {
					Log.Write (control, "Document loaded, Uri: {0}", e.Uri);
					UpdateButtons ();
					stopButton.Enabled = false;
				};
				control.OpenNewWindow += (sender, e) => {
					Log.Write (control, "Open new window with name '{0}', Url: {1}", e.NewWindowName, e.Uri);
				};
				control.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e) {
					titleLabel.Text = e.Title;
				};
				LoadHtml();
				return control;

			} catch (HandlerInvalidException) {
				var control = new Label { 
					Text = string.Format ("WebView not supported on this platform with the {0} generator", Generator.ID),
					BackgroundColor = Colors.Red,
					HorizontalAlign = HorizontalAlign.Center,
					VerticalAlign = VerticalAlign.Middle,
					TextColor = Colors.White
				};
				if (Generator.ID == Generators.Gtk)
					Log.Write (this, "You must install webkit-sharp for WebView to work under GTK. Note that GTK does not support webkit-sharp on any platform other than Linux.");
				return control;
			}

			
		}
Ejemplo n.º 20
0
		public OptionsPageView(OptionsPageModel model)
		{
			var layout = new DynamicLayout();

			var infoLayout = new StackLayout { Spacing = 10 };

			foreach (var option in model.Options)
			{
				var currentOption = option;
				option.Selected = option.Values.FirstOrDefault();
                var infoLabel = new Label { Text = option.Selected?.Description };
				infoLayout.Items.Add(infoLabel);

                layout.Add(new Label { Text = option.Name });
				layout.BeginVertical();
				layout.BeginHorizontal();

				layout.Add(new Panel { Size = new Size(40, -1) }, xscale: false);

				var radioList = new RadioButtonList();
				radioList.Orientation = Orientation.Vertical;
				radioList.ItemTextBinding = Binding.Property((OptionValue v) => v.Name);
				radioList.DataStore = option.Values;
				radioList.SelectedValueChanged += (sender, e) =>
				{
					currentOption.Selected = radioList.SelectedValue as OptionValue;
					infoLabel.Text = currentOption.Selected?.Description;
				};
				radioList.SelectedIndex = 0;
				layout.Add(radioList);

				layout.EndHorizontal();
				layout.EndVertical();
			}

			Information = infoLayout;
            Content = layout;
		}
Ejemplo n.º 21
0
        /// <summary>
        /// Creates new progress bar window.
        /// </summary>
        /// <param name="title">Window title.</param>
        public ProgressForm(string title = "")
        {
            Title = title;
            ClientSize = new Size(320, 50);
            MinimumSize = new Size(100, 50);
            this.Maximizable = false;
            this.Resizable = false;

            label = new Label { TextAlignment = TextAlignment.Center };
            progressBar = new ProgressBar { Value = 0, MinValue = 0, MaxValue = 100 };

            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(5), // space around the table's sides
                Rows =
                {
                    new TableRow(new TableCell(label, true)),
                    new TableRow(new TableCell(progressBar, true)),
                    new TableRow { ScaleHeight = true }
                }
            };
        }
Ejemplo n.º 22
0
		public void AddingItemMultipleLevelsDeepShouldSetChildrenAndParent()
		{
			TestBase.Invoke(() =>
			{
				var layout = new DynamicLayout();

				var items = new List<Control>();

				layout.BeginHorizontal();

				Control ctl = new Button();
				items.Add(ctl);
				layout.Add(ctl);

				layout.BeginVertical();

				ctl = new Label();
				items.Add(ctl);
				layout.Add(ctl);

				layout.EndVertical();
				layout.EndHorizontal();

				ctl = new TextBox();
				items.Add(ctl);
				layout.Add(ctl);

				CollectionAssert.AreEqual(items, layout.Children, "#1. Items do not match");

				foreach (var item in items)
					Assert.AreEqual(layout, item.Parent, "#2. Items should have parent set to dynamic layout");

				layout.Clear();
				foreach (var item in items)
					Assert.IsNull(item.Parent, "#3. Items should have parent removed when removed from dynamic layout");
			});
		}
Ejemplo n.º 23
0
		Control ExpandedHeight()
		{
			var label = new Label { BackgroundColor = Colors.Red, Text = "Expanded Height" };
			return new Scrollable { ExpandContentWidth = false, Content = label };
		}
Ejemplo n.º 24
0
        public MyForm()
        {
            if (File.Exists("Config.json"))
            {
                Settings = JsonSettings.Load <MySettings>("Config.json");
            }
            else
            {
                Settings = JsonSettings.Construct <MySettings>("Config.json");
            }

            // sets the client (inner) size of the window for your content
            //this.ClientSize = new Eto.Drawing.Size(600, 400);
            this.ClientSize   = Settings.windowSize;
            this.SizeChanged += (sender, args) =>
            {
                Settings.windowSize = this.ClientSize;
                Settings.Save();
            };
            this.Title = "KruBot3";
            var Twitch  = new WebView();
            var Pretzel = new WebView();

            Twitch.OpenNewWindow  += TwitchOnOpenNewWindow;
            Pretzel.OpenNewWindow += TwitchOnOpenNewWindow; //Nothing special is needed.
            Twitch.Url             = new Uri("https://www.twitch.tv/popout/" + Settings.Username + "/chat?popout=");
            WebClient wb     = new WebClient();
            string    Script = wb.DownloadString("https://cdn.frankerfacez.com/static/ffz_injector.user.js");

            Twitch.DocumentLoaded += (sender, args) =>
                                     // Twitch.ExecuteScript(""););
                                     Pretzel.Url = new Uri("https://app.pretzel.rocks/player");
            var browserLayout = new Splitter();

            browserLayout.Panel1           = Twitch;
            browserLayout.Panel2           = Pretzel;
            browserLayout.Orientation      = Orientation.Horizontal;
            browserLayout.RelativePosition = 0.75;
            browserLayout.FixedPanel       = SplitterFixedPanel.None;
            browserLayout.PositionChanged += (sender, args) =>
            {
                Console.WriteLine(browserLayout.RelativePosition);
                Settings.splitPosition = browserLayout.RelativePosition;
                Settings.Save();
            };
            browserLayout.RelativePosition = Settings.splitPosition;

            var Tabs     = new TabControl();
            var TabPage1 = new TabPage();

            TabPage1.Text    = "Main Chat";
            TabPage1.Content = browserLayout;
            Tabs.Pages.Add(TabPage1);

            var TabPage2 = new TabPage();

            TabPage2.Text = "Settings";

            var t2Contents = new StackLayout();

            t2Contents.Padding = 50;
            Label Info = new Label();

            Info.Text = "This page lets you configure the bot to be able to listen to your chat.";
            t2Contents.Items.Add(Info);
            Label Info2 = new Label();

            Info2.Text = "Please enter your Username Below:";
            t2Contents.Items.Add(Info2);
            TextBox userName = new TextBox();

            userName.Size = new Size(400, userName.Height);
            if (Settings.Username == "Twitch")
            {
                userName.PlaceholderText = "Username";
            }
            else
            {
                userName.Text = Settings.Username;
            }

            t2Contents.Items.Add(userName);

            Label Info3 = new Label();

            Info3.Text = "And now we need an OAuth Code from that account:";
            t2Contents.Items.Add(Info3);

            Button openOAuth = new Button();

            openOAuth.Click += OpenOAuthOnClick;
            openOAuth.Text   = "Open Website";
            t2Contents.Items.Add(openOAuth);

            PasswordBox oAuth = new PasswordBox();

            if (string.IsNullOrEmpty(Settings.oAuthToken))
            {
            }
            else
            {
                oAuth.Text = Settings.oAuthToken;
            }

            oAuth.Size = new Size(400, oAuth.Height);
            t2Contents.Items.Add(oAuth);

            Label SaveNow = new Label();

            SaveNow.Text = "Once you're done, click this button to save your settings!";
            t2Contents.Items.Add(SaveNow);

            Button Save = new Button();

            Save.Text   = "Save!";
            Save.Click += (sender, args) =>
            {
                Settings.Username   = userName.Text.ToLower();
                Settings.oAuthToken = oAuth.Text;
                Settings.Save();
                MessageBox.Show("Saved!");
                Twitch.Url = new Uri("https://www.twitch.tv/popout/" + Settings.Username + "/chat?popout=");
                initBot();
            };
            t2Contents.Items.Add(Save);
            TabPage2.Content = t2Contents;
            Tabs.Pages.Add(TabPage2);
            this.Content = Tabs;


            #region Bringing up the bot

            if (string.IsNullOrEmpty(Settings.oAuthToken))
            {
                Tabs.SelectedIndex = 1;
            }
            else
            {
                initBot();
            }

            #endregion
        }
Ejemplo n.º 25
0
        void Init()
		{
            // _textBoxFindText
            var labelFindText = new Label { Text = StrRes.GetString("StrFindContent", "FindContent") };	
			_textBoxFindText = new TextBox();

			// _buttonFindNext
			_buttonFindNext = new Button { Text = StrRes.GetString("StrFindNext", "FindNext") };
            _buttonFindNext.Click += _buttonFindNext_Click;

			// _buttonCancel
			_buttonCancel = new Button { Text = StrRes.GetString("StrCancel","Cancel") };
            _buttonCancel.Click += _buttonCancel_Click;

            // _checkBoxCaseSensitive
            _checkBoxCaseSensitive = new CheckBox { Text = StrRes.GetString("StrCaseSensitive", "Case Sensitive") };

            // _radio
            _radioButtonUp = new RadioButton { Text = StrRes.GetString("StrUp", "Up") };
            _radioButtonDown = new RadioButton(_radioButtonUp) { Text = StrRes.GetString("StrDown", "Down") };
            _radioButtonDown.Checked = true;

            var groupLayout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)};
            groupLayout.AddRow(_radioButtonUp, _radioButtonDown);

            var group = new GroupBox { Text = StrRes.GetString("StrDirection", "Direction") };
            group.Content = groupLayout;

			var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) };

            layout.BeginHorizontal();
            // left start --->
            layout.BeginVertical(xscale: true);
            layout.BeginHorizontal();
            layout.Add(labelFindText);
            layout.Add(_textBoxFindText);
            layout.EndHorizontal();

            layout.Add(null);

            layout.BeginHorizontal();
            layout.Add(_checkBoxCaseSensitive);
            layout.Add(group);
            layout.EndHorizontal();
            layout.EndVertical();
            // <--- left end

            // right start --->
            layout.BeginVertical(xscale: false, yscale: false);
            layout.Add(_buttonFindNext);         
            layout.Add(null);
            layout.Add(_buttonCancel);
            layout.EndVertical();
            // <--- right end
            layout.EndHorizontal();

			Content = layout;
            Title = StrRes.GetString("StrFind", "Find");
            Minimizable = false;
            Maximizable = false;
            Topmost = true;
            ClientSize = new Size(350, 90);
            Resizable = false;     
		}
Ejemplo n.º 26
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;
        }
Ejemplo n.º 27
0
		Control LabelControl()
		{
			var control = new Label { Text = "Label Control" };
			LogEvents(control);
			return control;
		}
Ejemplo n.º 28
0
		Control TitleLabel ()
		{
			titleLabel = new Label{};
			return titleLabel;
		}
Ejemplo n.º 29
0
		private static void LayoutContent2(Label[] status, Panel mainPanel)
		{
			LayoutContent2(status, mainPanel, null);
		}
Ejemplo n.º 30
0
		private static void LayoutContent(Label[] status, Panel mainPanel)
		{
			var count = 0;
			var splitLayout = new SplitLayout();
			mainPanel.Content = splitLayout.Layout(
				i => {
					var button = new Button { Text = "Click to update status " + i, BackgroundColor = splitLayout.PanelColors[i] };
					button.Click += (s, e) => status[i].Text = "New count: " + (count++);
					return button;
				});
		}
Ejemplo n.º 31
0
		private static void LayoutContent2(Label[] status, Panel mainPanel, Panel[] panels)
		{
			var splitLayout = new SplitLayout(panels);
			var isFullScreen = false;
			mainPanel.Content = splitLayout.Layout(
				i => {
					var button = new Button { Text = "Click to make full screen" + i, BackgroundColor = splitLayout.PanelColors[i] };
					button.Click += (s, e) => {
						if (isFullScreen)
							LayoutContent2(status, mainPanel, splitLayout.Panels); // recursive
						else
							mainPanel.Content = splitLayout.Panels[i];
						isFullScreen = !isFullScreen;
					};
					return button;
				});
		}