示例#1
0
        public static void ShowForm(MetroForm myfrm)
        {
            var mymsm = MyFormStyles.GetStyleManager(myfrm);

            //check tagging of the form specific size.
            if (myfrm.Tag != null)
            {
                switch (myfrm.Tag.ToString().ToLower())
                {
                case "menu":    //for the menu list for short cuts.
                    myfrm.Size = MenuWindowSettings.WindowSize;
                    if (MyFormStyles.MyStyle == MetroFramework.MetroThemeStyle.Light)
                    {
                        mymsm.Theme = MetroFramework.MetroThemeStyle.Dark;
                    }
                    else
                    {
                        mymsm.Theme = MetroFramework.MetroThemeStyle.Light;
                    }
                    break;

                case "list":    //for the menu list for short cuts.
                    myfrm.Size = ListWindowSettings.WindowSize;
                    break;

                default:
                    break;
                }
            }
            myfrm.StyleManager  = mymsm;
            myfrm.StartPosition = FormStartPosition.CenterScreen;
            myfrm.ShadowType    = MetroFormShadowType.DropShadow;
            myfrm.BorderStyle   = MetroFormBorderStyle.FixedSingle;
            myfrm.Show();
        }
示例#2
0
        public void FormGetir(MetroForm gelenForm)
        {
            if (!kutuVarMi)
            {
                foreach (Control item in this.Controls)
                {
                    if (item is GroupBox)
                    {
                        foreach (Control group in item.Controls)
                        {
                            if (group is GroupBox)
                            {
                                if (group.Name == "kutu")
                                {
                                    kutuVarMi = true;
                                }
                            }
                        }
                        if (!kutuVarMi)
                        {
                            kutu      = new GroupBox();
                            kutuVarMi = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                foreach (MetroForm item in kutu.Controls)
                {
                    kutu.Controls.Remove(item);
                }
            }

            kutu.Location = new Point((this.Width - gelenForm.Width) / 2, (this.Height - gelenForm.Height) / 2);
            kutu.Text     = "";
            kutu.Width    = gelenForm.Size.Width;
            kutu.Height   = gelenForm.Size.Height;
            if (grpAnaKutu.Height < kutu.Height)
            {
                grpAnaKutu.Height = kutu.Size.Height + 100;
                if (this.Height < grpAnaKutu.Height)
                {
                    this.Height = grpAnaKutu.Size.Height + 160;
                }
            }
            grpAnaKutu.Controls.Add(kutu);
            kutu.Location       = new Point(0, (mlBilet.Height + (mlBilet.Top * 2)));
            kutu.Left           = (grpAnaKutu.Right - kutu.Right) / 2;
            gelenForm.MdiParent = this;
            kutu.Controls.Add(gelenForm);
            gelenForm.Show();
            gelenForm.Location = Point.Empty;
            //this.Location = new Point(Location.X, Location.Y - 50);
        }
示例#3
0
 private void AnaFormGetir(MetroForm gelenForm)
 {
     grpAnaKutu.Controls.Clear();
     gelenForm.Width     = grpAnaKutu.Width;
     gelenForm.Height    = grpAnaKutu.Height;
     gelenForm.MdiParent = this;
     grpAnaKutu.Controls.Add(gelenForm);
     gelenForm.Show();
     gelenForm.Location = Point.Empty;
 }
示例#4
0
        /// <summary>
        /// 弹出自动绘图界面
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAutoDrawing_Click(object sender, EventArgs e)
        {
            //利用反射,打开自动作图窗口,Hood和Ceiling,同时实现传递窗口参数
            Project objProject = objProjectService.GetProjectByODPNo(tvModule.Nodes[0].Text.Trim());

            object[] parameters = new object[1];
            parameters[0] = objProject.ODPNo;
            MetroForm objFrmAutoDrawing = (MetroForm)Assembly.Load("Compass").CreateInstance("Compass.Frm" + objProject.HoodType + "AutoDrawing", true, BindingFlags.Default, null, parameters, null, null);

            objFrmAutoDrawing.Show();
        }
示例#5
0
 private void Nav(MetroForm form, Panel panel)
 {
     CargaCfgUsuario(user.Usuario);
     form.TopLevel = false;
     panel.Controls.Add(form);
     panel.Tag = form;
     form.BringToFront();
     form.CaptionBarColor  = ColorTranslator.FromHtml(NewColor.Pant1);
     form.CaptionForeColor = ColorTranslator.FromHtml(NewColor.FontColor);
     form.Show();
 }
示例#6
0
        //Método para atualizar o form
        public void atualizarForm(MetroForm form)
        {
            try
            {
                //Desativa o TopLevel
                form.TopLevel = false;

                //foreach (Control ctrl in painelPrincipal.Controls)
                //{
                //    MessageBox.Show(ctrl.Name);
                //}
                //Apaga atual form dentro do panel



                //MessageBox.Show(this.Controls.Count.ToString());

                if (painelPrincipal.Controls.Count != 0)
                {
                    painelPrincipal.Controls.Clear();
                }

                //Deixa maximizado para evitar erros
                form.WindowState = FormWindowState.Maximized;
                form.ShadowType  = MetroFormShadowType.None;

                //Adiciona o form nos controles do painel
                painelPrincipal.Controls.Add(form);

                //Mostra o form no painel
                form.Show();
            }
            catch
            {
                //Deixa maximizado para evitar erros
                form.WindowState = FormWindowState.Maximized;
                form.ShadowType  = MetroFormShadowType.None;
                painelPrincipal.Controls.Add(form);
                form.Show();
            }
        }
示例#7
0
        private void btnSettings_Click(object sender, EventArgs e)
        {
            SettingsForm             = new MetroForm();
            SettingsForm.Resizable   = false;
            SettingsForm.Theme       = MetroFramework.MetroThemeStyle.Dark;
            SettingsForm.Style       = MetroFramework.MetroColorStyle.White;
            SettingsForm.ShadowType  = MetroFormShadowType.DropShadow;
            SettingsForm.MinimizeBox = false;
            SettingsForm.MaximizeBox = false;
            UserControl SettingsControl = Plugin.PluginGlobalSettings();

            SettingsForm.Size = new Size(SettingsControl.Size.Width + 100, SettingsControl.Height + 100);
            SettingsForm.Controls.Add(SettingsControl);
            SettingsControl.Dock = DockStyle.Fill;
            SettingsForm.Show();
        }
示例#8
0
        private void btnAbout_Click(object sender, EventArgs e)
        {
            AboutForm             = new MetroForm();
            AboutForm.Resizable   = false;
            AboutForm.Theme       = MetroFramework.MetroThemeStyle.Dark;
            AboutForm.Style       = MetroFramework.MetroColorStyle.White;
            AboutForm.ShadowType  = MetroFormShadowType.DropShadow;
            AboutForm.MinimizeBox = false;
            AboutForm.MaximizeBox = false;
            UserControl AboutControl = Plugin.About();

            AboutForm.Size = new Size(AboutControl.Size.Width + 100, AboutControl.Height + 100);
            AboutForm.Controls.Add(AboutControl);
            AboutControl.Dock = DockStyle.Fill;
            AboutForm.Show();
        }
示例#9
0
 public static void FormGetir(Form anaForm, MetroForm gelenForm, GroupBox anaKutu, GroupBox kutu, bool kutuVarMi, MetroLink mlBilet)
 {
     if (!kutuVarMi)
     {
         foreach (Control item in anaForm.Controls)
         {
             if (item is GroupBox)
             {
                 foreach (Control group in item.Controls)
                 {
                     if (group is GroupBox)
                     {
                         if (group.Name == "kutu")
                         {
                             kutuVarMi = true;
                         }
                     }
                 }
                 if (!kutuVarMi)
                 {
                     kutu      = new GroupBox();
                     kutuVarMi = true;
                     break;
                 }
             }
         }
     }
     else
     {
         foreach (MetroForm item in kutu.Controls)
         {
             kutu.Controls.Remove(item);
         }
     }
     kutu.Location = new Point((anaForm.Width - gelenForm.Width) / 2, (anaForm.Height - gelenForm.Height) / 2);
     kutu.Text     = "";
     kutu.Width    = gelenForm.Width;
     kutu.Height   = gelenForm.Height;
     anaKutu.Controls.Add(kutu);
     kutu.Location       = new Point(0, (mlBilet.Height + (mlBilet.Top * 2)));
     kutu.Left           = (anaKutu.Right - kutu.Right) / 2;
     gelenForm.MdiParent = anaForm;
     kutu.Controls.Add(gelenForm);
     gelenForm.Show();
     gelenForm.Location = Point.Empty;
 }
示例#10
0
        //Abre no modo Mdi veridicando se já esta aberto ou nao
        public void OpenMdiForm(MetroForm frm)
        {
            frm.Resizable   = false;
            frm.MaximizeBox = false;
            frm.MinimizeBox = false;
            frm.BorderStyle = MetroFormBorderStyle.FixedSingle;
            var f = FormOpened(frm);

            if (f != null)
            {
                f.BringToFront();
                f.WindowState = FormWindowState.Normal;
            }
            else
            {
                frm.MdiParent = this;
                frm.Show();
            }
        }
示例#11
0
        public void ShowNotification(string Notification, bool ShowDialog, int LifeTimeFormSecond, bool TopMost)
        {
            //lbl.Text = Notification;
            txtMessage.Text = Notification;
            SecondLifeForm  = LifeTimeFormSecond;

            //Позиция Оповещения
            int left;
            int top;

            //
            //
            getXY(380, 120, out top, out left);
            frm.StartPosition = FormStartPosition.Manual;
            frm.Location      = new System.Drawing.Point(left + 375, top);
            frm.TopMost       = TopMost;
            //
            //
            //
            posStop = (ushort)left;
            OpenFormTimer.Interval = 1;
            OpenFormTimer.Tick    += new System.EventHandler(OpenFormTimer_Tick);
            OpenFormTimer.Enabled  = true;
            //
            //
            //
            //Close Form
            LifeTimeForm.Interval = 1;
            LifeTimeForm.Tick    += new System.EventHandler(LifeTimeForm_Tick);
            LifeTimeForm.Enabled  = true;
            //
            if (ShowDialog)
            {
                frm.ShowDialog();
            }
            else
            {
                frm.Show();
            }
        }
示例#12
0
        private void Show(Control userCtrl, bool modal)
        {
            if (userCtrl is MetroForm)
            {
                MetroForm metroForm = userCtrl as MetroForm;
                metroForm.StartPosition = FormStartPosition.Manual;
                ERPFramework.GlobalInfo.StyleManager.Clone(metroForm);
                metroForm.FormClosed  += Metroform_FormClosed;
                metroForm.FormClosing += MetroForm_FormClosing;

                if (modal)
                {
                    LockAllControl();
                }

                _listControl.Add(userCtrl.Name, userCtrl);
                Size sz = metroForm.Size;
                metroForm.Size = Size.Empty;
                metroForm.StyleManager.Update();
                metroForm.Show(_owner);
                MetroFramework.Animation.ExpandAnimation exp = new MetroFramework.Animation.ExpandAnimation();
                exp.Start(metroForm, sz, MetroFramework.Animation.TransitionType.EaseInExpo, 4);
            }
            //else if (userCtrl is MetroUserControl)
            //{
            //    MetroUserControl metroCtrl = userCtrl as MetroUserControl;
            //    metroCtrl.StyleManager = styleManager;
            //    metroCtrl.Clo += Metroform_FormClosed;

            //    if (modal)
            //        metroform.ShowDialog();
            //    else
            //        metroform.Show();
            //}
            else
            {
                System.Diagnostics.Debug.Assert(false, "Unknow control type");
            }
        }
示例#13
0
        private void picTest_Click(object sender, EventArgs e)
        {
            MetroForm PictureForm = new MetroForm();

            PictureForm.Theme       = MetroFramework.MetroThemeStyle.Dark;
            PictureForm.Style       = MetroFramework.MetroColorStyle.White;
            PictureForm.BorderStyle = MetroFormBorderStyle.FixedSingle;
            PictureForm.Resizable   = false;
            PictureForm.Text        = "Test Screenshot";
            PictureForm.Size        = new Size(Convert.ToInt32(txtCropSizeWidth.Text.Trim()), Convert.ToInt32(txtCropSizeHeight.Text.Trim()));
            //MetroPanel PicturePanel = new MetroPanel();
            //PicturePanel.Size = new Size(Convert.ToInt32(txtCropSizeWidth.Text.Trim()), Convert.ToInt32(txtCropSizeHeight.Text.Trim()));
            //PicturePanel.Location = new Point(0, 0);
            //PicturePanel.Dock = DockStyle.Fill;
            PictureBox Picture = new PictureBox();

            Picture.Size     = new Size(Convert.ToInt32(txtCropSizeWidth.Text.Trim()), Convert.ToInt32(txtCropSizeHeight.Text.Trim()));
            Picture.Image    = picTest.Image;
            Picture.Dock     = DockStyle.Fill;
            Picture.SizeMode = PictureBoxSizeMode.StretchImage;
            PictureForm.Controls.Add(Picture);
            PictureForm.Show();
        }
示例#14
0
        private void showForm()
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            MetroForm form = new MetroForm();

            form.DropShadow = this.checkBoxAdv1.Checked;
            if (this.checkBoxAdv1.Checked)
            {
                form.Text = "MetroForm with shadow";
            }
            else
            {
                form.Text = "MetroForm without shadow";
            }
            form.Show();
            form.ShowIcon = false;
            Point point = new Point(this.Left + this.panel3.Left + 45, this.Top + panel3.Top + 188);

            form.Location        = point;
            form.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            Size size = new Size(this.panel3.Width - 20, this.panel3.Height - 40);

            form.Size = size;
        }
示例#15
0
        public static void ShowSteamProfile(SteamBot.Bot bot, ulong steamId)
        {
            var form = new MetroForm();

            form.Text       = "Steam Community";
            form.Width      = 800;
            form.Height     = 600;
            form.Style      = Friends.GlobalStyleManager.Style;
            form.Theme      = Friends.GlobalStyleManager.Theme;
            form.Icon       = MistClient.Properties.Resources.Icon;
            form.ShadowType = MetroFormShadowType.DropShadow;
            var webControl = new Awesomium.Windows.Forms.WebControl();

            webControl.Dock = System.Windows.Forms.DockStyle.Fill;
            string cookies = string.Format("steamLogin={0}; sessionid={1}", bot.token, bot.sessionId);

            webControl.WebSession = Awesomium.Core.WebCore.CreateWebSession(new Awesomium.Core.WebPreferences());
            webControl.WebSession.SetCookie(new Uri("http://steamcommunity.com"), cookies, true, true);
            webControl.Source         = new Uri((string.Format("http://steamcommunity.com/profiles/{0}/", steamId)));
            webControl.DocumentReady += webControl_DocumentReady;
            webControl.TitleChanged  += (s, e) => webControl_TitleChanged(s, e, form);
            form.Controls.Add(webControl);
            form.Show();
        }
示例#16
0
        private void BtnNuovaSessione_Click(object sender, EventArgs e)
        {
            #region FormSessione

            formSessione     = new MetroForm();
            txtNomeSessione  = new MetroTextBox();
            btnCrea          = new MetroButton();
            btnAnnulla       = new MetroButton();
            radioStandard    = new MetroRadioButton();
            radioCustom      = new MetroRadioButton();
            checkPubblicaDB  = new MetroCheckBox();
            lstBoxSessioni   = new ListBox();
            lstvBoxSessioni  = new ListView();
            txtCercaSessione = new MetroTextBox();
            lblCercaSessione = new MetroLabel();
            txtCercaUtente   = new MetroTextBox();
            lblCercaUtente   = new MetroLabel();
            txtCercaPubblica = new MetroTextBox();
            lblCercaPubblica = new MetroLabel();
            lblEmail         = new MetroLabel();
            txtEmail         = new TextBox();
            txtCercaMail     = new MetroTextBox();
            lblCercaMail     = new MetroLabel();

            checkPubblicaDB.CheckedChanged += CheckPubblicaDB_CheckedChanged;

            formSessione.StartPosition = FormStartPosition.CenterScreen;

            formSessione.Size        = new Size(500, 400);
            formSessione.MaximizeBox = false;

            formSessione.MinimizeBox = false;
            formSessione.Resizable   = false;

            formSessione.Text      = "Nuova Sessione";
            radioStandard.Text     = "Sessione Standard";
            radioCustom.Text       = "Sessione da Database";
            radioStandard.AutoSize = true;
            radioCustom.AutoSize   = true;
            radioStandard.Checked  = true;

            radioCustom.Top    = 70;
            radioStandard.Top  = 70;
            radioCustom.Left   = 270;
            radioStandard.Left = 90;

            radioStandard.CheckedChanged += RadioStandard_CheckedChanged;
            radioCustom.CheckedChanged   += RadioCustom_CheckedChanged;

            formSessione.Controls.Add(radioStandard);
            formSessione.Controls.Add(radioCustom);
            formSessione.Controls.Add(txtNomeSessione);
            formSessione.Controls.Add(btnCrea);
            formSessione.Controls.Add(btnAnnulla);
            formSessione.Controls.Add(checkPubblicaDB);
            formSessione.Controls.Add(lstvBoxSessioni);
            formSessione.Controls.Add(txtCercaSessione);
            formSessione.Controls.Add(lblCercaSessione);
            formSessione.Controls.Add(txtCercaUtente);
            formSessione.Controls.Add(lblCercaUtente);
            formSessione.Controls.Add(txtCercaPubblica);
            formSessione.Controls.Add(lblCercaPubblica);
            formSessione.Controls.Add(lblEmail);
            formSessione.Controls.Add(txtEmail);
            formSessione.Controls.Add(lblCercaMail);
            formSessione.Controls.Add(txtCercaMail);

            txtNomeSessione.Focus();
            txtNomeSessione.Size = new Size(200, txtNomeSessione.Height);
            txtNomeSessione.Top  = 150;
            txtNomeSessione.Left = 150;
            txtNomeSessione.Text = "Inserire nome sessione";

            lstvBoxSessioni.Visible    = false;
            lstvBoxSessioni.Scrollable = true;
            lstvBoxSessioni.Alignment  = ListViewAlignment.Left;

            ColumnHeader colHead = new ColumnHeader();

            colHead       = new ColumnHeader();
            colHead.Text  = "Nome Sessione";
            colHead.Width = -2;
            lstvBoxSessioni.Columns.Add(colHead);

            colHead       = new ColumnHeader();
            colHead.Text  = "Utente";
            colHead.Width = 60;
            lstvBoxSessioni.Columns.Add(colHead);

            colHead       = new ColumnHeader();
            colHead.Text  = "Chiave Pubblica (E, N)";
            colHead.Width = 120;
            lstvBoxSessioni.Columns.Add(colHead);

            colHead       = new ColumnHeader();
            colHead.Text  = "e-mail";
            colHead.Width = 120;

            lstvBoxSessioni.Columns.Add(colHead);
            lstvBoxSessioni.FullRowSelect = true;

            for (int i = 0; i < sProvider.GetEntityList().Count; i++)
            {
                ListViewItem lstItem = new ListViewItem(sProvider.GetEntityList()[i].NomeSessione);
                lstItem.SubItems.Add(sProvider.GetEntityList()[i].Utente);
                string keyPubb = sProvider.GetEntityList()[i].EString + "," + sProvider.GetEntityList()[i].NString;
                lstItem.SubItems.Add(keyPubb);
                lstItem.SubItems.Add(sProvider.GetEntityList()[i].Email);

                lstvBoxSessioni.Items.Add(lstItem);
            }

            lblCercaSessione.Visible = false;
            txtCercaSessione.Visible = false;
            lblCercaUtente.Visible   = false;
            txtCercaUtente.Visible   = false;
            lblCercaPubblica.Visible = false;
            txtCercaPubblica.Visible = false;
            lblCercaMail.Visible     = false;
            txtCercaMail.Visible     = false;

            lstvBoxSessioni.Size = new Size(285, 240);
            lstvBoxSessioni.Top  = 100;
            lstvBoxSessioni.Left = 20;
            lstvBoxSessioni.View = View.Details;

            lblCercaSessione.Text     = "Ricerca Nome Sessione";
            lblCercaSessione.Top      = 115;
            lblCercaSessione.Left     = 316;
            lblCercaSessione.AutoSize = true;

            txtCercaSessione.Text         = "Cerca...";
            txtCercaSessione.Top          = 135;
            txtCercaSessione.Left         = 320;
            txtCercaSessione.Width        = 130;
            txtCercaSessione.TextChanged += CercaSessione_TextChanged;

            lblCercaUtente.Text     = "Ricerca Utente";
            lblCercaUtente.Top      = 165;
            lblCercaUtente.Left     = 316;
            lblCercaUtente.AutoSize = true;

            txtCercaUtente.Text         = "Cerca...";
            txtCercaUtente.Top          = 185;
            txtCercaUtente.Left         = 320;
            txtCercaUtente.Width        = 130;
            txtCercaUtente.TextChanged += TxtCercaUtente_TextChanged;

            lblCercaPubblica.Text     = "Ricerca Chiave N";
            lblCercaPubblica.Top      = 215;
            lblCercaPubblica.Left     = 316;
            lblCercaPubblica.AutoSize = true;

            txtCercaPubblica.Text         = "Cerca...";
            txtCercaPubblica.Top          = 235;
            txtCercaPubblica.Left         = 320;
            txtCercaPubblica.Width        = 130;
            txtCercaPubblica.TextChanged += TxtCercaPubblica_TextChanged;

            lblCercaMail.Text     = "Ricerca e-mail";
            lblCercaMail.Top      = 265;
            lblCercaMail.Left     = 316;
            lblCercaMail.AutoSize = true;

            txtCercaMail.Text         = "Cerca...";
            txtCercaMail.Top          = 285;
            txtCercaMail.Left         = 320;
            txtCercaMail.Width        = 130;
            txtCercaMail.TextChanged += TxtCercaMail_TextChanged;

            checkPubblicaDB.Checked  = false;
            checkPubblicaDB.Top      = 180;
            checkPubblicaDB.Left     = 150;
            checkPubblicaDB.Text     = "Pubblica nel Database";
            checkPubblicaDB.AutoSize = true;

            lblEmail.Visible  = false;
            lblEmail.AutoSize = true;
            lblEmail.Text     = "e-mail:";
            txtEmail.Visible  = false;
            lblEmail.Top      = 230;
            lblEmail.Left     = 80;
            txtEmail.Top      = 230;
            txtEmail.Left     = 130;
            txtEmail.Width    = 250;
            txtEmail.Text     = "*****@*****.**";

            btnCrea.Top     = 360;
            btnCrea.Left    = 90;
            btnAnnulla.Top  = 360;
            btnAnnulla.Left = 330;
            btnCrea.Text    = "Crea";
            btnAnnulla.Text = "Annulla";

            formSessione.Show();

            if (checkDBConnection.Text == "Connessione al Database: Assente")
            {
                radioCustom.Enabled     = false;
                checkPubblicaDB.Checked = false;
                checkPubblicaDB.Enabled = false;


                MessageBox.Show("La connessione al database è assente o è stata persa. Controllare lo stato della propria rete.",
                                "Connessione al database fallita", MessageBoxButtons.OK, MessageBoxIcon.Warning);


                connessioneDB          = "Assente";
                checkDBConnection.Text = String.Format("Connessione al Database: " + connessioneDB);
            }
            else if (checkDBConnection.Text == "Connessione al Database: Connesso")
            {
                if (sProvider.TryConnection() == "Assente")
                {
                    MessageBox.Show("La connessione al database è assente o è stata persa. Controllare lo stato della propria rete.",
                                    "Connessione al database fallita", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    checkDBConnection.Text = String.Format("Connessione al Database: " + "Assente");
                    reConnect.Enabled      = true;
                }

                else
                {
                    radioCustom.Enabled     = true;
                    checkPubblicaDB.Checked = false;
                    checkPubblicaDB.Enabled = true;
                }
            }

            btnCrea.Click    += _crea_Click;
            btnAnnulla.Click += _annulla_Click;

            #endregion
        }
示例#17
0
 private void BackButton_Click(object sender, EventArgs e)
 {
     LastForm.Show(this);
     this.Hide();
 }