Beispiel #1
0
        Control Metrics()
        {
            var layout = new DynamicLayout {
                DefaultSpacing = new Size(5, 5)
            };

            layout.BeginHorizontal();
            layout.BeginVertical();
            layout.Add(null);
            layout.AddRow("Descent", Descender());
            layout.AddRow("Ascent", Ascender());
            layout.AddRow("Leading", Leading());
            layout.AddRow("MeasureString", MeasureString());
            layout.Add(null);
            layout.EndBeginVertical();
            layout.Add(null);
            layout.AddRow("BaseLine", BaseLine());
            layout.AddRow("XHeight", XHeight());
            layout.AddRow("LineHeight", LineHeight());
            layout.Add(null);
            layout.EndBeginVertical();
            layout.Add(null);
            layout.Add(MetricsPreview());
            layout.Add(null);
            layout.EndVertical();
            layout.EndHorizontal();
            return(layout);
        }
        public ServerDialog(Server server, bool isNew, bool allowConnect)
        {
            this.allowConnect = allowConnect && !isNew;
            this.Server       = server;
            this.Title        = "Add Server";
            this.MinimumSize  = new Size(300, 0);
            this.DataContext  = server;

            var layout = new DynamicLayout();

            layout.BeginVertical();

            layout.AddRow(new Label {
                Text = "Server Name"
            }, ServerName());

            // generate server-specific edit controls
            server.GenerateEditControls(layout, isNew);

            layout.AddRow(null, AutoConnectButton());

            layout.EndBeginVertical();

            layout.AddRow(Connect(), Disconnect(), null, cancelButton = this.CancelButton(), this.OkButton("Save", () => SaveData()));

            layout.EndVertical();

            Content = layout;

            SetVisibility();
        }
Beispiel #3
0
        public PrintDialogSection()
        {
            this.DataContext = settings;

            var layout = new DynamicLayout();

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.Add(null);
            layout.BeginVertical(Padding.Empty);
            layout.AddSeparateRow(null, ShowPrintDialog(), null);
            layout.AddSeparateRow(null, PrintFromGraphicsWithDialog(), null);
            layout.AddSeparateRow(null, PrintFromGraphics(), null);
            layout.EndBeginVertical();
            layout.Add(PrintDialogOptions());
            layout.Add(null);
            layout.EndVertical();
            layout.Add(null);
            layout.EndHorizontal();
            layout.EndVertical();
            layout.AddSeparateRow(null, PageRange(), Settings(), null);

            layout.Add(null);
            Content = layout;
        }
Beispiel #4
0
        public JabbRServerEdit(JabbRServer server, DynamicLayout layout)
        {
            this.server = server;
            layout.AddRow(new Label {
                Text = "Address"
            }, EditAddress());
            layout.EndBeginVertical(yscale: true);
            layout.AddRow(UseSocialLogin());
            layout.Add(authSection = new Panel {
            }, yscale: true);
            layout.EndBeginVertical();
            loginSection  = LoginSection();
            socialSection = SocialSection();

            authSection.DataContextChanged += (sender, e) => SetVisibility();
            SetVisibility();
        }
Beispiel #5
0
        Control LoadUrl()
        {
            var control = new Button
            {
                Text = "Load Url"
            };

            control.Click += delegate
            {
                if (Platform.Supports <Dialog>())
                {
                    var dialog = new Dialog <bool>();
                    if (Platform.IsDesktop)
                    {
                        dialog.MinimumSize = new Size(300, 0);
                    }

                    var layout  = new DynamicLayout();
                    var textBox = new TextBox {
                        Text = "http://google.com"
                    };
                    var goButton = new Button {
                        Text = "Go"
                    };
                    dialog.DefaultButton = goButton;
                    goButton.Click      += (sender, e) => dialog.Close(true);
                    var cancelButton = new Button {
                        Text = "Cancel"
                    };
                    dialog.AbortButton  = cancelButton;
                    cancelButton.Click += (sender, e) => dialog.Close();
                    layout.BeginVertical();
                    layout.AddRow(new Label {
                        Text = "Url"
                    }, textBox);
                    layout.EndBeginVertical();
                    layout.AddRow(null, cancelButton, goButton);
                    layout.EndVertical();

                    dialog.Content = layout;


                    if (dialog.ShowModal(this))
                    {
                        Uri uri;
                        if (Uri.TryCreate(textBox.Text, UriKind.Absolute, out uri))
                        {
                            webView.Url = uri;
                        }
                    }
                }
                else
                {
                    webView.Url = new Uri("http://google.com");
                }
            };
            return(control);
        }
Beispiel #6
0
        string PromptString(string title, string initialValue = null, string action = null, bool largeText = false)
        {
            if (!Platform.Supports <Dialog>())
            {
                return(initialValue);
            }

            var dialog = new Dialog <bool>();

            if (Platform.IsDesktop)
            {
                dialog.MinimumSize = new Size(300, 0);
            }

            var layout = new DynamicLayout();

            layout.Styles.Add <Label>(null, l => l.VerticalAlignment = VerticalAlignment.Center);
            layout.DefaultSpacing = new Size(5, 5);
            layout.Padding        = 10;
            var textBox = largeText ? (TextControl) new TextArea {
                TextReplacements = TextReplacements.None
            } : new TextBox();

            textBox.Text = initialValue;

            var goButton = new Button {
                Text = action ?? "OK"
            };

            dialog.DefaultButton = goButton;
            goButton.Click      += (sender, e) => dialog.Close(true);
            var cancelButton = new Button {
                Text = "Cancel"
            };

            dialog.AbortButton  = cancelButton;
            cancelButton.Click += (sender, e) => dialog.Close(false);
            layout.BeginVertical();
            layout.AddRow(new Label {
                Text = title
            }, textBox);
            layout.EndBeginVertical();
            layout.AddRow(null, cancelButton, goButton);
            layout.EndVertical();

            dialog.Content = layout;

            if (dialog.ShowModal(this))
            {
                return(textBox.Text);
            }
            return(null);
        }
Beispiel #7
0
        Control LoadUrl()
        {
            var control = new Button
            {
                Text = "Load Url"
            };

            control.Click += delegate
            {
                var dialog = new Dialog();
#if DESKTOP
                dialog.MinimumSize = new Size(300, 0);
#endif
                var layout  = new DynamicLayout();
                var textBox = new TextBox {
                    Text = "http://google.com"
                };
                var goButton = new Button {
                    Text = "Go"
                };
                dialog.DefaultButton = goButton;
                goButton.Click      += (sender, e) => {
                    dialog.DialogResult = DialogResult.Ok;
                    dialog.Close();
                };
                var cancelButton = new Button {
                    Text = "Cancel"
                };
                dialog.AbortButton  = cancelButton;
                cancelButton.Click += (sender, e) => {
                    dialog.Close();
                };
                layout.BeginVertical();
                layout.AddRow(new Label {
                    Text = "Url"
                }, textBox);
                layout.EndBeginVertical();
                layout.AddRow(null, cancelButton, goButton);
                layout.EndVertical();

                dialog.Content = layout;

                if (dialog.ShowDialog(this) == DialogResult.Ok)
                {
                    Uri uri;
                    if (Uri.TryCreate(textBox.Text, UriKind.Absolute, out uri))
                    {
                        webView.Url = uri;
                    }
                }
            };
            return(control);
        }
Beispiel #8
0
        Control Metrics()
        {
            var layout = new DynamicLayout {
                Padding = Padding.Empty
            };

            layout.BeginHorizontal();
            layout.BeginVertical();
            layout.Add(null);
            layout.AddRow(new Label {
                Text = "Descent"
            }, Descender());
            layout.AddRow(new Label {
                Text = "Ascent"
            }, Ascender());
            layout.AddRow(new Label {
                Text = "Leading"
            }, Leading());
            layout.Add(null);
            layout.EndBeginVertical();
            layout.Add(null);
            layout.AddRow(new Label {
                Text = "BaseLine"
            }, BaseLine());
            layout.AddRow(new Label {
                Text = "XHeight"
            }, XHeight());
            layout.AddRow(new Label {
                Text = "LineHeight"
            }, LineHeight());
            layout.Add(null);
            layout.EndBeginVertical();
            layout.Add(null);
            layout.Add(MetricsPreview());
            layout.Add(null);
            layout.EndVertical();
            layout.EndHorizontal();
            return(layout);
        }
Beispiel #9
0
        public MessageBoxSection()
        {
            MessageBoxText    = "Some message";
            MessageBoxCaption = "Some caption";
            AttachToParent    = true;

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

            layout.AddSeparateRow(null, new Label {
                Text = "Caption"
            }, CaptionBox(), null);
            layout.AddSeparateRow(null, new Label {
                Text = "Text"
            }, TitleBox(), null);

            layout.BeginVertical();

            layout.BeginHorizontal();
            layout.Add(null);
            layout.Add(new Label {
                Text = "Type", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right
            });
            layout.Add(MessageBoxTypeCombo());
            layout.Add(AttachToParentCheckBox());
            layout.Add(null);
            layout.EndHorizontal();

            layout.EndBeginVertical();
            layout.BeginHorizontal();
            layout.Add(null);
            layout.Add(new Label {
                Text = "Buttons", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right
            });
            layout.Add(MessageBoxButtonsCombo());
            layout.Add(new Label {
                Text = "Default Button", VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right
            });
            layout.Add(MessageBoxDefaultButtonCombo());
            layout.Add(null);
            layout.EndHorizontal();

            layout.EndVertical();

            layout.AddSeparateRow(null, ShowDialogButton(), null);
            layout.Add(null);

            Content = layout;
        }
Beispiel #10
0
        public MessageBoxSection()
        {
            MessageBoxText    = "Some message";
            MessageBoxCaption = "Some caption";
            AttachToParent    = true;

            var layout = new DynamicLayout();

            layout.AddSeparateRow(null, new Label {
                Text = "Caption"
            }, CaptionBox(), null);
            layout.AddSeparateRow(null, new Label {
                Text = "Text"
            }, TitleBox(), null);

            layout.BeginVertical(Padding.Empty);

            layout.BeginHorizontal();
            layout.Add(null);
            layout.Add(new Label {
                Text = "Type", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right
            });
            layout.Add(MessageBoxTypeCombo());
            layout.Add(AttachToParentCheckBox());
            layout.Add(null);
            layout.EndHorizontal();

            layout.EndBeginVertical();
            layout.BeginHorizontal();
            layout.Add(null);
            layout.Add(new Label {
                Text = "Buttons", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right
            });
            layout.Add(MessageBoxButtonsCombo());
            layout.Add(new Label {
                Text = "Default Button", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Right
            });
            layout.Add(MessageBoxDefaultButtonCombo());
            layout.Add(null);
            layout.EndHorizontal();

            layout.EndVertical();

            layout.AddSeparateRow(null, ShowDialogButton(), null);
            layout.Add(null);

            Content = layout;
        }
Beispiel #11
0
        Control LeftPane()
        {
            var layout = new DynamicLayout();

            layout.DefaultPadding = Padding.Empty;
            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.Add(new Label {
                Text = "Label", VerticalAlignment = VerticalAlignment.Center
            });
            layout.AddAutoSized(new Button {
                Text = "Button Control"
            }, centered: true);
            layout.Add(new ImageView {
                Image = icon1, Size = new Size(64, 64)
            });
            layout.Add(null);
            layout.EndHorizontal();
            layout.EndBeginVertical();
            layout.AddRow(new CheckBox {
                Text = "Check Box (/w three state)", ThreeState = true, Checked = null
            }, RadioButtons(), null);
            layout.EndBeginVertical();
            layout.AddRow(new TextBox {
                Text = "Text Box", Size = new Size(150, -1)
            }, new PasswordBox {
                Text = "Password Box", Size = new Size(150, -1)
            }, null);
            layout.EndBeginVertical();
            layout.AddRow(ComboBox(), new DateTimePicker {
                Value = DateTime.Now
            }, null);
            layout.EndBeginVertical();
            layout.AddRow(new NumericUpDown {
                Value = 50
            }, null);
            layout.EndBeginVertical();
            layout.AddRow(ListBox(), new TextArea {
                Text = "Text Area", Size = new Size(150, 50)
            }, null);
            layout.EndBeginVertical();
            layout.AddRow(new Slider {
                Value = 50, TickFrequency = 10
            });
            layout.EndBeginVertical();
            layout.AddRow(new ProgressBar {
                Value = 25
            });
            layout.EndBeginVertical();
            layout.AddRow(new GroupBox {
                Text = "Group Box", Content = new Label {
                    Text = "I'm in a group box"
                }
            });

            layout.EndBeginVertical();


            layout.EndVertical();
            layout.Add(null);

            return(layout);
        }
Beispiel #12
0
        public DebugWindow(DebugWindowViewModel viewModel)
        {
            Title       = "Debugger";
            DataContext = viewModel;

            var layout = new DynamicLayout
            {
                DefaultSpacing = new Size(20, 10),
                Padding        = new Padding(20, 10)
            };

            layout.BeginVertical();

            layout.BeginHorizontal();

            var disassemblerTextBox = new AutoLoadingRichTextArea
            {
                Font     = new Font("monospace", 10),
                Width    = 300,
                ReadOnly = true
            };

            disassemblerTextBox.TextBinding.BindDataContext <DebugWindowViewModel>(m => m.DisassembedProgramText);
            disassemblerTextBox.BindDataContext(t => t.BackgroundColor,
                                                Binding.Property <bool>(nameof(DebugWindowViewModel.EmulationIsRunning))
                                                .Convert(m => m ? Colors.DarkGray : Colors.White));

            layout.Add(disassemblerTextBox);

            layout.BeginVertical();

            layout.BeginHorizontal();

            layout.BeginVertical();

            var runHaltButton = new Button();

            runHaltButton.TextBinding.BindDataContext(
                Binding.Property <bool>(nameof(DebugWindowViewModel.EmulationIsRunning))
                .Convert(b => b ? "Halt" : "Run"));
            runHaltButton.Command = new Command((s, a) =>
            {
                if (viewModel.EmulationIsRunning)
                {
                    viewModel.HaltEmulation();
                }
                else
                {
                    viewModel.StartEmulation();
                }
            });
            layout.Add(runHaltButton);

            var stepButton = new Button
            {
                Text    = "Step",
                Command = new Command((s, a) => viewModel.Step())
            };

            stepButton.Bind(b => b.Enabled, viewModel,
                            Binding.Property((DebugWindowViewModel m) => m.EmulationIsRunning).Convert(v => !v));
            layout.Add(stepButton);

            layout.Add(null);

            _registerFieldControl = new RegisterFieldControl(viewModel.State.Registers);
            layout.Add(_registerFieldControl);

            viewModel.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "State")
                {
                    _registerFieldControl.UpdateBindings(BindingUpdateMode.Destination);
                }
            };

            layout.EndVertical();

            layout.EndBeginHorizontal();

            layout.EndBeginVertical();

            var tilesetView = new ImageView();

            tilesetView.BindDataContext(v => v.Image, (DebugWindowViewModel vm) => vm.Tileset, DualBindingMode.OneWay);
            layout.AddColumn(tilesetView, new Label {
                Text = "Tileset"
            });

            layout.EndBeginVertical();

            var tilemap0View = new ImageView();

            tilemap0View.BindDataContext(v => v.Image, (DebugWindowViewModel vm) => vm.Tilemap0, DualBindingMode.OneWay);
            layout.AddColumn(tilemap0View, new Label {
                Text = "Tilemap #0"
            });

            layout.EndBeginVertical();

            var tilemap1View = new ImageView();

            tilemap1View.BindDataContext(v => v.Image, (DebugWindowViewModel vm) => vm.Tilemap1, DualBindingMode.OneWay);
            layout.AddColumn(tilemap1View, new Label {
                Text = "Tilemap #1"
            });

            layout.EndVertical();

            layout.EndHorizontal();

            layout.EndVertical();

            Content = layout;
            viewModel.Refresh();
        }
Beispiel #13
0
        private void InitializeComponent()
        {
            var layout_left = new DynamicLayout {
                Padding = new Padding(10, 5, 5, 5), Spacing = new Size(5, 5), ClientSize = new Size(345, 426), MinimumSize = new Size(345, 426)
            };
            var layout_right = new DynamicLayout {
                Padding = new Padding(5, 5, 5, 5), Spacing = new Size(5, 5), ClientSize = new Size(180, 426), MinimumSize = new Size(180, 426)
            };

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


            _textAreaIn = new TextArea()
            {
                BackgroundColor = Colors.Black, TextColor = Colors.SpringGreen,
            };
            _textAreaOut = new TextArea()
            {
                BackgroundColor = Colors.Black, TextColor = Colors.SpringGreen,
            };
            layout_left.AddAutoSized(new Label()
            {
                Text = "接收区"
            });
            layout_left.AddSeparateRow(new Panel()
            {
                Content = _textAreaIn, MinimumSize = new Size(345, 240), ClientSize = new Size(345, 240)
            });
            layout_left.AddAutoSized(new Label()
            {
                Text = "发送区"
            });
            layout_left.AddSeparateRow(new Panel()
            {
                Content = _textAreaOut, MinimumSize = new Size(345, 165), ClientSize = new Size(345, 165)
            });

            _comboBoxSerialPortName = new ComboBox();
            _comboBoxSerialBaudRate = new ComboBox();
            _comboBoxSerialDataBits = new ComboBox();
            _comboBoxSerialParity   = new ComboBox();
            _comboBoxSerialStopBits = new ComboBox();

            _btnClear = new Button {
                Text = "清空收区"
            };
            _btnOpen = new Button {
                Text = "打开串口"
            };
            _btnSend = new Button {
                Text = "串口发送"
            };
            _checkBoxHex = new CheckBox {
                Text = "是否Hex"
            };
            label7 = new Label();

            layout_serialPort.BeginVertical();
            layout_serialPort.BeginHorizontal();
            layout_serialPort.AddAutoSized(new Label()
            {
                Text = "端口号:"
            }, new Padding(0, 3));
            layout_serialPort.AddAutoSized(_comboBoxSerialPortName);
            layout_serialPort.EndBeginHorizontal();
            layout_serialPort.BeginHorizontal();
            layout_serialPort.AddAutoSized(new Label()
            {
                Text = "波特率:"
            }, new Padding(0, 3));
            layout_serialPort.AddAutoSized(_comboBoxSerialBaudRate);
            layout_serialPort.EndBeginHorizontal();
            layout_serialPort.BeginHorizontal();
            layout_serialPort.AddAutoSized(new Label()
            {
                Text = "数据位:"
            }, new Padding(0, 3));
            layout_serialPort.AddAutoSized(_comboBoxSerialDataBits);
            layout_serialPort.EndBeginHorizontal();
            layout_serialPort.BeginHorizontal();
            layout_serialPort.AddAutoSized(new Label()
            {
                Text = "效验位:"
            }, new Padding(0, 3));
            layout_serialPort.AddAutoSized(_comboBoxSerialParity);
            layout_serialPort.EndBeginHorizontal();
            layout_serialPort.BeginHorizontal();
            layout_serialPort.AddAutoSized(new Label()
            {
                Text = "停止位:"
            }, new Padding(0, 3));
            layout_serialPort.AddAutoSized(_comboBoxSerialStopBits);
            layout_serialPort.EndBeginHorizontal();
            //layout_serialPort.AddColumn();
            //layout_serialPort.AddColumn();

            layout_serialPort.EndBeginVertical();

            layout_right.AddAutoSized(layout_serialPort);
            layout_right.AddCentered(new Panel()
            {
                Content = _btnClear, ClientSize = new Size(164, 37), MinimumSize = new Size(164, 37)
            }, null, null, true);
            layout_right.AddCentered(new Panel()
            {
                Content = _btnOpen, ClientSize = new Size(164, 37), MinimumSize = new Size(164, 37)
            }, new Padding(0, 80, 0, 0), null, true);
            layout_right.AddCentered(new Panel()
            {
                Content = _btnSend, ClientSize = new Size(164, 37), MinimumSize = new Size(164, 37)
            }, new Padding(0, 10), null, true);
            layout_right.AddCentered(_checkBoxHex);
            layout_right.AddAutoSized(label7);

            var layout = new Splitter()
            {
                Panel1      = layout_left,
                Panel2      = layout_right,
                Orientation = SplitterOrientation.Horizontal
            };
        }
Beispiel #14
0
        Control LeftPane()
        {
            var layout = new DynamicLayout {
                DefaultSpacing = new Size(5, 5)
            };

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.Add(new Label {
                Text = "Label", VerticalAlignment = VerticalAlignment.Center
            });
            layout.AddCentered(new Button {
                Text = "Button"
            });
            layout.AddCentered(new LinkButton {
                Text = "LinkButton"
            });
            layout.Add(new Label {
                Text = "ImageView", VerticalAlignment = VerticalAlignment.Center
            });
            layout.Add(new ImageView {
                Image = icon1, Size = new Size(64, 64)
            });
            layout.Add(null);
            layout.EndHorizontal();

            layout.EndBeginVertical();

            layout.AddSeparateRow(new CheckBox {
                Text = "CheckBox", ThreeState = true
            }, RadioButtons(), null);
            layout.AddSeparateRow(new TextBox {
                Text = "TextBox", Size = new Size(150, -1)
            }, "PasswordBox", new PasswordBox {
                Text = "PasswordBox", Size = new Size(150, -1)
            }, null);
            layout.AddSeparateRow(DropDown(), ComboBox(), null);
            layout.AddSeparateRow("Stepper", new Stepper(), "NumericStepper", new NumericStepper {
                Value = 50, DecimalPlaces = 1
            }, new TextStepper {
                Text = "TextStepper"
            }, null);

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.BeginVertical();
            layout.AddSeparateRow("DateTimePicker", new DateTimePicker {
                Value = DateTime.Now
            }, null);
            layout.AddSeparateRow(new TextArea {
                Text = "TextArea", Size = new Size(150, 50)
            }, CreateRichTextArea(), null);
            layout.AddSeparateRow(ListBox(), new GroupBox {
                Text = "GroupBox", Content = new Label {
                    Text = "I'm in a group box"
                }
            }, null);
            layout.EndVertical();
            layout.AddSeparateColumn("Calendar", new Calendar(), null);
            layout.EndHorizontal();
            layout.EndVertical();

            layout.AddSeparateRow("Slider", new Slider {
                Value = 50, TickFrequency = 10
            });
            layout.AddSeparateRow("ProgressBar", new ProgressBar {
                Value = 25, Width = 100
            }, "Spinner", new Spinner {
                Enabled = true
            }, null);
            layout.EndVertical();

            layout.EndVertical();
            layout.Add(null);

            return(layout);
        }
Beispiel #15
0
        public void InitializeComponents()
        {
            meni = new MenuBar {
                Items =
                {
                    new ButtonMenuItem {
                        Text = "Почетна", Items ={ this.pocetnaCmd            }
                    },
                    new SeparatorMenuItem(),
                    new ButtonMenuItem {
                        Text = "Одјави се", Items ={ this.prijaviSeCmd          }
                    }
                }
            };

            // labele
            izdvajamoLabela = new Label {
                Text = "\tИздвајамо: ", Font = new Font(SystemFont.Bold, 14)
            };
            najnovijeLabela = new Label {
                Text = "\tНајновије: ", Font = new Font(SystemFont.Bold, 14)
            };
            kategorijeLabela = new Label {
                Text = "\tКатегорије: ", Font = new Font(SystemFont.Bold, 12)
            };
            separator = new Label {
                Text = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
                Font = new Font(SystemFont.Default, 10, FontDecoration.Strikethrough)
            };

            // pretraga
            lupaImg = new ImageView {
                Image = Icon.FromResource("search-icon")
            };
            lupaImg.Width       = 30;
            lupaImg.Height      = 30;
            lupaImg.MouseEnter += (sender, e) => {
                lupaImg.Width  += 10;
                lupaImg.Height += 10;
            };
            lupaImg.MouseLeave += (sender, e) => {
                lupaImg.Width  = 30;
                lupaImg.Height = 30;
            };
            pretragaBox = new TextBox( )
            {
                PlaceholderText = "Унесите назив филма..."
            };
            pretragaBox.ToolTip = "Притисните ентер за претрагу.";
            pretragaBox.KeyUp  += (sender, e) => {
                Console.WriteLine("Pretraga");
            };
            pretragaLayout = new DynamicLayout( )
            {
                Spacing = new Size(10, 10)
            };
            pretragaLayout.BeginVertical();
            pretragaLayout.EndBeginHorizontal();
            pretragaLayout.Add(null, true, false);
            pretragaLayout.Add(lupaImg);
            pretragaLayout.Add(pretragaBox);
            pretragaLayout.Add(null, true, false);
            pretragaLayout.EndHorizontal();
            pretragaLayout.EndVertical();

            // kategorije
            List <string> listaKategorija = ZanrC.VratiSveZanrove();
            List <Label>  listaLabela     = new List <Label> ( );

            listaKategorija.ForEach(x => listaLabela.Add(new Label {
                Text = x.ToString()
            }));

            listaLabela.ForEach(x => {
                x.MouseEnter += (sender, e) => {
                    x.Font = new Font(SystemFont.Default, 10, FontDecoration.Underline);
                };

                x.MouseLeave += (sender, e) => {
                    x.Font = new Font(SystemFont.Default, 10, FontDecoration.None);
                };
                x.MouseDown += (sender, e) => {
                    Console.WriteLine("Kliknuto: " + x.Text);
                };
            });
            kategorijePanel = new DynamicLayout( )
            {
                Spacing = new Size(10, 10),
                Padding = new Padding(10, 10)
            };
            kategorijePanel.BeginVertical();
            listaLabela.ForEach(x => {
                kategorijePanel.BeginHorizontal();
                kategorijePanel.Add(null, true, false);
                kategorijePanel.Add(x);
                //kategorijePanel.Add( null , true , false );
                kategorijePanel.EndHorizontal();
            });
            kategorijePanel.EndVertical();

            // pretraga i desni panel
            desniPanel = new DynamicLayout( )
            {
                Spacing         = new Size(10, 10),
                BackgroundColor = Color.FromArgb(255, 238, 91, 70),
                Size            = new Size(300, 500)
            };
            desniPanel.BeginVertical();
            desniPanel.Add(pretragaLayout);
            desniPanel.Add(kategorijeLabela);
            separator.Text = "\t\t\t\t\t\t\t";
            desniPanel.Add(separator);
            desniPanel.Add(kategorijePanel);
            desniPanel.EndVertical();

            izdvajamoPanel = new DynamicLayout( )
            {
                Padding         = new Padding(10, 10),
                BackgroundColor = Color.FromArgb(40, 40, 40, 50),
                Spacing         = new Size(5, 5),
            };
            izdvajamoPanel.BeginVertical();

            // inicijalizacija izdvajamo panela
            List <Projekcija> listaProjekcijaPodaci = Projekcija.Sve();

            for (int i = 0; i < listaProjekcijaPodaci.Count - 1; i++)
            {
                // nasumicno odabiranje projekcije
                if (i == Metode.VratiNasumicniInt(0, listaProjekcijaPodaci.Count))
                {
                    continue;
                }

                Label nazivFilma = new Label {
                    Text = "Назив филма: " + listaProjekcijaPodaci[i].Film.Naziv
                };
                Label nazivSale = new Label {
                    Text = "Назив сале:  " + listaProjekcijaPodaci[i].Sala.Naziv
                };
                Label vreme = new Label {
                    Text = "Време:\t  " + listaProjekcijaPodaci[i].Vreme
                };
                Button kupi = new Button {
                    Text = "Kупите карту"
                };
                Button vise = new Button {
                    Text = "Више информација"
                };
                var podPanel = new DynamicLayout( )
                {
                    Spacing = new Size(10, 10)
                };
                var dugmici = new DynamicLayout {
                    Spacing = new Size(10, 10)
                };

                kupi.Click += (sender, e) => KupiKartu(listaProjekcijaPodaci[i]);
                vise.Click += (sender, e) => PrikaziVise(listaProjekcijaPodaci[i]);

                podPanel.BeginVertical();
                podPanel.Add(nazivFilma);
                podPanel.Add(nazivSale);
                podPanel.Add(vreme);

                dugmici.BeginVertical();
                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(kupi);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();

                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(vise);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();
                dugmici.EndVertical();

                podPanel.Add(dugmici);
                podPanel.EndVertical();

                izdvajamoPanel.Add(podPanel);
            }
            izdvajamoPanel.EndVertical();

            najnovijePanel = new DynamicLayout()
            {
                Padding         = new Padding(10, 10),
                BackgroundColor = Color.FromArgb(40, 40, 40, 50),
                Spacing         = new Size(10, 10),
            };

            najnovijePanel.BeginVertical();
            for (int i = 0; i < listaProjekcijaPodaci.Count - 1; i++)
            {
                if (i == Metode.VratiNasumicniInt(0, listaProjekcijaPodaci.Count))
                {
                    continue;
                }

                Label nazivFilma = new Label {
                    Text = "Назив филма: " + listaProjekcijaPodaci[i].Film.Naziv
                };
                Label nazivSale = new Label {
                    Text = "Назив сале:  " + listaProjekcijaPodaci[i].Sala.Naziv
                };
                Label vreme = new Label {
                    Text = "Време:\t  " + listaProjekcijaPodaci[i].Vreme
                };
                Button kupi = new Button {
                    Text = "Kупите карту"
                };
                Button vise = new Button {
                    Text = "Више информација"
                };
                var podPanel = new DynamicLayout( )
                {
                    Spacing = new Size(10, 10)
                };
                var dugmici = new DynamicLayout {
                    Spacing = new Size(5, 5)
                };

                kupi.Click += (sender, e) => KupiKartu(listaProjekcijaPodaci[i]);
                vise.Click += (sender, e) => PrikaziVise(listaProjekcijaPodaci[i]);

                podPanel.BeginVertical();
                podPanel.Add(nazivFilma);
                podPanel.Add(nazivSale);
                podPanel.Add(vreme);

                dugmici.BeginVertical();
                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(kupi);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();

                dugmici.BeginHorizontal();
                dugmici.Add(null, true, false);
                dugmici.Add(vise);
                dugmici.Add(null, true, false);
                dugmici.EndHorizontal();
                dugmici.EndVertical();


                podPanel.Add(dugmici);
                podPanel.EndVertical();

                najnovijePanel.Add(podPanel);
            }
            najnovijePanel.EndBeginVertical();


            leviPanel = new DynamicLayout()
            {
                Spacing = new Size(10, 10),
                Padding = new Padding(10, 10)
            };
            leviPanel.BeginVertical();
            leviPanel.Add(izdvajamoLabela);
            leviPanel.Add(separator);
            leviPanel.Add(izdvajamoPanel);
            leviPanel.Add(najnovijeLabela);
            leviPanel.Add(separator);
            leviPanel.Add(najnovijePanel);
            leviPanel.EndVertical();

            Scrollable scrollLeviPanel = new Scrollable {
                Content = leviPanel, Size = new Size(400, 500)
            };

            // try with table layout
            var mainPanel = new TableLayout()
            {
                Padding = new Padding(10),                // padding around cells
                Spacing = new Size(5, 5),                 // spacing between each cell
                Rows    =
                {
                    new TableRow(
                        new TableCell(scrollLeviPanel),
                        new TableCell(desniPanel)
                        )
                }
            };

            panel = mainPanel;
        }
Beispiel #16
0
        public override Control GeneratePad()
        {
            var layout = new DynamicLayout {
                Padding = Padding.Empty
            };

            layout.Add(Separator());
            layout.BeginVertical(Padding.Empty);
            layout.BeginHorizontal();

            var b = new ImageButton {
                Image   = ImageCache.BitmapFromResource("Pablo.Formats.Rip.Icons.Brush-Multi.png"),
                Toggle  = true,
                Pressed = enableMulti
            };

            b.Click += delegate {
                enableMulti = b.Pressed;
            };

            layout.Add(b);
            layout.Add(null);
            layout.EndHorizontal();
            layout.EndVertical();

            var font       = new Font(SystemFont.Default, 7);
            var updownfont = new Font(SystemFont.Default, 8);

            layout.BeginVertical(Padding.Empty, Size.Empty);
            layout.Add(new Label {
                Text = "Width", Font = font, HorizontalAlign = HorizontalAlign.Center
            });
            var widthBox = new NumericUpDown {
                Font     = updownfont,
                Value    = width,
                MinValue = 1,
                MaxValue = MAX_WIDTH,
                Size     = new Size(20, -1)
            };

            widthBox.ValueChanged += delegate {
                width = Math.Max(1, Math.Min(MAX_WIDTH, (int)widthBox.Value));
            };
            layout.Add(widthBox);
            layout.EndBeginVertical(Padding.Empty, Size.Empty);

            layout.Add(new Label {
                Text = "Density", Font = font, HorizontalAlign = HorizontalAlign.Center
            });
            var pointsBox = new NumericUpDown {
                Font     = updownfont,
                Value    = points,
                MinValue = 1,
                MaxValue = MAX_POINTS,
                Size     = new Size(20, -1)
            };

            pointsBox.ValueChanged += delegate {
                points = Math.Max(1, Math.Min(MAX_POINTS, (int)pointsBox.Value));
            };
            layout.Add(pointsBox);
            layout.EndVertical();

            return(layout);
        }
Beispiel #17
0
        // Puts all of the stuff where it belongs.
        public void createUI(string bid)
        {
            layout.DefaultSpacing = new Size(15, 5);
            layout.Padding        = new Padding(10, 10, 10, 10);
            general_grid.Size     = new Size(800, 400);
            friend_grid.Size      = new Size(800, 100);

            layout.BeginVertical();

            layout.BeginGroup("Buisness Info", new Padding(10, 10, 200, 10));
            layout.BeginHorizontal();

            layout.BeginVertical();
            layout.BeginHorizontal();
            layout.AddAutoSized(new Label {
                Text = "Business Name:"
            });
            layout.AddAutoSized(businessname);
            layout.EndHorizontal();
            layout.BeginHorizontal();
            layout.AddAutoSized(new Label {
                Text = "Street Address:"
            });
            layout.AddAutoSized(streetaddress);
            layout.EndHorizontal();
            layout.BeginHorizontal();
            layout.AddAutoSized(new Label {
                Text = "Today's Hours:"
            });
            layout.AddAutoSized(openHours);
            layout.EndHorizontal();
            layout.EndBeginVertical();

            layout.BeginHorizontal();
            layout.BeginGroup("Business Attributes", new Padding(10, 10, 10, 10));
            layout.AddAutoSized(attributes);
            layout.EndGroup();
            layout.BeginGroup("Business Categories", new Padding(10, 10, 10, 10));
            layout.AddAutoSized(categories);
            layout.EndGroup();
            layout.EndHorizontal();

            layout.EndHorizontal();
            layout.EndGroup();



            layout.BeginGroup("Friend Tips", new Padding(10, 10, 10, 10));
            layout.BeginHorizontal();
            layout.AddAutoSized(friend_grid);
            layout.EndHorizontal();
            layout.EndGroup();

            layout.BeginGroup("Tips", new Padding(10, 10, 10, 10));
            layout.BeginHorizontal();
            layout.AddAutoSized(general_grid);

            layout.BeginVertical();
            layout.AddAutoSized(addLike);
            layout.AddAutoSized(checkIn);
            layout.AddAutoSized(checkinGraph);
            layout.EndVertical();

            layout.EndHorizontal();
            layout.BeginHorizontal();
            layout.AddAutoSized(newTip);
            layout.AddAutoSized(addTip);
            layout.EndHorizontal();
            layout.EndGroup();


            layout.EndVertical();
        }