Esempio n. 1
0
        private void LoadImages()
        {
            int k = 0;

            //Load images
            foreach (KeyValuePair <string, ResourceData> res in datastore.archive.Res)
            {
                StackPanel panel = new StackPanel();
                Rectangle  img   = new Rectangle();

                int ws, hs;
                datastore.archive.GetImageSize(res.Key, out ws, out hs);

                if (ws < hs)
                {
                    img.Fill = new ImageBrush(datastore.archive.GetImage(res.Key, 70));
                }
                else
                {
                    img.Fill = new ImageBrush(datastore.archive.GetImageByHeight(res.Key, 70));
                }

                ((ImageBrush)img.Fill).Stretch = Stretch.UniformToFill;
                img.Width           = 70;
                img.Height          = 70;
                img.Stroke          = new SolidColorBrush(Colors.Black);
                img.StrokeThickness = 1;

                Label lab = new Label();
                lab.Margin = new Thickness(5, 0, 0, 0);
                lab.VerticalContentAlignment = VerticalAlignment.Center;
                lab.Content = Strings.ResStrings.Width + ": " + ws + "   " + Strings.ResStrings.Height + ": " + hs + "   " + Strings.ResStrings.Size + ": " + FileWorker.GetBytesReadableTwoDecimals(res.Value.Data.LongLength);


                FlatButton ViewB = new FlatButton();
                ViewB.Content = new Image
                {
                    Source            = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Icons/Compress.png")),
                    VerticalAlignment = VerticalAlignment.Center,
                    Width             = 20,
                    Height            = 20
                };
                compr.Click                   += Compress_Click;
                compr.Margin                   = new Thickness(10, 0, 0, 0);
                compr.DefaultBrush             = null;
                compr.Hover                    = new SolidColorBrush(Color.FromRgb(240, 98, 146));
                compr.ClickBrush               = new SolidColorBrush(Color.FromRgb(233, 30, 99));
                compr.Height                   = 24;
                compr.Width                    = 24;
                compr.Tag                      = res.Key;
                compr.VerticalContentAlignment = VerticalAlignment.Center;


                FlatButton save = new FlatButton();
                save.Content = new Image
                {
                    Source            = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Icons/DeleteFill.png")),
                    VerticalAlignment = VerticalAlignment.Center,
                    Width             = 20,
                    Height            = 20
                };
                Delete.Click                   += Delete_Click;
                Delete.Margin                   = new Thickness(10, 0, 0, 0);
                Delete.DefaultBrush             = null;
                Delete.Hover                    = new SolidColorBrush(Color.FromRgb(240, 98, 146));
                Delete.ClickBrush               = new SolidColorBrush(Color.FromRgb(233, 30, 99));
                Delete.Height                   = 24;
                Delete.Width                    = 24;
                Delete.Tag                      = res.Key;
                Delete.VerticalContentAlignment = VerticalAlignment.Center;


                /*
                 * Button Delete = new Button();
                 * Delete.Content = Strings.ResStrings.Delete;
                 * Delete.Click += Delete_Click;
                 * Delete.Margin = new Thickness(10, 0, 0, 0);
                 * Delete.Height = 26;
                 * Delete.MinWidth = 50;
                 * Delete.Tag = res.Key;
                 * Delete.VerticalContentAlignment = VerticalAlignment.Center;
                 */


                panel.Children.Add(img);
                panel.Children.Add(lab);
                panel.Children.Add(compr);
                panel.Children.Add(ViewB);
                panel.Children.Add(save);
                panel.Children.Add(Delete);
                panel.Orientation = Orientation.Horizontal;
                panel.Margin      = new Thickness(2, 2, 0, 2);

                /*
                 * item.Click += Item_Click;
                 * item.Tag = elem;
                 */
                if (k % 2 == 0)
                {
                    panel.Background = new SolidColorBrush(Colors.WhiteSmoke);
                }

                k++;

                Menu_list.Children.Add(panel);
            }
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (ViewModel.CanUserLeaveScreen())
            {
                NavigationItem.HidesBackButton = false;
            }
            else
            {
                NavigationItem.HidesBackButton = true;
            }

            View.BackgroundColor                 = UIColor.FromRGB(242, 242, 242);
            ratingTableView.BackgroundColor      = UIColor.Clear;
            ratingTableView.SeparatorColor       = UIColor.Clear;
            ratingTableView.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            ratingTableView.DelaysContentTouches = false;

            var btnSubmit = new FlatButton(new CGRect(8f, BottomPadding, 304f, 41f));

            FlatButtonStyle.Green.ApplyTo(btnSubmit);
            btnSubmit.SetTitle(Localize.GetValue("Submit"), UIControlState.Normal);

            ViewModel.PropertyChanged += async(sender, e) => {
                if (e.PropertyName == "CanRate")
                {
                    ShowDoneButton();
                }
            };

            var source = new MvxActionBasedTableViewSource(
                ratingTableView,
                UITableViewCellStyle.Default,
                BookRatingCell.Identifier,
                BookRatingCell.BindingText,
                UITableViewCellAccessory.None);

            source.CellCreator = (tableView, indexPath, item) =>
            {
                var cell = BookRatingCell.LoadFromNib(tableView);
                cell.RemoveDelay();
                return(cell);
            };
            ratingTableView.Source = source;

            var set = this.CreateBindingSet <BookRatingView, BookRatingViewModel>();

            set.Bind(btnSubmit)
            .For("TouchUpInside")
            .To(vm => vm.RateOrder);
            set.Bind(btnSubmit)
            .For(v => v.Hidden)
            .To(vm => vm.CanRate)
            .WithConversion("BoolInverter");

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.RatingList);

            set.Apply();
        }
Esempio n. 3
0
        private void SelectMenuCategoryButton(FlatButton button)
        {
            SelectedButtonTheme(button);

            DeselectMenuCategoryButton(button);
        }
Esempio n. 4
0
        private void SetupControls()
        {
            this.lblUserName     = new FormLabel(0, "lblUserName", true, "username");
            this.lblPassword     = new FormLabel(1, "lblPassword", true, "password");
            this.lblLogonProcess = new FormLabel(2, "lblLogonProcess", true, "logon_process");

            this.lblLogonProcess.Anchor |= AnchorStyles.Right;

            this.pbxAppIcon  = new System.Windows.Forms.PictureBox();
            this.lblAppName  = new System.Windows.Forms.Label();
            this.cbxUserName = new System.Windows.Forms.ComboBox();
            this.tbxPassword = new System.Windows.Forms.TextBox();
            this.btnExit     = new FlatButton(1, "exit", "", "exit");
            this.btnLogin    = new FlatButton(2, "login", "", "login");

            this.pbxAppIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
            this.lblAppName.Font     = new System.Drawing.Font("Tahoma", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.tbxPassword.UseSystemPasswordChar = true;

            this.lblAppName.AutoSize           = true;
            this.tbxPassword.Anchor           |= AnchorStyles.Right;
            this.cbxUserName.Anchor           |= AnchorStyles.Right;
            this.lblLogonProcess.Margin        = new Padding(0, 20, 0, 20);
            this.cbxUserName.FormattingEnabled = true;

            this.AcceptButton    = this.btnLogin;
            this.btnExit.Click  += new System.EventHandler(this.btnExit_Click);
            this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);

            this.tlpMain    = new HLayoutPanel("tlpMain", 6, 3, 0);
            this.tlpButtons = new HLayoutPanel("tlpButtons", 1, 3, 1);

            this.tlpMain.ColumnStyles[this.tlpMain.ColumnCount - 1] = new ColumnStyle(SizeType.Percent, 100F);
            this.tlpMain.RowStyles[1] = new RowStyle(SizeType.Percent, 100F);

            this.tlpMain.Controls.Add(this.pbxAppIcon, 0, 0);
            this.tlpMain.Controls.Add(this.lblAppName, 1, 0);
            this.tlpMain.Controls.Add(this.lblLogonProcess, 1, 2);
            this.tlpMain.Controls.Add(this.lblUserName, 1, 3);
            this.tlpMain.Controls.Add(this.cbxUserName, 2, 3);
            this.tlpMain.Controls.Add(this.lblPassword, 1, 4);
            this.tlpMain.Controls.Add(this.tbxPassword, 2, 4);
            this.tlpMain.Controls.Add(this.tlpButtons, 0, 5);

            this.tlpMain.SetColumnSpan(this.lblAppName, 2);
            this.tlpMain.SetColumnSpan(this.lblLogonProcess, 2);
            this.tlpMain.SetColumnSpan(this.tlpButtons, 3);
            this.tlpMain.SetRowSpan(this.pbxAppIcon, 5);

            this.tlpButtons.Controls.Add(this.btnLogin, 1, 0);
            this.tlpButtons.Controls.Add(this.btnExit, 2, 0);

            this.tlpButtons.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 100F);
            this.tlpButtons.Anchor          = AnchorStyles.Left |
                                              AnchorStyles.Right | AnchorStyles.Bottom;
            this.tlpButtons.AutoSize = true;

            this.Controls.Add(this.tlpMain);

            this.BackColor            = System.Drawing.Color.White;
            this.tlpMain.BackColor    = this.BackColor;
            this.tlpButtons.BackColor = Presentation.View.Theme.GroupPanelBackColor;

            this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text            = Resources.Texts.logon;
            this.lblAppName.Text = Resources.Texts.app_name;

            this.pbxAppIcon.Image = DomainModel.Application.ResourceManager.GetImage("lock_big");
        }
Esempio n. 5
0
        /// <summary>
        ///
        /// </summary>
        private void InitializeComponent()
        {
            ComponentResourceManager resources = new ComponentResourceManager(typeof(InvoiceClient));

            components         = new Container();
            buttonView         = new FlatButton();
            buttonDelete       = new FlatButton();
            buttonExit         = new FlatButton();
            transactionsLayout = new Panel();
            flowLayoutPanel1   = new FlowLayoutPanel();
            notifyIcon         = new NotifyIcon(components);
            listView           = new ListView();
            transactionsLayout.SuspendLayout();
            flowLayoutPanel1.SuspendLayout();
            SuspendLayout();
            //
            // buttonView
            //
            buttonView.Font     = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
            buttonView.Location = new Point(0, 4);
            buttonView.Margin   = new Padding(0, 4, 2, 4);
            buttonView.Name     = "buttonView";
            buttonView.Size     = new Size(128, 32);
            buttonView.TabIndex = 0;
            buttonView.Text     = "View";
            buttonView.Click   += new EventHandler(ButtonView_Click);
            //
            // buttonDelete
            //
            buttonDelete.Location = new Point(132, 4);
            buttonDelete.Margin   = new Padding(2, 4, 2, 4);
            buttonDelete.Name     = "buttonDelete";
            buttonDelete.Size     = new Size(131, 32);
            buttonDelete.TabIndex = 1;
            buttonDelete.Text     = "Delete";
            buttonDelete.Click   += new EventHandler(ButtonDelete_Click);
            //
            // buttonExit
            //
            buttonExit.DialogResult = DialogResult.Cancel;
            buttonExit.Font         = new Font("Microsoft Sans Serif", 8.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
            buttonExit.Location     = new Point(267, 4);
            buttonExit.Margin       = new Padding(2, 4, 0, 4);
            buttonExit.Name         = "buttonExit";
            buttonExit.Size         = new Size(128, 32);
            buttonExit.TabIndex     = 2;
            buttonExit.Text         = "Exit";
            buttonExit.Click       += new EventHandler(ButtonExit_Click);
            //
            // transactionsLayout
            //
            transactionsLayout.BackColor = SystemColors.ControlDark;
            transactionsLayout.Controls.Add(flowLayoutPanel1);
            transactionsLayout.Controls.Add(listView);
            transactionsLayout.Dock     = DockStyle.Fill;
            transactionsLayout.Location = new Point(0, 0);
            transactionsLayout.Name     = "transactionsLayout";
            transactionsLayout.Padding  = new Padding(4);
            transactionsLayout.Size     = new Size(404, 461);
            //
            // flowLayoutPanel1
            //
            flowLayoutPanel1.BackColor = Color.Transparent;
            flowLayoutPanel1.Controls.Add(buttonView);
            flowLayoutPanel1.Controls.Add(buttonDelete);
            flowLayoutPanel1.Controls.Add(buttonExit);
            flowLayoutPanel1.Dock     = DockStyle.Bottom;
            flowLayoutPanel1.Location = new Point(4, 421);
            flowLayoutPanel1.Margin   = new Padding(0);
            flowLayoutPanel1.Name     = "flowLayoutPanel1";
            flowLayoutPanel1.Size     = new Size(396, 36);
            //
            // listView
            //
            listView.BackColor = SystemColors.ControlLight;
            listView.Columns.AddRange(new ColumnHeader[]
            {
                new ColumnHeader
                {
                    Text = "Date", Width = 100
                },
                new ColumnHeader
                {
                    Text = "Identifier", Width = 290
                }
            });
            listView.Dock                  = DockStyle.Fill;
            listView.FullRowSelect         = true;
            listView.GridLines             = true;
            listView.Location              = new Point(4, 4);
            listView.Name                  = "listView";
            listView.Size                  = new Size(396, 453);
            listView.TabIndex              = 3;
            listView.View                  = View.Details;
            listView.HeaderStyle           = ColumnHeaderStyle.Nonclickable;
            listView.SelectedIndexChanged += new EventHandler(ListView_SelectedIndexChanged);
            listView.MouseDoubleClick     += new MouseEventHandler(ListView_MouseDoubleClick);
            //
            // InvoiceClient
            //
            AcceptButton = buttonView;
            ClientSize   = new Size(404, 461);
            Controls.Add(transactionsLayout);
            FormBorderStyle    = FormBorderStyle.FixedSingle;
            Icon               = Resources.librettoIcon;
            MaximizeBox        = false;
            Name               = "InvoiceClient";
            StartPosition      = FormStartPosition.CenterScreen;
            Text               = "Libretto Invoices";
            Load              += new EventHandler(InvoiceClient_Load);
            notifyIcon.Text    = Text;
            notifyIcon.Visible = true;
            notifyIcon.Icon    = Resources.librettoIcon;
            transactionsLayout.ResumeLayout(false);
            flowLayoutPanel1.ResumeLayout(false);
            flowLayoutPanel1.PerformLayout();
            ResumeLayout(false);
        }
 private void SelectButtonTab(FlatButton button)
 {
     SelectedButtonTheme(button);
     DeselectProductTabButton(button);
 }
Esempio n. 7
0
        public static void InterfaceThemeControl(Control root)
        {
            bLightTheme = GetSetting("ifc_bLightTheme");

            fdeltaColorMouseOver = GetSetting("ifc_fdeltaColorMouseOver");
            fdeltaColorMouseDown = GetSetting("ifc_fdeltaColorMouseDown");

            colBackground    = GetSetting("ifc_colBackground");
            colForeground    = GetSetting("ifc_colText");
            colSelection     = GetSetting("ifc_colSelection");
            colSelectionText = GetSetting("ifc_colSelectionText");
            colMouseOver     = ColorHSV.ModifyValue(colBackground, fdeltaColorMouseOver, !bLightTheme);
            colMouseDown     = ColorHSV.ModifyValue(colBackground, fdeltaColorMouseDown, !bLightTheme);
            colAccent        = GetSetting("ifc_colAccent");
            colBorder        = GetSetting("ifc_colBorder");

            strFont = GetSetting("ifc_strFont");

            bBorders    = GetSetting("ifc_bBorders");
            borderStyle = bBorders ? BorderStyle.FixedSingle : BorderStyle.None;

            root.BackColor = colBackground;

            if (root.ForeColor != Color.OrangeRed && root.ForeColor != colAccent)
            {
                root.ForeColor = colForeground;
            }

            if (root.Font.FontFamily.Name != "Webdings" && !(root is Form) && !root.HasChildren)
            {
                try {
                    //TODO: This is really slow, can we speed it up somehow?
                    root.Font = new Font(new FontFamily(strFont), root.Font.Size, root.Font.Style);
                } catch { }
            }

            if (root is ExtendedPanel || typeof(ExtendedPanel).IsAssignableFrom(root.GetType()))
            {
                ExtendedPanel panel = (ExtendedPanel)root;
                panel.BorderStyle = BorderStyle.None;
                panel.BorderColor = colBorder;
                if (panel.HasBorders && panel.AutoScroll && panel.Name != "container")
                {
                    // special case: we have to wrap this panel inside of another panel for the border to not mess up when scrolling
                    ExtendedPanel container = new ExtendedPanel();
                    container.Name        = "container";
                    container.Left        = panel.Left;
                    container.Top         = panel.Top;
                    container.Width       = panel.Width;
                    container.Height      = panel.Height;
                    container.BackColor   = panel.BackColor;
                    container.ForeColor   = panel.ForeColor;
                    container.BorderStyle = panel.BorderStyle;
                    container.HasBorders  = panel.HasBorders;
                    container.BorderColor = panel.BorderColor;
                    container.Anchor      = panel.Anchor;
                    Control parent = panel.Parent;
                    container.Controls.Add(panel);
                    parent.Controls.Add(container);
                    panel.HasBorders = false;
                    panel.Location   = new Point(1, 1);
                    panel.Size       = new Size(container.Width - 2, container.Height - 2);
                    panel.Anchor     = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
                }
            }
            else if (root is Panel)
            {
                //TODO: Move these to some configurable array instead of hardcoding them in Nimble.dll...
                if (root.Name != "panelTopBar" && root.Name != "panelFormatting")
                {
                    Panel panel = (Panel)root;
                    panel.BorderStyle = borderStyle;
                }
            }

            if (root is FlatGroupBox)
            {
                FlatGroupBox box = (FlatGroupBox)root;
                box.BorderColor = colBorder;
                box.HasBorders  = bBorders;
            }

            if (root is FlatButton)
            {
                FlatButton btn = (FlatButton)root;
                btn.BackColorOver = colMouseOver;
                btn.BackColorDown = colMouseDown;
                btn.BorderColor   = colBorder;
                btn.HasBorder     = bBorders;
            }

            if (root is ExtendedTextBox)
            {
                ExtendedTextBox text = (ExtendedTextBox)root;
                text.HasBorders        = bBorders;
                text.BorderColor       = colBorder;
                text.BorderColorActive = colBorder;
            }

            if (root is DrawBox)
            {
                DrawBox db = (DrawBox)root;
                db.HasBorders     = bBorders;
                db.BorderColor    = colBorder;
                db.ColorPrimary   = colAccent;
                db.ColorSecondary = colBorder;
            }

            if (root is DraggablePictureBox)
            {
                DraggablePictureBox dpb = (DraggablePictureBox)root;
                dpb.BorderStyle = BorderStyle.None;
                dpb.HasBorders  = bBorders;
                dpb.BorderColor = colBorder;
            }

            if (root is FlatScrollbar)
            {
                FlatScrollbar scrollbar = (FlatScrollbar)root;
                scrollbar.BorderColor     = bBorders ? colBorder : Color.Empty;
                scrollbar.FillColor       = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarFill"), !bLightTheme);
                scrollbar.HandleMargin    = GetSetting("ifc_fScrollbarHandleMargin");
                scrollbar.HandleColor     = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarHandle"), !bLightTheme);
                scrollbar.HandleGripColor = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarHandleGrip"), !bLightTheme);
                scrollbar.HandleGripCount = GetSetting("ifc_iScrollbarHandleCount");
                scrollbar.GuidelineColor  = ColorHSV.ModifyValue(colBackground, GetSetting("ifc_fdeltaColorScrollbarGuideline"), !bLightTheme);
            }

            if (root is FlatList)
            {
                FlatList list = (FlatList)root;
                list.BorderColor        = bBorders ? colBorder : Color.Empty;
                list.HoverColor         = colMouseOver;
                list.SelectionColor     = colSelection;
                list.SelectionTextColor = colSelectionText;
                list.BorderStyle        = borderStyle;
                list.ForeColorSub       = ColorHSV.ModifyValue(colForeground, GetSetting("ifc_fdeltaColorListSubtext"), !bLightTheme);
                list.FontSub            = new Font(list.Font.FontFamily, list.Font.Size * GetSetting("ifc_fListSubtextScale"));
            }

            if (root is FlatArrowContainer)
            {
                FlatArrowContainer fac = (FlatArrowContainer)root;
                fac.BorderColor = bBorders ? colBorder : Color.Empty;
            }

            if (root is FlatNumberBox)
            {
                FlatNumberBox numbox = (FlatNumberBox)root;
                numbox.ButtonBackColor     = colBackground;
                numbox.ButtonBackColorDown = colMouseDown;
                numbox.ButtonBackColorOver = colMouseOver;
                numbox.BorderColor         = colBorder;
                //numbox.ButtonsVertical = false; //TODO: Make this a setting
            }

            if (root is ExtendedComboBox)
            {
                ExtendedComboBox combo = (ExtendedComboBox)root;
                combo.FlatStyle           = FlatStyle.Popup;
                combo.HasBorders          = bBorders;
                combo.BorderColor         = colBorder;
                combo.BorderColorActive   = colBorder;
                combo.BorderColorDisabled = colBorder;
            }

            if (root is DraggableGraph)
            {
                DraggableGraph graph = (DraggableGraph)root;
                graph.DotColor    = colAccent;
                graph.LineColor   = ColorHSV.ModifyValue(colAccent, 0.25, !bLightTheme);
                graph.BorderColor = colBorder;
            }

            CustomCallback?.Invoke(root);

#if DEBUG
            if (root.GetType() == typeof(TextBox) ||
                root.GetType() == typeof(ComboBox) ||
                root.GetType() == typeof(TreeView))
            {
                System.Diagnostics.Debug.Assert(false, "Generic WinForms control of type '" + root.GetType().Name + "' found: " + root.Name + " - can you replace it with its (fixed and better working) extended version?");
            }
            if (root is ListBox ||
                root is ListView ||
                root is NumericUpDown ||
                root is Button)
            {
                System.Diagnostics.Debug.Assert(false, "Generic WinForms control of type '" + root.GetType().Name + "' found: " + root.Name + " - can you replace it with a flat control?");
            }
#endif

            // ignore if this is in a different namespace
            //TODO: ScintillaNET is caught on this, we should replace the inline find/replace thing with a custom one!
            string ns = root.GetType().Namespace;
            if (ns == "System.Windows.Forms" || ns.StartsWith("Nimble.") || (Namespace == null || ns.StartsWith(Namespace)))
            {
                foreach (Control ctl in root.Controls)
                {
                    InterfaceThemeControl(ctl);
                }
            }
        }
Esempio n. 8
0
        protected override void InitializeComponent()
        {
            form        = new SquareForm("Login shit");
            form.Height = 599;
            form.Width  = 750;

            Panel panel = new Panel
            {
                Name = "logo",
                BackgroundImageLayout = ImageLayout.Center,
                BackgroundImage       = Image.FromFile("logo.jpg"),
                Width  = 400,
                Height = 400
            };

            form.Controls.Add(panel);

            FlatPanel panelMain = new FlatPanel("main")
            {
                AutoSize     = true,
                AutoSizeMode = AutoSizeMode.GrowOnly,
                Dock         = System.Windows.Forms.DockStyle.None,
                BackColor    = colors.LightGray1,
                Padding      = new Padding(1),
                Left         = panel.Width,
            };

            form.Controls.Add(panelMain);


            FlatPanel panelLogin = new FlatPanel("main")
            {
                AutoSize  = true,
                Dock      = System.Windows.Forms.DockStyle.None,
                BackColor = colors.LighterGray1,
                Padding   = new Padding(20),
                Location  = new Point(1, 1)
            };

            panelMain.Controls.Add(panelLogin);


            // Don't touch in order to don't mess the center alignment

            FlatLabelTitle title = new FlatLabelTitle("Sign in", 0, 20);

            panelLogin.Controls.Add(title);

            FlatTextBoxAutoFocus _ = new FlatTextBoxAutoFocus("_");

            panelLogin.Controls.Add(_);

            FlatPanel panelTxtName = new FlatPanel("Name")
            {
                AutoSize     = true,
                AutoSizeMode = new AutoSizeMode(),
                Dock         = System.Windows.Forms.DockStyle.None,
                BackColor    = colors.White1,
                Padding      = new Padding(4)
            };

            panelTxtName.Location = new Point(20, 70);

            FlatTextBox txtName = new FlatTextBox("Name", 4, 4);

            panelTxtName.Controls.Add(txtName);
            panelLogin.Controls.Add(panelTxtName);


            FlatPanel panelTxtPassword = new FlatPanel("Password")
            {
                AutoSize     = true,
                AutoSizeMode = new AutoSizeMode(),
                Dock         = System.Windows.Forms.DockStyle.None,
                BackColor    = colors.White1,
                Padding      = new Padding(4),
            };

            panelTxtPassword.Location = new Point(20, 110);

            FlatTextBox txtPassword = new FlatTextBox("Password", 4, 4);

            panelTxtPassword.Controls.Add(txtPassword);


            panelLogin.Controls.Add(panelTxtPassword);

            button = new FlatButton("Log in");
            panelLogin.Controls.Add(button);


            button.Width    = panelTxtName.Width;
            button.Location = new Point(20, button.Parent.Height + 20);
            button.Click   += new System.EventHandler(TryLogin);

            panelLogin.Height += button.Height + 30;

            int positionX = centerElement.Horizontal(title.Size.Width, panelLogin.ClientSize.Width);

            title.Location = new System.Drawing.Point(positionX, title.Location.Y);

            panelMain.Top = centerElement.Vertical(panelMain.Height, form.ClientSize.Height);

            panelLogin.Controls.Add(
                new FlatLabelError("Oops! It looks like you may have forgotten your password.", 0, button.Height + 30)
            {
                Dock        = DockStyle.Bottom,
                MaximumSize = new Size(panelLogin.Width - 40, 0),
                Visible     = false
            }
                );
        }
Esempio n. 9
0
        //Requests====================================================================================
        void asyncRequest(String methodName, params object[] param)
        {
            if (param == null)
            {
                param = new object[] { }
            }
            ;
            this.handles.Add(this.client.AsyncRequest(methodName, param, asyncResult), methodName);
        }

        void asyncRequest(GbxCallCallbackHandler handler, String methodName, params object[] param)
        {
            if (param == null)
            {
                param = new object[] { }
            }
            ;
            this.client.AsyncRequest(methodName, param, handler);
        }

        void asyncRequest(String methodName, GbxCallCallbackHandler handler)
        {
            this.client.AsyncRequest(methodName, new object[] { }, handler);
        }

        //Main Async results==========================================================================
        void asyncResult(GbxCall res)
        {
            //Manage result------------------------------------------------------------------------
            try
            {
                if (this.handles.ContainsKey(res.Handle) && !res.Error)
                {
                    switch (this.handles[res.Handle])
                    {
                        #region "Server Infos"
                    //////////////////////////////////////////////////////////////////////////////////////////////////////
                    // Server Infos /////////////////////////////////////////////////////////////////////////////////////
                    ////////////////////////////////////////////////////////////////////////////////////////////////////
                    case GetScriptName:
                        var    htscript = res.getHashTable();
                        string script   = (string)htscript["CurrentValue"];
                        if (script.Contains(".Script.txt"))
                        {
                            script = subsep(script, 0, ".");
                        }
                        setLabel(this.l_gameMode, "GameMode : " + script);

                        this.isTM = Enum.TryParse(script, out this.tmGameMode);
                        if (this.isTM)
                        {
                            foreach (TMGameMode suit in (TMGameMode[])Enum.GetValues(typeof(TMGameMode)))
                            {
                                appendCombo(cb_serverGMScript, suit.ToString());
                            }
                        }
                        else
                        {
                            if (Enum.TryParse(script, out this.smGameMode))
                            {
                                foreach (SMGameMode suit in (SMGameMode[])Enum.GetValues(typeof(SMGameMode)))
                                {
                                    appendCombo(cb_serverGMScript, suit.ToString());
                                }
                            }
                            else
                            {
                                //Show select game dialog
                            }
                        }
                        break;

                    case GetMapList:
                        Hashtable maps = res.getHashTable();
                        clearDg(dg_map);
                        foreach (Hashtable map in maps)
                        {
                            addDgRow(dg_map, ManiaColors.getText((string)map["Name"]), map["Author"], map["Environnement"], map["LadderRanking"]);
                        }
                        break;

                    case GetCurrentMapIndex:
                        if (this.currentMapId != -1)
                        {
                            this.previousMapId = this.currentMapId;
                        }
                        this.currentMapId = (int)res.Params[0];
                        break;

                    case SetScriptName:
                        if ((bool)res.Params[0])
                        {
                            setLabel(this.l_gameMode, "GameMode: " + this.cb_serverGMScript.Text);
                        }

                        break;
                        #endregion

                        #region "Chat"
                    //////////////////////////////////////////////////////////////////////////////////////////////////////
                    // Chat /////////////////////////////////////////////////////////////////////////////////////////////
                    ////////////////////////////////////////////////////////////////////////////////////////////////////
                    case GetChatLines:

                        clearConsole();
                        var al = (ArrayList)res.Params[0];
                        foreach (object o in al)
                        {
                            string als = (string)o;
                            if (als.Contains("$>") && als.Contains("$<"))
                            {
                                als = delseps(als, "[", "<");
                                als = als.Replace("$>]", "$000 :$fff");
                            }
                            chatColors.write(als + "\n");
                        }
                        break;


                        #endregion

                        #region "Players List"
                    //////////////////////////////////////////////////////////////////////////////////////////////////////
                    // Players List /////////////////////////////////////////////////////////////////////////////////////
                    ////////////////////////////////////////////////////////////////////////////////////////////////////

                    case GetPlayerList:
                        ArrayList userList = (ArrayList)res.Params[0];
                        clearList(l_users);
                        clearDg(dg_users);
                        this.nbPlayers = userList.Count;
                        setLabel(l_players, "Players : " + this.nbPlayers + "/" + this.maxPlayers);
                        foreach (Hashtable user in userList)
                        {
                            this.playerList.Add(new SPlayerInfo {
                                Login    = (string)user["Login"],
                                NickName = (string)user["NickName"],
                                PlayerId = (int)user["PlayerId"],
                                //...............
                            });
                            addDgRow(dg_users, user["PlayerId"], ManiaColors.getText((string)user["NickName"]), user["Login"], user["LadderRanking"]);
                            appendList(l_users, ManiaColors.getText((string)user["NickName"]));
                        }
                        break;

                    case SendDisplayManialinkPageToId:

                        break;

                    case GetGuestList:
                        break;

                    case GetBlackList:
                        break;

                    case GetBanList:
                        break;
                        #endregion
                    }
                }
                else
                {
                    if (res.Error)
                    {
                        Lama.log("ERROR", "Answer for handle n° " + res.Handle + " named '" + this.handles[res.Handle] + "' Returned Error : " + res.ErrorString);
                    }
                }
                //Send to plugins --------------------------------------------------------------------------------
                foreach (InGamePlugin plug in Lama.inGamePlugins)
                {
                    try
                    {
                        plug.onGbxAsyncResult(res);
                    }
                    catch (Exception e)
                    {
                        Lama.log("ERROR", "Plugins " + plug.PluginName + " throws Gbx Error :" + e.Message);
                    }
                }

                this.handles.Remove(res.Handle);
            }
            catch (Exception e)
            {
                Lama.log("ERROR", "Answer for handle n°" + res.Handle + " throws a " + e.GetType().Name + "Exception : " + e.Message);
            }
        }

        //Specific AsyncResult
        void checkError(GbxCall res)
        {
            if (res.Error)
            {
                Lama.onError(this, "Error", "Error " + res.ErrorCode + " : " + res.ErrorString + "\n from request : " + res.MethodName);
            }
        }

        void getServerOptions(GbxCall res)
        {
            Hashtable ht = res.getHashTable();

            setLabel(l_serverName, "Name : " + ManiaColors.getText((string)ht["Name"]));
            setLabel(l_serverDescritpion, "Description : " + ManiaColors.getText((string)ht["Comment"]));
            this.maxPlayers    = (int)ht["CurrentMaxPlayers"];
            this.maxSpectators = (int)ht["CurrentMaxSpectators"];

            //Fill ServerOptions Tab
            setTextBoxText(tb_ingameName, (string)ht["Name"]);
            setTextBoxText(tb_description, (string)ht["Comment"]);
            setTextBoxText(tb_playerPass, (string)ht["Password"]);
            setTextBoxText(tb_specPass, (string)ht["PasswordForSpectator"]);

            setNumeric(n_playersLimit, maxPlayers);
            setNumeric(n_specsLimit, maxSpectators);

            setTextBoxText(tb_refereePass, (string)ht["RefereePassword"]);
            //TODO comboboxReferee

            setNumeric(n_voteTimeout, (int)ht["NextCallVoteTimeOut"]);

            setTextBoxText(tb_voteRatio, (string)ht["NextCallVoteRatio"]);

            int lm = (int)ht["NextLadderMode"];

            setCheckBox(ch_ladder, (lm == 1));
            setCheckBox(ch_p2pUp, (bool)ht["IsP2PUpload"]);
            setCheckBox(ch_p2pDown, (bool)ht["IsP2PDownload"]);
            setCheckBox(ch_autoSaveReplay, false);
            setCheckBox(ch_saveValReplay, false);
            setCheckBox(ch_keepPlayerSlot, false);
            setCheckBox(ch_mapDown, false);
            setCheckBox(ch_horns, false);
        }

        void getCurrentGameInfo(GbxCall res)
        {
            Hashtable ht = res.getHashTable();
        }

        void getModeScriptSettings(GbxCall res)
        {
            Hashtable ht = res.getHashTable();

            foreach (string key in ht.Keys)
            {
                switch (getType(ht[key]))
                {
                case 0:    //String
                    this.flowLayoutPanel1.Controls.Add(new StringScriptSetting(key, key, (string)ht[key]));
                    break;

                case 1:    //Int
                    this.flowLayoutPanel1.Controls.Add(new NumericScriptSetting(key, key, (int)ht[key]));
                    break;

                case 2:    //Bool
                    this.flowLayoutPanel1.Controls.Add(new BooleanScriptSetting(key, key, (bool)ht[key]));
                    break;

                case 3:    //Double
                    this.flowLayoutPanel1.Controls.Add(new DoubleScriptSetting(key, key, (double)ht[key]));
                    break;

                case -1:    //Unknown
                    Lama.log("ERROR", "Unable to get ScriptSetting type of : " + key + " : " + key.GetType());
                    break;
                }
            }
        }

        //CallBacks=============================================================================================
        void gbxCallBack(object sender, GbxCallbackEventArgs args)
        {
            switch (args.Response.MethodName)
            {   //Race & Map infos
                #region "Server"
            case "ManiaPlanet.ServerStart":

                break;

            case "ManiaPlanet.ServerStop":

                break;

            case "ManiaPlanet.StatusChanged":

                break;

            case "ManiaPlanet.TunnelDataReceived":

                break;

            case "ManiaPlanet.Echo":

                break;

            case "ManiaPlanet.BillUpdated":

                break;

                #endregion

                #region "Scripts"
            case "ModeScriptCallback":

                break;

            case "ModeScriptCallbackArray":

                break;

            case "ScriptCloud.LoadData":

                break;

            case "ScriptCloud.SaveData":

                break;
                #endregion

                #region "ManiaPlanetMap"
            case "ManiaPlanet.BeginMap":
                setLabelColor(l_map, Color.Green);
                break;

            case "ManiaPlanet.BaginMatch":
                setLabelColor(l_map, Color.Green);
                break;

            case "ManiaPlanet.EndMap":
                setLabelColor(l_map, Color.Red);
                break;

            case "ManiaPlanet.EndMatch":
                setLabelColor(l_map, Color.Orange);
                break;

                #endregion

                #region "Race"

            case "TrackMania.EndRace":
                setLabelColor(l_map, Color.Orange);
                break;

            case "TrackMania.EndRound":

                break;

            case "TrackMania.ChallengeListModified":

                break;

            case "TrackMania.EndChallenge":
                setLabelColor(l_map, Color.Red);
                break;

            case "TrackMania.StatusChanged":
                int statusCode = (int)args.Response.Params[0];
                setLabel(this.l_server, "Status : " + getStatus(statusCode));
                break;


            case "TrackMania.BeginChallenge":

                setLabelColor(l_map, Color.Green);
                var ht = (Hashtable)args.Response.Params[0];
                setLabel(l_map, "GameInfo : " + ManiaColors.getText((string)ht["Name"]));
                asyncRequest("GetCurrentMapIndex");
                break;

            case "TrackMania.BeginRace":
                break;

                #endregion

                #region "Player"
            case "TrackMania.PlayerConnect":
                asyncRequest("GetPlayerList", this.maxPlayers + this.maxSpectators, 0);
                break;

            case "TrackMania.PlayerDisconnect":
                asyncRequest("GetPlayerList", this.maxPlayers + this.maxSpectators, 0);
                break;

            case "ManiaPlanet.PlayerChat":
            case "TrackMania.PlayerChat":
                var htPlayerChat = args.Response.Params;
                chatColors.write(htPlayerChat[1] + "$fff : " + htPlayerChat[2] + "\n");
                break;

            case "TrackMania.PlayerInoChanged":

                break;

            case "TrackMania.PlayerAllies":

                break;

            case "TrackMania.PlayerManialinkPageAnswer":

                break;

            case "TrackMania.PlayerCheckpoint":

                break;

            case "TrackMania.PlayerFinish":

                break;

            case "TrackMania.PlayerIncoherence":

                break;
                #endregion
            }

            //Send to plugins----------------------------------------------------------------------
            foreach (InGamePlugin plug in Lama.inGamePlugins)
            {
                plug.onGbxCallBack(sender, args);
            }
        }

        void gbxDisconnect(object sender)
        {
            FlatButton but = (FlatButton)getControl(this.b_xmlrpcConnect);

            but.BaseColor = Color.Green;
            enableControl(but, true);
            but.Enabled   = true;
            but           = (FlatButton)getControl(this.b_serverStarted);
            but.BaseColor = Color.Green;
            enableControl(but, true);
            this.netStatsTimer.Stop();
        }

        #endregion

        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Autres Methodes /////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

        #region "Other Methods"

        string getStatus(int code)
        {
            switch (code)
            {
            case 3:
                return("Running - Synchronisation");

            case 4:
                return("Running - Play");

            default:
                return(code.ToString());
            }
        }
Esempio n. 10
0
 public static void SelectButtonTab(TableLayoutPanel tablePanel, FlatButton button)
 {
     SelectedButtonTheme(button);
     DeselectTabButton(tablePanel, button);
 }
Esempio n. 11
0
        protected override void SetupUserInterface()
        {
            View.BackgroundColor   = MobileCore.Values.Colors.LightGray.ToNative();
            EdgesForExtendedLayout = UIRectEdge.None;

            logo = new UIImageView(UIImage.FromFile("logo.png"));
            Add(logo);

            username = new JVFloatLabeledTextField(RectangleF.Empty)
            {
                Placeholder = MobileCore.Values.Strings.Login_Username,
                FloatingLabelActiveTextColor = MobileCore.Values.Colors.Orange.ToNative(),
                BorderStyle  = UITextBorderStyle.RoundedRect,
                KeyboardType = UIKeyboardType.EmailAddress
            };
            username.RoundedViewBackground(MobileCore.Values.Colors.White.ToNative());
            Add(username);

            password = new JVFloatLabeledTextField(RectangleF.Empty)
            {
                SecureTextEntry = true,
                Placeholder     = MobileCore.Values.Strings.Login_Password,
                FloatingLabelActiveTextColor = MobileCore.Values.Colors.Orange.ToNative(),
                BorderStyle = UITextBorderStyle.RoundedRect,
            };
            password.RoundedViewBackground(MobileCore.Values.Colors.White.ToNative());
            Add(password);

            login = new FlatButton(RectangleF.Empty);
            login.SetTitle(MobileCore.Values.Strings.Login_Login, UIControlState.Normal);
            login.TintColor = MobileCore.Values.Colors.White.ToNative();
            login.SetBackgroundColor(MobileCore.Values.Colors.DarkGray.ToNative(), UIControlState.Normal);
            Add(login);

            createNewAccount = new UIButton(UIButtonType.System);
            createNewAccount.SetTitle(MobileCore.Values.Strings.Login_CreateNewAccount, UIControlState.Normal);
            Add(createNewAccount);

            forgotPassword = new UIButton(UIButtonType.System);
            forgotPassword.SetTitle(MobileCore.Values.Strings.Login_ForgotPassword, UIControlState.Normal);
            Add(forgotPassword);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                logo.AtTopOf(View, Constants.Layout.VerticalPadding * 4f),
                logo.WithSameCenterX(View),

                username.Below(logo, Constants.Layout.VerticalPadding),
                username.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                username.AtRightOf(View, Constants.Layout.HorizontalPadding),
                username.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                password.Below(username, Constants.Layout.VerticalPadding),
                password.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                password.AtRightOf(View, Constants.Layout.HorizontalPadding),
                password.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                login.Below(password, Constants.Layout.VerticalPadding),
                login.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                login.AtRightOf(View, Constants.Layout.HorizontalPadding),
                login.Height().EqualTo(Constants.Layout.MinimumTouchControlSize),

                createNewAccount.Below(login, Constants.Layout.VerticalPadding),
                createNewAccount.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                createNewAccount.AtRightOf(View, Constants.Layout.HorizontalPadding),

                forgotPassword.Below(createNewAccount, Constants.Layout.VerticalPadding),
                forgotPassword.AtLeftOf(View, Constants.Layout.HorizontalPadding),
                forgotPassword.AtRightOf(View, Constants.Layout.HorizontalPadding)
                );
        }
Esempio n. 12
0
        static void GetSelectedTab(TabControl tabControl, FlatButton button)
        {
            var selectedButton = button.Text;

            tabControl.SelectTab("tp" + selectedButton.Replace(" ", ""));
        }
Esempio n. 13
0
        internal void TabPagesChanged()
        {
            //This is called whenever a tab has been added or removed from the TabPages collection.

            //Remove all of the tabs from the control
            foreach (Control mycontrol in Controls)
            {
                if (ReferenceEquals(mycontrol.GetType(), typeof(LcarsTabPage)))
                {
                    Controls.Remove(mycontrol);
                }
            }

            //Remove the tab's button from the buttonPanel.
            tabButtonPanel.Controls.Clear();

            //Add all of the tabs back to the control, so now the new ones are there, too
            //(or old ones are gone...)
            foreach (LcarsTabPage mytab in TabPages)
            {
                Controls.Add(mytab);

                //Set the size of the tab equal to the area we want the tab to cover.  Basically,
                //everwhere our heading, elbow, and buttonpanel are not.

                mytab.Width  = Width - tabButtonPanel.Width - spacing * 2;
                mytab.Height = Height - (horizantalBar.Height + spacing);

                switch (elbowStyle)
                {
                case LcarsElbowStyle.UpperRight:
                    mytab.Location = new Point(0, horizantalBar.Height + spacing);
                    break;

                case LcarsElbowStyle.UpperLeft:
                    mytab.Location = new Point(Width - mytab.Width, horizantalBar.Height + spacing);
                    break;

                case LcarsElbowStyle.LowerRight:
                    mytab.Location = new Point(0, 0);
                    break;

                case LcarsElbowStyle.LowerLeft:
                    mytab.Location = new Point(Width - mytab.Width, 0);
                    break;
                }

                //Set the anchor so the tab will resize with the tabcontrol
                mytab.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;

                //Now that we have the tab added to the tab control, we need to create a button
                //that will bring it to the front when the user clicks it.
                FlatButton mybutton = new FlatButton();
                mybutton.Width           = verticalBarWidth;
                mybutton.Height          = tabButtonHeight;
                mybutton.Left            = 0;
                mybutton.ForceCaps       = ForceCaps;
                mybutton.Text            = mytab.Text;
                mybutton.ButtonTextAlign = ContentAlignment.BottomRight;
                mybutton.ColorFunction   = mytab.ColorFunction;

                mybutton.DoesSound  = true;
                mybutton.SoundAsset = Assets.Access.LcarsSoundAsset.RandomProcessing;

                //position the button based on how many buttons are already there.
                switch (elbowStyle)
                {
                case LcarsElbowStyle.UpperRight:
                case LcarsElbowStyle.UpperLeft:
                    mybutton.Top    = tabButtonPanel.Controls.Count * (tabButtonHeight + spacing);
                    mybutton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
                    break;

                case LcarsElbowStyle.LowerRight:
                case LcarsElbowStyle.LowerLeft:
                    mybutton.Top    = tabButtonPanel.Height - ((tabButtonPanel.Controls.Count + 1) * (tabButtonHeight + spacing)) + spacing;
                    mybutton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
                    break;
                }

                //By setting the button's 'Tag' property to the Tab it is associated with,
                //we can easily tell what button goes with what tab.
                mybutton.Tag = mytab;

                //Make the button call "TabButton_Click" whenever someone clicks on it.
                mybutton.Click += TabButton_Click;
                tabButtonPanel.Controls.Add(mybutton);
            }

            //If there's any room left after all of tabs have been made, we need to fill the
            //empty space with another button that isn't clickable.
            if ((tabButtonPanel.Controls.Count * (tabButtonHeight + spacing)) < tabButtonPanel.Height)
            {
                FlatButton myButton = new FlatButton();

                myButton.Width = verticalBarWidth;

                switch (elbowStyle)
                {
                case LcarsElbowStyle.UpperRight:
                    myButton.Top             = tabButtonPanel.Controls.Count * (tabButtonHeight + spacing);
                    myButton.Height          = tabButtonPanel.Height - myButton.Top;
                    myButton.ButtonTextAlign = ContentAlignment.BottomRight;
                    myButton.Anchor          = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
                    break;

                case LcarsElbowStyle.UpperLeft:
                    myButton.Top             = tabButtonPanel.Controls.Count * (tabButtonHeight + spacing);
                    myButton.Height          = tabButtonPanel.Height - myButton.Top;
                    myButton.ButtonTextAlign = ContentAlignment.BottomLeft;
                    myButton.Anchor          = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
                    break;

                case LcarsElbowStyle.LowerRight:
                    myButton.Top             = 0;
                    myButton.Height          = tabButtonPanel.Height - (tabButtonPanel.Controls.Count * (tabButtonHeight + spacing));
                    myButton.ButtonTextAlign = ContentAlignment.TopRight;
                    myButton.Anchor          = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
                    break;

                case LcarsElbowStyle.LowerLeft:
                    myButton.Top             = 0;
                    myButton.Height          = tabButtonPanel.Height - (tabButtonPanel.Controls.Count * (tabButtonHeight + spacing));
                    myButton.ButtonTextAlign = ContentAlignment.TopLeft;
                    myButton.Anchor          = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
                    break;
                }

                myButton.TextVisible   = false;
                myButton.ColorFunction = LcarsColorFunction.StaticTan;
                myButton.Clickable     = false;
                tabButtonPanel.Controls.Add(myButton);
            }

            //If the "SelectedTab" property isn't set, then select the first tab added to the control.
            if (SelectedTab == null | TabPages.Contains(SelectedTab) == false)
            {
                if (TabPages.Count > 0)
                {
                    SelectedTab = TabPages[0];
                }
                else
                {
                    SelectedTab = null;
                }
            }

            //There's a label placed on the form if no tabs have been added that explains how to
            //add tabs to the control.  This message is only shown if there are no tabs and the
            //control is in 'Design Time' (not executing, but rather in the designer).
            if (TabPages.Count > 0)
            {
                designerMessage.Visible = false;
            }
            else
            {
                designerMessage.Visible = true;
            }

            //Bring the tab that is currently set as selected to the front.
            ChangeTab(selectedTab);
        }
Esempio n. 14
0
        public LcarsMessageBox(object prompt, string title, MessageBoxButtons buttons, MessageBoxIcon icon)
        {
            buttonStyle = buttons;
            bool cancelVisible = false;
            bool abortVisible  = false;
            bool retryVisible  = false;
            bool ignoreVisible = false;
            bool yesVisible    = false;
            bool noVisible     = false;
            int  okx           = 183;
            int  cx            = 50;

            switch (buttons)
            {
            case MessageBoxButtons.OKCancel:
                cancelVisible = true;
                break;

            case MessageBoxButtons.AbortRetryIgnore:
                abortVisible  = true;
                retryVisible  = true;
                ignoreVisible = true;
                // cancelEnabled = true;
                cx  = 210;
                okx = 115;
                break;

            case MessageBoxButtons.RetryCancel:
                retryVisible  = true;
                cancelVisible = true;
                break;

            case MessageBoxButtons.YesNo:
                yesVisible = true;
                noVisible  = true;
                okx        = 210;
                cx         = 115;
                break;

            case MessageBoxButtons.YesNoCancel:
                cancelVisible = true;
                yesVisible    = true;
                noVisible     = true;
                okx           = 210;
                cx            = 115;
                break;
            }

            LcarsColorFunction colorFunction;

            switch (icon)
            {
            case MessageBoxIcon.Error:
                //vbCritical
                colorFunction = LcarsColorFunction.FunctionOffline;
                // pass redAlert() to LCARSmain if exists.
                break;

            case MessageBoxIcon.Question:
                //vbQuestion
                colorFunction = LcarsColorFunction.StaticBlue;
                break;

            case MessageBoxIcon.Exclamation:
                //vbExclamation
                colorFunction = LcarsColorFunction.StaticTan;
                break;

            case MessageBoxIcon.Information:
                //vbInformation
                colorFunction = LcarsColorFunction.LCARSDisplayOnly;
                break;

            default:
                colorFunction = LcarsColorFunction.StaticTan;
                break;
            }

            FormBorderStyle = FormBorderStyle.None;
            Size            = new Size(305, 200);
            BackColor       = Color.Black;
            StartPosition   = FormStartPosition.CenterScreen;
            TopMost         = true;

            Elbow elbow1 = new Elbow();

            Controls.Add(elbow1);
            elbow1.Location            = new Point(0, 0);
            elbow1.Size                = new Size(80, 60);
            elbow1.HorizantalBarHeight = 30;
            elbow1.VerticalBarWidth    = 10;
            elbow1.ElbowStyle          = LcarsElbowStyle.UpperLeft;
            elbow1.ColorFunction       = colorFunction;
            elbow1.Text                = "";

            Elbow elbow2 = new Elbow();

            Controls.Add(elbow2);
            elbow2.Location            = new Point(0, 140);
            elbow2.Size                = new Size(80, 60);
            elbow2.HorizantalBarHeight = 15;
            elbow2.VerticalBarWidth    = 10;
            elbow2.Clickable           = false;
            elbow2.ElbowStyle          = LcarsElbowStyle.LowerLeft;
            elbow2.ColorFunction       = colorFunction;
            elbow2.Text                = "";

            TextButton titleBar = new TextButton();

            Controls.Add(titleBar);
            titleBar.Location      = new Point(50, 0);
            titleBar.Size          = new Size(255, 30);
            titleBar.TextHeight    = 31;
            titleBar.ColorFunction = colorFunction;
            titleBar.Text          = title;

            FlatButton vertBar = new FlatButton();

            Controls.Add(vertBar);
            vertBar.Location      = new Point(0, 66);
            vertBar.Size          = new Size(10, 68);
            vertBar.Clickable     = false;
            vertBar.ColorFunction = colorFunction;
            vertBar.Text          = "";

            HalfPillButton bottomBar = new HalfPillButton();

            Controls.Add(bottomBar);
            bottomBar.Location      = new Point(85, 185);
            bottomBar.Size          = new Size(217, 15);
            bottomBar.Clickable     = false;
            bottomBar.ColorFunction = colorFunction;
            bottomBar.Text          = "";

            //draw text
            RichTextBox errorTextBox = new RichTextBox();

            Controls.Add(errorTextBox);
            errorTextBox.Location    = new Point(30, 36);
            errorTextBox.Size        = new Size(243, 107);
            errorTextBox.BackColor   = Color.Black;
            errorTextBox.BorderStyle = BorderStyle.None;
            errorTextBox.WordWrap    = true;
            errorTextBox.Font        = FontProvider.Lcars(14);
            errorTextBox.ForeColor   = Color.Orange;
            errorTextBox.BringToFront();
            errorTextBox.Text     = prompt.ToString();
            errorTextBox.ReadOnly = true;

            // BUTTONS

            //draw OK/Yes/retry button
            StandardButton yesOkRetryButton = new StandardButton();

            Controls.Add(yesOkRetryButton);

            yesOkRetryButton.Location      = new Point(okx, 149);
            yesOkRetryButton.Size          = new Size(90, 30);
            yesOkRetryButton.ColorFunction = LcarsColorFunction.PrimaryFunction;
            yesOkRetryButton.Name          = "yesOkRetryButton";
            if (yesVisible)
            {
                yesOkRetryButton.Text   = "YES";
                yesOkRetryButton.Click += OnYesClick;
            }
            else if (retryVisible)
            {
                yesOkRetryButton.Text   = "RETRY";
                yesOkRetryButton.Click += OnRetryClick;
            }
            else
            {
                yesOkRetryButton.Text   = "OK";
                yesOkRetryButton.Click += OnOkClick;
            }
            yesOkRetryButton.ButtonTextAlign = ContentAlignment.MiddleCenter;
            yesOkRetryButton.BringToFront();

            if (cancelVisible || ignoreVisible)
            {
                StandardButton cancelIgnoreButton = new StandardButton();
                Controls.Add(cancelIgnoreButton);
                cancelIgnoreButton.Location      = new Point(cx, 149);
                cancelIgnoreButton.Size          = new Size(90, 30);
                cancelIgnoreButton.Name          = "cancelIgnoreButton";
                cancelIgnoreButton.ColorFunction = LcarsColorFunction.CriticalFunction;

                if (ignoreVisible)
                {
                    cancelIgnoreButton.Text   = "IGNORE";
                    cancelIgnoreButton.Click += OnIgnoreClick;
                }
                else if (cancelVisible)
                {
                    cancelIgnoreButton.Text   = "CANCEL";
                    cancelIgnoreButton.Click += OnCancelClick;
                }
                cancelIgnoreButton.ButtonTextAlign = ContentAlignment.MiddleCenter;
                cancelIgnoreButton.BringToFront();
            }

            if (abortVisible || noVisible)
            {
                //draw abort/no button
                StandardButton noAbortButton = new StandardButton();
                Controls.Add(noAbortButton);
                noAbortButton.Location      = new Point(20, 149);
                noAbortButton.Size          = new Size(90, 30);
                noAbortButton.ColorFunction = LcarsColorFunction.CriticalFunction;
                if (abortVisible)
                {
                    noAbortButton.Text   = "ABORT";
                    noAbortButton.Click += OnAbortClick;
                }
                else if (noVisible)
                {
                    noAbortButton.Text   = "NO";
                    noAbortButton.Click += OnNoClick;
                }
                noAbortButton.ButtonTextAlign = ContentAlignment.MiddleCenter;
                noAbortButton.BringToFront();
            }

            KeyPreview          = true;
            KeyDown            += Me_KeyDown;
            elbow1.MouseDown   += Title_MouseDown;
            elbow1.MouseMove   += Title_MouseMove;
            titleBar.MouseDown += Title_MouseDown;
            titleBar.MouseMove += Title_MouseMove;
        }
Esempio n. 15
0
        public Window_Archive(DataStore data)
        {
            InitializeComponent();

            datastore = data;

            LoadImages();

            //Load models
            string path = "";

            if (LocalPath.GetDirectoryPath(out path))
            {
                if (Directory.Exists(path + "\\Resources\\"))
                {
                    string mpath = System.IO.Path.Combine(path, "Resources\\Media\\");

                    if (Directory.Exists(mpath))
                    {
                        DirectoryInfo dirInfo = new DirectoryInfo(mpath);

                        FileInfo[] info = dirInfo.GetFiles("*.*");
                        foreach (FileInfo f in info)
                        {
                            StackPanel stackPanel = new StackPanel();
                            stackPanel.Orientation = Orientation.Horizontal;
                            stackPanel.Margin      = new Thickness(0, 0, 0, 5);

                            TextBlock textBlock = new TextBlock();
                            textBlock.Text              = f.Name;
                            textBlock.FontSize          = 14;
                            textBlock.VerticalAlignment = VerticalAlignment.Center;



                            FlatButton Play = new FlatButton();
                            Play.Content = new Image
                            {
                                Source            = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Icons/DeleteFill.png")),
                                VerticalAlignment = VerticalAlignment.Center,
                                Width             = 20,
                                Height            = 20
                            };
                            Delete.Click                   += DeleteMedia_Click;
                            Delete.Margin                   = new Thickness(10, 0, 0, 0);
                            Delete.DefaultBrush             = null;
                            Delete.Hover                    = new SolidColorBrush(Color.FromRgb(240, 98, 146));
                            Delete.ClickBrush               = new SolidColorBrush(Color.FromRgb(233, 30, 99));
                            Delete.Height                   = 24;
                            Delete.Width                    = 24;
                            Delete.Tag                      = f.FullName;
                            Delete.VerticalContentAlignment = VerticalAlignment.Center;

                            stackPanel.Children.Add(textBlock);
                            stackPanel.Children.Add(Play);
                            stackPanel.Children.Add(Delete);
                            MenuMedia_list.Items.Add(stackPanel);
                        }
                    }



                    path = System.IO.Path.Combine(path, "Resources");

                    Debug.WriteLine("Path: " + path);


                    IEnumerable <string> mfiles = Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)
                                                  .Where(s => s.EndsWith(".obj", StringComparison.OrdinalIgnoreCase) || s.EndsWith(".3ds", StringComparison.OrdinalIgnoreCase) ||
                                                         s.EndsWith(".lwo", StringComparison.OrdinalIgnoreCase) || s.EndsWith(".stl", StringComparison.OrdinalIgnoreCase) ||
                                                         s.EndsWith(".off", StringComparison.OrdinalIgnoreCase));


                    foreach (string file in mfiles)
                    {
                        StackPanel panel = new StackPanel();
                        panel.Orientation = Orientation.Horizontal;

                        Label label = new Label();
                        label.Content  = System.IO.Path.GetFileNameWithoutExtension(file);
                        label.FontSize = 15;

                        FlatButton ViewB = new FlatButton();
                        ViewB.Content = new Image
                        {
                            Source            = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Icons/DeleteFill.png")),
                            VerticalAlignment = VerticalAlignment.Center,
                            Width             = 20,
                            Height            = 20
                        };
                        Delete.Click                   += DeleteModel_Click;
                        Delete.Margin                   = new Thickness(10, 0, 0, 0);
                        Delete.DefaultBrush             = null;
                        Delete.Hover                    = new SolidColorBrush(Color.FromRgb(240, 98, 146));
                        Delete.ClickBrush               = new SolidColorBrush(Color.FromRgb(233, 30, 99));
                        Delete.Height                   = 24;
                        Delete.Width                    = 24;
                        Delete.Tag                      = file;
                        Delete.VerticalContentAlignment = VerticalAlignment.Center;


                        panel.Children.Add(label);
                        panel.Children.Add(ViewB);
                        panel.Children.Add(Delete);

                        MenuModels_list.Items.Add(panel);
                    }
                }
            }
        }
Esempio n. 16
0
        public void Reloadbuttons()
        {
            this.Controls.Clear();

            if (_ShowButtons)
            {
                _buttonClear                = new FlatButton();
                _buttonClear.Location       = new Point(3, 3);
                _buttonClear.Text           = "Clear";
                _buttonClear.BackShadeColor = Color.White;
                _buttonClear.BackShadeRatio = 0.1;
                _buttonClear.Click         += new EventHandler((o, e) => {
                    CreateBitmap();
                    CurrentTool = DrawBoxTools.None;
                });
                this.Controls.Add(_buttonClear);

                _buttonBrush                = new FlatButton();
                _buttonBrush.Location       = new Point(_buttonClear.Right + 3, 3);
                _buttonBrush.Text           = "Brush";
                _buttonBrush.BackShadeColor = Color.Yellow;
                _buttonBrush.BackShadeRatio = 0.1;
                _buttonBrush.Click         += new EventHandler((o, e) => {
                    if (CurrentTool == DrawBoxTools.Brush)
                    {
                        CurrentTool = DrawBoxTools.None;
                    }
                    else
                    {
                        CurrentTool = DrawBoxTools.Brush;
                    }
                });
                this.Controls.Add(_buttonBrush);

                _buttonEraser                = new FlatButton();
                _buttonEraser.Location       = new Point(_buttonBrush.Right + 3, 3);
                _buttonEraser.Text           = "Eraser";
                _buttonEraser.BackShadeColor = Color.Pink;
                _buttonEraser.BackShadeRatio = 0.1;
                _buttonEraser.Click         += new EventHandler((o, e) => {
                    if (CurrentTool == DrawBoxTools.Eraser)
                    {
                        CurrentTool = DrawBoxTools.None;
                    }
                    else
                    {
                        CurrentTool = DrawBoxTools.Eraser;
                    }
                });
                this.Controls.Add(_buttonEraser);

                _buttonColorSecondary                = new FlatButton();
                _buttonColorSecondary.Width          = _buttonColorSecondary.Height;
                _buttonColorSecondary.Location       = new Point(this.Width - _buttonColorSecondary.Width - 3, 3 + _buttonColorSecondary.Height / 3);
                _buttonColorSecondary.BackShadeColor = _ColorSecondary;
                _buttonColorSecondary.BackShadeRatio = 1.0;
                _buttonColorSecondary.Anchor         = AnchorStyles.Top | AnchorStyles.Right;
                _buttonColorSecondary.Click         += new EventHandler((o, e) => {
                    FormColorPicker dlg = new FormColorPicker();
                    dlg.Color           = _ColorSecondary;
                    if (dlg.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }
                    _buttonColorSecondary.BackShadeColor = _ColorSecondary = dlg.Color;
                });
                this.Controls.Add(_buttonColorSecondary);

                _buttonColorPrimary                = new FlatButton();
                _buttonColorPrimary.Width          = _buttonColorPrimary.Height;
                _buttonColorPrimary.Location       = new Point(_buttonColorSecondary.Left - (int)(_buttonColorPrimary.Width * 0.6), 3);
                _buttonColorPrimary.BackShadeColor = _ColorPrimary;
                _buttonColorPrimary.BackShadeRatio = 1.0;
                _buttonColorPrimary.Anchor         = AnchorStyles.Top | AnchorStyles.Right;
                _buttonColorPrimary.Click         += new EventHandler((o, e) => {
                    FormColorPicker dlg = new FormColorPicker();
                    dlg.Color           = _ColorPrimary;
                    if (dlg.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }
                    _buttonColorPrimary.BackShadeColor = _ColorPrimary = dlg.Color;
                });
                this.Controls.Add(_buttonColorPrimary);
                _buttonColorPrimary.BringToFront();
            }
        }
Esempio n. 17
0
    public void instantiateButton()
    {
        myCanvas = GameObject.Find("UICanvas");

        GameObject temp = UnityEngine.Object.Instantiate(Resources.Load(path), boardPosition, Quaternion.identity) as GameObject;

        temp.transform.eulerAngles = rotation;

        GameObject UItemp = UnityEngine.Object.Instantiate(Resources.Load(UIpath), UIposition, Quaternion.identity) as GameObject;

        UItemp.transform.SetParent(myCanvas.transform, false);

        // Assign physical button to proper button UI
        if (type == "s")
        {
            Switch switchScript = UItemp.transform.GetComponent <Switch>(); // this gets the switch script in switchon
            switchScript.toggle = temp.transform.GetChild(0).gameObject;    // this assigns the toggle in switchon to switch part
            switchScript.name   = name;

            switchScript        = UItemp.transform.GetChild(1).GetComponent <Switch>(); // gets the switch script in switchoff
            switchScript.toggle = temp.transform.GetChild(0).gameObject;
            switchScript.name   = name;
        }
        else if (type == "t")
        {
            ToggleButton toggleScript = UItemp.transform.GetComponent <ToggleButton>(); // gets script for toggle buttons
            toggleScript.toggle = temp.transform.GetChild(0).gameObject;                // assigns toggle to UItoggle
            toggleScript.name   = name;
        }
        else if (type == "f")
        {
            FlatButton toggleScript = UItemp.transform.GetComponent <FlatButton>(); // gets script for flat buttons
            toggleScript.toggle = temp.transform.GetChild(0).gameObject;            // assigns toggle to UIFlat
            toggleScript.name   = name;
        }
        else if (type == "v" || type == "h")
        {
            SliderAll sliderScript = UItemp.transform.GetComponent <SliderAll>(); // gets script for slider
            sliderScript.toggle = temp.transform.GetChild(0).gameObject;
            sliderScript.name   = name;
        }

        // Correct position and scale of physical buttons
        if (position == 1 && type == "s")
        {
            temp.transform.localScale = new Vector3(200, 200, 200);
        }
        else if (position == 1 && type == "v")
        {
            temp.transform.localScale = new Vector3(130, 130, 130);
        }
        else if (position == 2 && type == "s")
        {
            temp.transform.localScale = new Vector3(160, 150, 150);
            //UItemp.transform.localScale = new Vector3(.8738f, .7222f, 1);
            //UItemp.transform.GetChild(1).gameObject.transform.localScale = new Vector3(.8738f, .7222f, 1);
            UItemp.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 72);
            UItemp.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 90);

            UItemp.transform.GetChild(1).GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 72);
            UItemp.transform.GetChild(1).GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 90);
        }

        Debug.Log(temp.name);
        temp.transform.Find("Text").GetComponent <TextMesh>().text = name;
    }
 public void OneTimeSetup()
 {
     _grid = new Grid();
     _grid.Children.Add(_button     = new Button());
     _grid.Children.Add(_flatButton = new FlatButton());
 }
        private void GetSelectedTab(FlatButton button)
        {
            var selectedButton = button.Text;

            tcPumpAttendantMenu.SelectTab("tp" + selectedButton.ToString().Replace(" ", ""));
        }
Esempio n. 20
0
        void InitializeRecentFilesButtons(ToolTip toolTip)
        {
            if (string.IsNullOrEmpty(Settings.Default.LastOpenFiles))
            {
                var startupPath = Path.Combine(AppInfo.StartupPath, "Samples");
                if (!string.IsNullOrEmpty(startupPath) && Directory.Exists(startupPath))
                {
                    var sampleFileNames = Directory.GetFiles(startupPath, "*.sa4").Take(10);
                    Settings.Default.LastOpenFiles = string.Join(Settings.FilesSeparator.ToString(), sampleFileNames);
                    Settings.Default.Save();
                }
            }

            foreach (var fileName in Settings.Default.LastOpenFiles.Split(Settings.FilesSeparator))
            {
                if (File.Exists(fileName))
                {
                    IndexedImage image;
                    try
                    {
                        using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
                        {
                            image = ImageSerializer.LoadFromStream(stream);
                        }
                    }
                    catch (IOException)
                    {
                        continue;
                    }

                    if (image != null && image.Size.Width > 0 && image.Size.Height > 0)
                    {
                        Bitmap bitmap;
                        if (image.Size.Width > 200 || image.Size.Height > 200)
                        {
                            var maxLength = Math.Max(image.Size.Width, image.Size.Height);
                            var newSize   = new Size(image.Size.Width * 200 / maxLength, image.Size.Height * 200 / maxLength);
                            bitmap = new ImageResampler().Resample(image, newSize, ImageResampler.FilterType.Box).ToBitmap();
                        }
                        else
                        {
                            bitmap = image.ToBitmap();
                        }

                        var imageButton = new FlatButton();
                        imageButton.Size       = new System.Drawing.Size(250, 250);
                        imageButton.Image      = bitmap;
                        imageButton.Text       = Environment.NewLine + Path.GetFileNameWithoutExtension(fileName);
                        imageButton.Tag        = fileName;
                        imageButton.TextAlign  = ContentAlignment.BottomCenter;
                        imageButton.ImageAlign = ContentAlignment.MiddleCenter;
                        imageButton.FlatAppearance.BorderSize = 0;
                        imageButton.Click += ImageButton_Click;

                        var tooltip = fileName + Environment.NewLine +
                                      string.Format(Resources.ImageInfoTooltip, image.Size.Width, image.Size.Height, image.Palette.Count);
                        toolTip.SetToolTip(imageButton, tooltip);

                        panelLastOpenFiles.Controls.Add(imageButton);
                    }
                }
            }
        }
Esempio n. 21
0
 private Button CreateOpenRecentFileButton(RecentFile recentFile)
 {
     var button = new FlatButton
     {
         Image = recentFile.Thumbnail, //.ResizeTo(200, 150),
         Width = 200,
         Height = 170,
         Tag = recentFile.FilePath,
         FlatStyle = FlatStyle.Flat,
         Text = Path.GetFileName(recentFile.FilePath),
         ImageAlign = ContentAlignment.TopCenter,
         TextAlign = ContentAlignment.BottomCenter,
         HasPressedState = false,
         FocusBackColor = Color.Thistle,
         NormalBackColor = Color.FromArgb(245, 239, 245),
         BackColor = Color.FromArgb(245, 239, 245),
         FocusBorderSize = 1,
         Padding = new Padding(3, 3, 3, 3)
     };
     if (button.Text.Length > 27)
     {
         var toolTip = new ToolTip();
         toolTip.SetToolTip(button, button.Text);
         button.Text = button.Text.Substring(0, 20) + @"..." + button.Text.Substring(button.Text.LastIndexOf('.'));
     }
     button.Click += OpenRecentFileButtonClick;
     return button;
 }
Esempio n. 22
0
        void AddActions()
        {
            SP_Actions.Children.Clear();

            foreach (IActions action in Actionlist)
            {
                StackPanel stackPanel = new StackPanel();
                stackPanel.Orientation = Orientation.Horizontal;

                Label labelT = new Label();
                labelT.Content    = GetActionName(action);
                labelT.Margin     = new Thickness(0, 5, 0, 0);
                labelT.FontWeight = FontWeights.Bold;

                Label label = new Label();
                label.Content = GetActionInfo(action);
                label.Margin  = new Thickness(0, 5, 0, 0);


                FlatButton edit = new FlatButton();
                edit.Content = new Image
                {
                    Source            = new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Resources/Icons/DeleteFill.png")),
                    VerticalAlignment = VerticalAlignment.Center,
                    Width             = 20,
                    Height            = 20
                };
                Delete.Click                   += DeleteAction_Click;
                Delete.Margin                   = new Thickness(10, 0, 0, 0);
                Delete.DefaultBrush             = null;
                Delete.Hover                    = new SolidColorBrush(Color.FromRgb(240, 98, 146));
                Delete.ClickBrush               = new SolidColorBrush(Color.FromRgb(233, 30, 99));
                Delete.Height                   = 24;
                Delete.Width                    = 24;
                Delete.Tag                      = action;
                Delete.VerticalContentAlignment = VerticalAlignment.Center;


                stackPanel.Children.Add(labelT);
                stackPanel.Children.Add(label);
                stackPanel.Children.Add(edit);
                stackPanel.Children.Add(Delete);

                SP_Actions.Children.Add(stackPanel);
            }
        }