예제 #1
0
 ///The following function was added by Dan Ames and is an update over the version 3.0 code to handle the AddShapeForm
 public void CloseAddShapeForm()
 {
     if (m_AddShapeForm != null)
     {
         m_AddShapeForm.Close();
     }
 }
예제 #2
0
        private string SpawnMessageBox(string label)
        {
            var dialog = new System.Windows.Forms.Form()
            {
                Height          = 105,
                Width           = 340,
                StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent,
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog,
                MaximizeBox     = false,
                MinimizeBox     = false,
            };

            var textLabel = new System.Windows.Forms.Label()
            {
                Left = 0, Top = 0, Width = 320, Text = label, TextAlign = System.Drawing.ContentAlignment.MiddleCenter
            };
            var textBox = new System.Windows.Forms.TextBox()
            {
                Left = 10, Top = 20, Width = 300
            };
            var cancelButton = new System.Windows.Forms.Button()
            {
                Text = "Cancel", Left = 70, Width = 80, Top = 40, DialogResult = System.Windows.Forms.DialogResult.Cancel
            };
            var confirmButton = new System.Windows.Forms.Button()
            {
                Text = "Ok", Left = 170, Width = 80, Top = 40, DialogResult = System.Windows.Forms.DialogResult.OK
            };

            cancelButton.Click  += (s, e) => { dialog.Close(); };
            confirmButton.Click += (s, e) => { dialog.Close(); };
            dialog.Controls.Add(textBox);
            dialog.Controls.Add(textLabel);
            dialog.Controls.Add(cancelButton);
            dialog.Controls.Add(confirmButton);
            dialog.CancelButton = cancelButton;
            dialog.AcceptButton = confirmButton;

            string userInput;

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                userInput = textBox.Text;
            }
            else
            {
                userInput = null;
            }
            dialog.Dispose();

            return(userInput);
        }
예제 #3
0
        public void ShowPopup(System.Windows.Forms.Form owner, System.Drawing.Rectangle pos, string caption, bool daikubun, bool showUsableOnly, bool embedded)
        {
            if (popup != null)
            {
                popup.Close();
                popup = null;
            }

            if (daikubun)
            {
                popup = new views.popup.YosanKamokuDaikubunPopup();
            }
            else
            {
                popup = new views.popup.YosanKamokuKubunPopup();
            }

            popup.FormClosed += delegate(object sender, System.Windows.Forms.FormClosedEventArgs e) {
                popup          = null;
                gridController = null;
            };

            if (popup is views.popup.YosanKamokuDaikubunPopup)
            {
                grid = (popup as views.popup.YosanKamokuDaikubunPopup).Grid as views.grid.PanelGrid <RowType>;
            }
            else if (popup is views.popup.YosanKamokuKubunPopup)
            {
                grid = (popup as views.popup.YosanKamokuKubunPopup).Grid as views.grid.PanelGrid <RowType>;
            }

            bufferedTable            = new models.db.vtables.BufferedYosanKamokuKubun(Context.KaikeiDatabase);
            bufferedTable.UsableOnly = showUsableOnly;

            gridController = new grid.DBPanelGridController <RowType>(grid, false);
            gridController.SetTable(bufferedTable);
            gridController.RowUpdated         += (row) => ChangeSumAmount();
            gridController.Row_GotFocusAction += (row) => RowSelectionChanged();

            //popup.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //popup.Parent = owner;
            popup.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            popup.Location      = pos.Location;
            popup.Size          = pos.Size;
            popup.Text          = caption;

            popup.Show(owner);

            stickyWindowController = new misc.StickyWindowController(owner, popup);
        }
예제 #4
0
파일: Api.cs 프로젝트: Haku-Men/TPlayer
        public static void MaskForm(System.Windows.Forms.Form fform, System.Windows.Forms.Form form, System.Drawing.Color back)
        {
            Frm.Mask mask    = new Frm.Mask(fform, back);
            bool     isclose = false;

            fform.Invoke(new Action(() =>
            {
                mask.Show(fform);
                mask.MouseUp += (s, e) =>
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Left)
                    {
                        isclose = true;
                        form.Close();
                        mask.Close();
                    }
                };

                form.Show(mask);

                form.FormClosing += (s, e) =>
                {
                    if (!isclose)
                    {
                        isclose = true;
                        mask.Close();
                    }
                };
            }));
        }
예제 #5
0
        public static string ShowDialog(string text, string caption)
        {
            System.Windows.Forms.Form prompt = new System.Windows.Forms.Form()
            {
                Width           = 500,
                Height          = 150,
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog,
                Text            = caption,
                StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen
            };
            System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label()
            {
                Left = 50, Top = 20, Text = text
            };
            System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox()
            {
                Left = 50, Top = 50, Width = 400
            };
            System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button()
            {
                Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = System.Windows.Forms.DialogResult.OK
            };
            confirmation.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(textBox);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.AcceptButton = confirmation;

            return(prompt.ShowDialog() == System.Windows.Forms.DialogResult.OK ? textBox.Text : "");
        }
예제 #6
0
 public static string ShowDialog()
 {
     System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
     prompt.Width  = 200;
     prompt.Height = 150;
     prompt.Left   = 0;
     prompt.Text   = "New Column";
     System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label()
     {
         Left = 50, Top = 20, Text = "Enter new Colume"
     };
     System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox()
     {
         Left = 50, Top = 50, Width = 100
     };
     System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button()
     {
         Text = "Ok", Left = 90, Width = 50, Top = 70
     };
     confirmation.Click += (sender, e) => { prompt.Close(); };
     prompt.Controls.Add(confirmation);
     prompt.Controls.Add(textLabel);
     prompt.Controls.Add(textBox);
     prompt.ShowDialog();
     return(textBox.Text);
 }
예제 #7
0
        // Logging Methods
        public static void Log(Components component, LogLevel level, string message, bool prompt = false, int timeout = 0)
        {
            if (prompt)
            {
                if (timeout == 0)
                {
                    MessageBox.Show(message, level.ToString());
                }
                else
                {
                    var w = new System.Windows.Forms.Form()
                    {
                        Size = new System.Drawing.Size(0, 0)
                    };
                    Task.Delay(TimeSpan.FromSeconds(timeout))
                    .ContinueWith((t) => w.Close(), TaskScheduler.FromCurrentSynchronizationContext());

                    System.Windows.Forms.MessageBox.Show(w, message, level.ToString());
                }
            }

            if (!CanLog())
            {
                return;
            }
            App.Current.Dispatcher.Invoke(new Action(() =>
            {
                var entry = new LogEntry(component.ToString(), message, level);
                InsertEntry(entry);
                LogToFile(entry);
            }));
        }
예제 #8
0
 public void CloseDesktop()
 {
     cefBrowser.Visibility = Visibility.Visible;
     this.cefBrowser.AttachChild(YMPCore.Browser.Browser);
     desktopForm.Close();
     desktopForm = null;
 }
        public static void BackwardTo(System.Windows.Forms.Form from, System.Windows.Forms.Form backTo)
        {
            from.Dispose();
            from.Close();

            backTo.Show();
        }
예제 #10
0
 /// <summary>
 /// Wywoluje powitalne okno, gdzie uzytkownik moze podac swoje imie.
 /// </summary>
 private void loginmenu()
 {
     System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
     prompt.Width         = 300;
     prompt.Height        = 150;
     prompt.Text          = "Welcome!!!";
     prompt.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label()
     {
         Left = 50, Top = 20, Text = "Enter your name"
     };
     System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox()
     {
         Left = 50, Top = 50, Width = 200, Text = "Player"
     };
     System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button()
     {
         Text = "Ok", Left = 150, Width = 100, Top = 70
     };
     confirmation.Click += (sender, e) => { prompt.Close(); };
     prompt.Controls.Add(confirmation);
     prompt.Controls.Add(textLabel);
     prompt.Controls.Add(textBox);
     prompt.ShowDialog();
     PlayerName = textBox.Text;
 }
        public void Do(System.Windows.Forms.Form from)
        {
            closeable.Dispose();
            closeable.Close();

            NavigableFormUtil.BackwardTo(from, new LoginForm());
        }
예제 #12
0
        public void TestCloseFormAndClickCreatesNewForm()
        {
            //---------------Set up test pack-------------------
            HabaneroMenu  habaneroMenu = CreateHabaneroMenuFullySetup();
            IFormHabanero frm          = (IFormHabanero)habaneroMenu.Form;

            frm.Show();
            HabaneroMenu submenu = habaneroMenu.AddSubMenu(TestUtil.GetRandomString());

            HabaneroMenu.Item menuItem = submenu.AddMenuItem(TestUtil.GetRandomString());


            menuItem.FormControlCreator += (() => new FormControlStubWin());
            IMenuBuilder      menuBuilder = CreateMenuBuilder();
            IMainMenuHabanero menu        = menuBuilder.BuildMainMenu(habaneroMenu);

            menu.DockInForm(habaneroMenu.Form);
            IMenuItem formsMenuItem = menu.MenuItems[0].MenuItems[0];

            formsMenuItem.PerformClick();
            System.Windows.Forms.Form    winForm             = (System.Windows.Forms.Form)frm;
            System.Windows.Forms.Form    childForm           = winForm.MdiChildren[0];
            System.Windows.Forms.Control expectedFormControl = childForm.Controls[0];
            //---------------Execute Test ----------------------

            childForm.Close();
            formsMenuItem.PerformClick();
            //---------------Test Result -----------------------

            Assert.AreEqual(1, winForm.MdiChildren.Length);
            childForm = winForm.MdiChildren[0];
            Assert.AreEqual(1, childForm.Controls.Count);
            Assert.IsInstanceOf(typeof(FormControlStubWin), winForm.MdiChildren[0].Controls[0]);
            Assert.AreNotSame(expectedFormControl, winForm.MdiChildren[0].Controls[0]);
        }
예제 #13
0
        public static void TestShowVisualizer(Image imageToVisualize, System.Windows.Forms.Form parent)
        {
            VisualizerDevelopmentHost visualizerHost = new VisualizerDevelopmentHost(imageToVisualize, typeof(ImageVisualizer));

            visualizerHost.ShowVisualizer();
            parent.Close();
        }
예제 #14
0
        private void FindWindowNameAndInvokeHandler(IntPtr hWnd)
        {
            string name = string.Empty;

            System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(hWnd);
            bool needInvoke = false;

            if (form == this.m_HostingForm)
            {
                needInvoke = false;
            }
            else if (form != null && form.Modal == true)
            {
                name       = string.IsNullOrEmpty(form.Name) ? form.GetType().Name : form.Name;
                needInvoke = true;
            }
            else if (Win32.IsDialog(hWnd) == true)
            {
                name       = Win32.GetText(hWnd);
                needInvoke = true;
            }
            if (needInvoke == true)
            {
                this.Invoke(name, form, hWnd, hWnd);
                if (form != null && form.Visible)
                {
                    try
                    {
                        form.Close();
                    }
                    catch { }
                }
            }
        }
예제 #15
0
 void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (form != null)
     {
         form.Close();
     }
 }
 UnInstallDev()
 {
     if (m_wndMain != null)
     {
         m_wndMain.Close();
     }
     return(false);
 }
예제 #17
0
 public static void frm_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     System.Windows.Forms.Form frm = (System.Windows.Forms.Form)sender;
     if (e.KeyCode == System.Windows.Forms.Keys.Escape)
     {
         frm.Close();
     }
 }
예제 #18
0
 public static void ValidateSession(System.Windows.Forms.Form frm, Woodensoft.TitherPro.Domain.Contexts.User u)
 {
     if (u == null)
     {
         frm.Close();
         throw new Exception("You are not logged in!");
     }
 }
예제 #19
0
        public static void phanQuyenRibon(System.Windows.Forms.Form frm, NhanVien objnhanvien, DevExpress.XtraBars.Ribbon.RibbonControl ribbon)
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                //lấy ra ID nhóm nhân viên
                var objNhomNhanVien = db.pqNhomNhanViens.Where(p => p.MaNV == objnhanvien.ID).Select(p => p.GroupID);

                var ModuleHasPermisson = db.pqAccessRights.Where(p => objNhomNhanVien.Contains(p.GroupID) & p.IsAccessRight == true).Select(p => p.pqModule);

                var permissionOnModule = db.pqModule_FormControls.Where(p => p.pqModule == ModuleHasPermisson).Select(p => p.ControlName);

                if (permissionOnModule.Count() <= 0 & frm.Name != "frm_Main")
                {
                    frm.Close();
                }
                else
                {
                    var lstModuleHasPermisson = ModuleHasPermisson.ToList();
                    var ControlHasPermisson   = db.pqModule_FormControls.Where(p => lstModuleHasPermisson.Contains(p.pqModule)).Select(p => p.ControlName).ToList();
                    var nlstRibbobPage        = getAllRibbonPage(ribbon).Where(p => ControlHasPermisson.Contains(p.Name)).ToList();
                    var nlstRibbobPageGroup   = getAllRibbonPageGroup(ribbon).Where(p => ControlHasPermisson.Contains(p.Name)).ToList();
                    var nlstBarButtonItem     = getAllBarButtonItem(ribbon).Where(p => ControlHasPermisson.Contains(p.Name)).ToList();

                    #region An control
                    getAllRibbonPage(ribbon).ForEach(item =>
                    {
                        item.Visible = false;
                    });

                    getAllRibbonPageGroup(ribbon).ForEach(item =>
                    {
                        item.Visible = false;
                    });

                    getAllBarButtonItem(ribbon).ForEach(item =>
                    {
                        item.Enabled = false;
                    });

                    #endregion
                    #region Hien control
                    foreach (DevExpress.XtraBars.BarButtonItem item in nlstBarButtonItem)
                    {
                        item.Enabled = true;
                    }
                    foreach (DevExpress.XtraBars.Ribbon.RibbonPage item in nlstRibbobPage)
                    {
                        item.Visible = true;
                    }
                    foreach (DevExpress.XtraBars.Ribbon.RibbonPageGroup item in nlstRibbobPageGroup)
                    {
                        item.Visible = true;
                    }
                    #endregion
                }
            }
        }
예제 #20
0
        /// <summary>Specifies action for MenuItem that connects to
        /// repository by specifying only port numbers</summary>
        private void btnConnectRep_Click(object sender, RoutedEventArgs e)
        {
            // initialize ports
            int port1 = 8000, port2 = 8001;

            // create form to set the ports
            System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
            prompt.Width           = 500;
            prompt.Height          = 70;
            prompt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            prompt.Text            = "Connect to Repository (ports)";
            // initialize form components
            System.Windows.Forms.Label textLabel =
                new System.Windows.Forms.Label()
            {
                Left = 5, Top = 5, Width = 80, Text = "Comm Port:"
            };
            System.Windows.Forms.TextBox txtPort1 =
                new System.Windows.Forms.TextBox()
            {
                Left = 90, Top = 5
            };
            System.Windows.Forms.Label textLabe2 =
                new System.Windows.Forms.Label()
            {
                Left = 190, Width = 80, Top = 5, Text = "Streaming Port:"
            };
            System.Windows.Forms.TextBox txtPort2 =
                new System.Windows.Forms.TextBox()
            {
                Left = 280, Top = 5
            };
            System.Windows.Forms.Button confirmation =
                new System.Windows.Forms.Button()
            {
                Text = "Confirm", Left = 400, Width = 80, Top = 3
            };
            confirmation.Click += (send, ex) => {
                // get port1 value from form
                int.TryParse(txtPort1.Text, out port1);
                // get port2 value from form
                int.TryParse(txtPort2.Text, out port2);
                prompt.Close();
            };
            // add components to form
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.Controls.Add(textLabe2);
            prompt.Controls.Add(txtPort1);
            prompt.Controls.Add(txtPort2);
            // show form for user
            prompt.ShowDialog();
            // try establishing connection to repository
            Console.Write("\n  Connecting to repository on ports: {0}, {1}", port1, port2);
            CreateSenderChannels(port1, port2);
        }
예제 #21
0
        public static void view(List <List <string> > graphdetails, List <string> nodes, string start, string finish, string e)
        {
            //create a form
            System.Windows.Forms.Form form = new System.Windows.Forms.Form();
            form.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            form.Location      = new System.Drawing.Point(0, 0);
            //create a viewer object
            Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer();
            //create a graph object
            Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("Graph Drawing");
            //create the graph content
            foreach (List <string> L in graphdetails)
            {
                graph.AddNode(L[0]);
                for (int i = 1; i < L.Count; i++)
                {
                    graph.AddEdge(L[i], L[0]).Attr.ArrowheadAtTarget = Microsoft.Msagl.Drawing.ArrowStyle.None;
                }
            }
            foreach (var node in graph.Nodes)
            {
                node.Attr.Shape = Microsoft.Msagl.Drawing.Shape.Circle;
            }

            //bind the graph to the viewer
            viewer.Graph = graph;
            //associate the viewer with the form
            form.Width  = 500;
            form.Height = 500;
            form.Text   = "DFS";
            form.SuspendLayout();
            viewer.Dock = System.Windows.Forms.DockStyle.Fill;
            form.Controls.Add(viewer);
            form.ResumeLayout();
            //show the form

            form.Show();

            graph.FindNode(start).Attr.FillColor  = Microsoft.Msagl.Drawing.Color.Red;
            graph.FindNode(finish).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Yellow;

            Task.Delay(1000).Wait();

            foreach (var node in nodes)
            {
                graph.FindNode(node).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Aquamarine;
                viewer.Graph = graph;
                viewer.Dock  = System.Windows.Forms.DockStyle.Fill;
                form.Controls.Add(viewer);
                Task.Delay(1000).Wait();
            }

            MessageBox.Show(e, "Result");

            form.Close();
        }
예제 #22
0
        public Result OnShutdown(UIControlledApplication application)
        {
            if (r_UI_Form != null && r_UI_Form.Visible)
            {
                r_UI_Form.Close();
            }

            runMode = false;
            return(Result.Succeeded);
        }
예제 #23
0
 protected override void CloseForm()
 {
     if (_form == null)
     {
         return;
     }
     _form.Close();
     _form.Dispose();
     _form = null;
 }
 public void Dispose()
 {
     if (mFrm != null)
     {
         if (mSyncInvoke.InvokeRequired)
         {
             mSyncInvoke.Invoke((SendOrPostCallback) delegate(object state) { mFrm.Close(); }, new object[] { });
         }
         else
         {
             mFrm.Close();
         }
         mFrm = null;
     }
     if (mSyncInvoke != null)
     {
         mSyncInvoke = null;
     }
     mIsDisposed = true;
 }
예제 #25
0
        /// <summary>Specifies action for MenuItem that connects
        /// to repository by specifying complete addresses</summary>
        private void btnConnRepAddresses_Click(object sender, RoutedEventArgs e)
        {
            string commUri = "", streamUri = "";

            // create form to set the ports
            System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
            prompt.Width           = 500;
            prompt.Height          = 100;
            prompt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
            prompt.Text            = "Connect to Repository (addresses)";
            // initialize form components
            System.Windows.Forms.Label textLabel =
                new System.Windows.Forms.Label()
            {
                Left = 5, Top = 5, Width = 100, Text = "Comm Host:", TabIndex = 10
            };
            System.Windows.Forms.TextBox txtCommUri =
                new System.Windows.Forms.TextBox()
            {
                Left = 120, Top = 5, Width = 250,
                Text = "http://localhost:8000/IComm/Repository", TabIndex = 1
            };
            System.Windows.Forms.Label textLabe2 =
                new System.Windows.Forms.Label()
            {
                Left = 5, Width = 100, Top = 35, Text = "Streaming Host:", TabIndex = 10
            };
            System.Windows.Forms.TextBox txtStreamUri =
                new System.Windows.Forms.TextBox()
            {
                Left = 120, Top = 35, Width = 250,
                Text = "http://localhost:8001/IStream/Repository", TabIndex = 2
            };
            System.Windows.Forms.Button confirmation =
                new System.Windows.Forms.Button()
            {
                Text = "Confirm", Left = 390, Width = 80, Top = 33, TabIndex = 3
            };
            confirmation.Click += (send, ex) => {
                commUri = txtCommUri.Text; streamUri = txtStreamUri.Text; prompt.Close();
            };
            // add components to form
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.Controls.Add(textLabe2);
            prompt.Controls.Add(txtCommUri);
            prompt.Controls.Add(txtStreamUri);
            // show form for user
            prompt.ShowDialog();
            // try establishing connection to repository
            CreateSenderChannels(commUri, streamUri);
        }
 public override void OnTriggerEvent(int iEventStyle, EventArgs e)
 {
     if (this.m_pAppHook == null)
     {
         return;
     }
     System.Windows.Forms.Form form = this.m_pAppHook.Host as System.Windows.Forms.Form;
     if (form == null)
     {
         return;
     }
     form.Close();
 }
예제 #27
0
        public static string ShowDialog()
        {
            System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
            prompt.Width           = 300;
            prompt.Height          = 150;
            prompt.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            prompt.MinimizeBox     = false;
            prompt.MaximizeBox     = false;
            prompt.StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen;
            prompt.Text            = "Choose a Json Scheme";
            System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label()
            {
                Left = 50, Width = 200, Top = 20, Text = "Please select a Json Scheme"
            };
            System.Windows.Forms.RadioButton voting = new System.Windows.Forms.RadioButton()
            {
                Left = 50, Top = 50, Width = 100, Text = "Voting Json"
            };
            voting.Checked = true;
            System.Windows.Forms.RadioButton veto = new System.Windows.Forms.RadioButton()
            {
                Left = 150, Top = 50, Width = 100, Text = "Veto Json"
            };

            //System.Windows.Forms.NumericUpDown inputBox = new System.Windows.Forms.NumericUpDown() { Left = 50, Top = 50, Width = 400 };
            System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button()
            {
                Text = "Ok", Left = 100, Width = 100, Top = 80
            };
            string path = "";

            confirmation.Click += (sender, e) => {
                if (voting.Checked)
                {
                    path = "./Schema/voting.schema.json";
                }
                if (veto.Checked)
                {
                    path = "./Schema/veto.schema.json";
                }
                prompt.Close();
            };
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.Controls.Add(voting);
            prompt.Controls.Add(veto);
            prompt.ShowDialog();
            return(path);
        }
예제 #28
0
 static public void CloseSplash()
 {
     if (_splash != null)
     {
         if (_splash.InvokeRequired)
         {
             _splash.Invoke(new System.Windows.Forms.MethodInvoker(CloseSplash));
         }
         else
         {
             _splash.Close();
             _splash = null;
         }
     }
 }
    public string runloginwithprompt(string text, string caption, bool durchfuehren, int msgboxjaneinvalue)
    {
        this.runloginwithpromptsuccess = false;
        if (durchfuehren && msgboxjaneinvalue != 3)
        {
            System.Windows.Forms.Form prompt = new System.Windows.Forms.Form()
            {
                Width           = 500,
                Height          = 150,
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog,
                Text            = caption,
                StartPosition   = System.Windows.Forms.FormStartPosition.CenterScreen
            };
            System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label()
            {
                Left = 50, Top = 20, Text = text
            };
            System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox()
            {
                Left = 50, Top = 50, Width = 400
            };
            textBox.Focus();
            if (text == "Benutzername")
            {
                textBox.Text = "";
            }
            else if (text == "Passwort")
            {
                textBox.PasswordChar = '*';
            }

            System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button()
            {
                Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = System.Windows.Forms.DialogResult.OK
            };
            confirmation.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(textBox);
            prompt.Controls.Add(confirmation);
            prompt.Controls.Add(textLabel);
            prompt.AcceptButton            = confirmation;
            this.runloginwithpromptsuccess = true;
            return(prompt.ShowDialog() == System.Windows.Forms.DialogResult.OK ? textBox.Text : "");
        }
        else
        {
            return("");
        }
    }
예제 #30
0
 public static void FormatFormButtonEnabled(System.Windows.Forms.Form form)
 {
     try
     {
         form_fullname = form.GetType().FullName;
         List <EapButton> form_buttons_right = GetUserButtonRight(form_fullname, Eap.Config.GetConfig().user.USER_ID);
         if (form_buttons_right == null)
         {
             throw new Exception("获取用户按钮权限失败");
         }
         GetFormButtons(form, form_buttons_right);
     }
     catch (Exception ex)
     {
         Func.ShowMessage(Enum.MessageType.Error, ex.Message);
         form.Close();
     }
 }
예제 #31
0
파일: Db.cs 프로젝트: qwer/budget
        public bool ShowEvents(List<Tuple<Income, DateTime>> events)
        {
            string s = "";
            foreach (var t in events)
            {
                s += String.Format("{2}   {0} {1} {3}\r\n", t.Item1.Name, t.Item1.Amount, t.Item2, t.Item1.Period2.Format);
            }

            var f = new System.Windows.Forms.Form();
            var tb = new System.Windows.Forms.TextBox();
            tb.Multiline = true;
            tb.Dock = System.Windows.Forms.DockStyle.Fill;
            tb.Text = s;
            tb.ScrollBars = System.Windows.Forms.ScrollBars.Both;
            f.Controls.Add(tb);
            var b = new System.Windows.Forms.Button();
            b.Dock = System.Windows.Forms.DockStyle.Top;
            b.Text = "OK";
            f.Controls.Add(b);
            b.Click += delegate(object o, EventArgs e) { f.DialogResult = System.Windows.Forms.DialogResult.OK; f.Close(); };
            return f.ShowDialog() == System.Windows.Forms.DialogResult.OK;
        }
예제 #32
0
 /// <summary>
 /// Wywoluje powitalne okno, gdzie uzytkownik moze podac swoje imie.
 /// </summary>
 private void loginmenu()
 {
     System.Windows.Forms.Form prompt = new System.Windows.Forms.Form();
     prompt.Width = 300;
     prompt.Height = 150;
     prompt.Text = "Welcome!!!";
     prompt.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     System.Windows.Forms.Label textLabel = new System.Windows.Forms.Label() { Left = 50, Top = 20, Text = "Enter your name" };
     System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox() { Left = 50, Top = 50, Width = 200, Text = "Player" };
     System.Windows.Forms.Button confirmation = new System.Windows.Forms.Button() { Text = "Ok", Left = 150, Width = 100, Top = 70 };
     confirmation.Click += (sender, e) => { prompt.Close(); };
     prompt.Controls.Add(confirmation);
     prompt.Controls.Add(textLabel);
     prompt.Controls.Add(textBox);
     prompt.ShowDialog();
     PlayerName = textBox.Text;
 }