private void agregarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form1 addUser = new Form1();
     addUser.setFatherView(this);
     this.Hide();
     addUser.Show();
 }
        private void timer1_Tick(object sender, EventArgs e)
        {
            eiei++;
            switch (eiei)
            {
                case 1:
                    pictureBox1.Image = MDGame.Properties.Resources.Load2;
                    break;
                case 2:
                    pictureBox1.Image = MDGame.Properties.Resources.Load3;
                    break;
                case 3:
                    pictureBox1.Image = MDGame.Properties.Resources.Load4;
                    break;
                case 4:
                    Form1 gameView = new Form1();
                    gameView.Show();
                    this.Hide();
                    timer1.Stop();
                    break;
                //case 5:
                //    Form1 gameView = new Form1();
                //    gameView.Show();
                //    this.Hide();
                //    timer1.Stop();
                //    break;

            }
        }
Exemple #3
0
        private void pictureBoxSubmit_Click(object sender, EventArgs e)
        {
            string UserNameDb = null;

            string UserName = textBoxUserName.Text;
            string Password = textBoxPassword.Text;

            DataSet dataSet1 = User.IsUserNameExist(UserName,Password);

            foreach (DataRow row in dataSet1.Tables["UserName"].Rows)
            {
                UserNameDb = string.Format("{0}", row["UserName"]);
            }

            if (UserNameDb != null)
            {
                Form1 frm1 = new Form1();
                frm1.PassValue = textBoxUserName.Text;
                this.Visible = false;
                frm1.Show();

            }
            else
            {
                labelError.Visible = true;
                labelError.Text = "UserName or Password is Incorrect";
            }
        }
 private void BtnHRManagement_Click(object sender, EventArgs e)
 {
     Form1 MainScreen = new Form1();
     MainScreen.treeView1.SelectedNode = MainScreen.treeView1.Nodes[3];
     this.Hide();
     MainScreen.Show();
 }
 /// <summary>
 /// Loads a level
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Level2_Click(object sender, EventArgs e)
 {
     GameWorld.LoadGameState();
     GameWorld.eng.StopAllSounds();
     Form1 game = new Form1();
     game.Show();
     this.Hide();
 }
Exemple #6
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Form1 Game = new Form1();
     Game.Show();
     Game.GameLoop();
     Environment.Exit(0);
 }
        private void axWindowsMediaPlayer1_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e)
        {
            if (e.newState == 8)
            {
                Form1 N = new Form1(this);
                this.Visible = false;
                N.Show();

            }
        }
Exemple #8
0
        static void Main(string[] args)
        {
            Form1 frm = new Form1();
            frm.Show();
            Process[] proc = Process.GetProcesses();
            IntPtr hwnd = IntPtr.Zero;
            foreach (var pr in proc)
            {
                hwnd = pr.MainWindowHandle;
                if (hwnd != IntPtr.Zero)
                {
                    int length = GetWindowTextLength(hwnd);
                    StringBuilder bd = new StringBuilder(length+ 1);
                    GetWindowText(hwnd, bd, bd.Capacity);
                    Console.WriteLine(bd.ToString());
                    ShowWindow(bd);
                }
            }
            
            //IntPtr hwnd = FindWindow("IEFrame", "Google - Microsoft Internet Explorer");
            //if (hwnd == IntPtr.Zero)
            //{
            //    Console.WriteLine("Calculator is not running");
            //    return;
            //}
            //SetForegroundWindow(hwnd);
            //Thread.Sleep(500);            
            ////SendKeys.SendWait("coolkamal89");
            ////Thread.Sleep(500);
            //SendKeys.SendWait("coolkamal89");
            //Thread.Sleep(500);
            //SendKeys.SendWait("{Enter}");

            //Object o = null;
            //InternetExplorer ie = new InternetExplorer();
            //object url = "http://www.gmail.com";
            //ie.Navigate2(ref url, ref o,ref o,ref o,ref o);
            //ie.Visible = true;
            //do
            //{
            //} while (ie.Busy);
            //HTMLDocument doc =  (HTMLDocument)ie.Document;
            ////IHTMLElementCollection htmlcollection;
            //HTMLInputElement inputgmail = (HTMLInputElement)doc.getElementsByName("Email").item(null, 0);
            //inputgmail.value = "arif788";
            //Thread.Sleep(500);
            //HTMLInputElement inputpass = (HTMLInputElement)doc.getElementsByName("Passwd").item(null, 0);

            //Thread.Sleep(500);
            //HTMLButtonElement submit = (HTMLButtonElement)doc.getElementsByName("signIn").item(null, 0);
            //submit.click();
            //BusyFunction(ie);
            //MessageBox.Show("user logged in");

        }
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     using (Form1 frm = new Form1())
     {
         frm.Show();
         frm.InitializeGraphics();
         Application.Run(frm);
     }
 }
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (textBox1.Text == "admin" || textBox2.Text == "admin")
     {
         Form1 f1 = new Form1();
         f1.Show();
         this.Hide();
     }
     else
     {
         DialogResult dialogResult = MessageBox.Show("Username or Password is Wrong!", "Warning", MessageBoxButtons.OK);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     string[] saveconf=new string[5];
     saveconf[0] = textBox1.Text;
     saveconf[1] = textBox2.Text;
     saveconf[2] = textBox3.Text;
     saveconf[3] = textBox4.Text;
     saveconf[4] = textBox5.Text;
     Myconf.setInfor(saveconf);
     Form1 mainView = new Form1(Myconf);
     mainView.Show();
     Myconf.SaveConf();
     this.Hide();
 }
Exemple #12
0
        private void Accept_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                Form1 mainForm1 = new Form1();
                delPassData del = mainForm1.to_pass;
                del(this);
                Hide();
                mainForm1.Show();

            }
            else
            {
                MessageBox.Show("Nie wprowadzono danych dla aktualizacji. Uzupełnii puste pola");
            }
        }
        private void Accept_Click(object sender, EventArgs e)
        {
            if (uiComboBox1.Text != "")
            {

                Form1 mainForm1 = new Form1();
                delPassData del = mainForm1.to_pass;
                del(this, Convert.ToInt32(_updateId));
                Hide();
                mainForm1.Show();

            }
            else
            {
                MessageBox.Show("Nie wybrano żadnej aktualizaji. Wybierz aktualizację z listy.");
            }
        }
Exemple #14
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            VehiculosCL oVehiculosCl = new VehiculosCL();
            oVehiculosCl.InsertarVehiculo(txtmatricula.Text, txtmarca.Text);
            if (oVehiculosCl.IsError)
            {
                MessageBox.Show(oVehiculosCl.ErrorDescripcion, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                Form1 oPrincipal = new Form1();
                this.Close();
                oPrincipal.Show();
                MessageBox.Show("Vehiculo agregado", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
        }
Exemple #15
0
        static void Main(string[] args)
        {
            // Disable the WinForms unhandled exception dialog.
            // SurfaceShell will notify the user.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
            //Application.Run(new Form1());
            Form1 form = new Form1();
            form.startCOVER(args);
            form.Show();

            // the loop is here to keep app running if non-fatal exception is caught.
            do
            {
                Application.DoEvents();
                form.Frame();
            }
            while (!form.IsDisposed);
        }
Exemple #16
0
        public void Show()
        {

            // For Dot net control user need to create object at every Display

            //WinForm Control
            MyWinFormControl = new Form1();
            //If you are adding Winform in Property Page need to set TopLevel Property to false
            MyWinFormControl.TopLevel = false;
            MyWinFormControl.Show();
            dotnet1.SetWindowHandle(MyWinFormControl.Handle.ToInt64());


            //User Control
            MyUserControl = new UserControl1();
            dotnet2.SetWindowHandle(MyUserControl.Handle.ToInt64());


            //WPF control
            elhost = new ElementHost();
            MyWPFControl = new WPFControl();
            elhost.Child = MyWPFControl;
            dotnet3.SetWindowHandle(elhost.Handle.ToInt64());

            //Show Proppety page
            swPropertyPage.Show();

        }
 private void cidadeToolStripMenuItem_Click(object sender, EventArgs e)
 {
     GaragemExpress.Form1 frmCit = new Form1();
     frmCit.Show();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            //new questionnaire

            //do we have a questionnaire open already ?
            if (qFormIsOpen)
            {
                //still open
                errorBox.setLabel("Error: You have a Questionnaire already open: you must close it first.");
                errorBox.ShowDialog();
                return;

            }

            //has the user selected a language and participant ID

            string language = (string)listBox1.SelectedItem;

            if (language == null)
            {
                errorBox.setLabel("Error: Please select language");
                errorBox.ShowDialog();
                return;

            }

            string xmlFilePath;

            //what is the filePath for the xml config file
            if(language == "English"){

                xmlFilePath= dataDir + "\\EQuestionnaire_English.xml";

            }

            else if (language == "Chewa")
            {

                xmlFilePath = dataDir + "\\EQuestionnaire_Chewa.xml";

            }

            else
            {

                //language not supported
                errorBox.setLabel("Error: Language '" + language + " is not currently supported");
                errorBox.ShowDialog();
                return;

            }

            //check that the xml file exists
            if(! File.Exists(xmlFilePath)){

                errorBox.setLabel("Error: Cannot find expected configuration file:" + xmlFilePath);
                errorBox.ShowDialog();
                return;

            }

            //participantID
            string partID = textBox1.Text;

            if (string.IsNullOrWhiteSpace(partID))
            {

                errorBox.setLabel("Error: Please enter a Participant ID");
                errorBox.ShowDialog();
                return;

            }

            //check that the partID does not contain any underscore characters (which will cause problems as its gets embedded into dir/file names which use underscores as separators
            if (partID.Contains("_"))
            {

                errorBox.setLabel("Error: The Participant ID contains underscore character(s), which is not allowed.");
                errorBox.ShowDialog();
                return;

            }

            //does this participant already exist (in which case they should be using the existing participant page)?
            foreach (Participant part in listBox2.Items)
            {
                if (partID == part.getID())
                {

                    errorBox.setLabel("Error: This participant already exists");
                    errorBox.ShowDialog();
                    return;

                }

            }

            //has the user set the GPS baud rate, port and the main data dir ?

            portNum = (string)comboBox1.SelectedItem;
            baudRate = (string)comboBox2.SelectedItem;
            gpsCountry = (string)comboBox3.SelectedItem;

            if (dataDir == null)
            {
                errorBox.setLabel("Error: Please set the data directory (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (portNum == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS port Number (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (baudRate == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS baudrate (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (gpsCountry == null && Utils.GPSenabled)
            {
                errorBox.setLabel("Error: Please set the GPS country (settings)");
                errorBox.ShowDialog();
                return;

            }

            //check that this participant does not already exist, i.e. that the new datadir does not exist

            string partDataDir = dataDir + "\\participant_data_" + language + "_" + partID;

            if (Directory.Exists(partDataDir))
            {
                //user already exists
                errorBox.setLabel("Error: This Participant already exists.");
                errorBox.ShowDialog();
                return;

            }

            //create the new dir.
            try
            {

                Directory.CreateDirectory(partDataDir);

            }
            catch
            {

                errorBox.setLabel("Error: Could not create directory for this participant. You may not have permission to write to this location");
                errorBox.ShowDialog();
                return;

            }

            //if the logger is running: suspend it
            //i.e. disconnect from the serial port
            /*
            if (loggerStatus == "on")
            {

                //turn off until user exits the Q window
                //disable the timer
                timer1.Enabled = false;

                //close the serial port
                if (serialPort1.IsOpen)
                {
                    serialPort1.Close();

                }

                label11.Text = "suspended while Questionnaire is open";
                label12.Text = "suspended while Questionnaire is open";

                loggerStatus = "suspended";

            }
             * */

            //open the form
            currentSurvey = new Form1();

            try
            {

                //start the survey
                currentSurvey.startSurvey(xmlFilePath, partDataDir, partID, true, portNum, baudRate, this, gpsCountry);

                currentSurvey.Show();

                qFormIsOpen = true;

                openParticipantID = partID;

            }
            catch (ObjectDisposedException e2)
            {

                //something went wrong with startup, e.g. XML parsing exception

                qFormIsOpen = false;

            }
        }
Exemple #19
0
        /// <summary>
        ///     Creates our OpenGL Window.
        /// </summary>
        /// <param name="title">
        ///     The title to appear at the top of the window.
        /// </param>
        /// <param name="width">
        ///     The width of the GL window or fullscreen mode.
        /// </param>
        /// <param name="height">
        ///     The height of the GL window or fullscreen mode.
        /// </param>
        /// <param name="bits">
        ///     The number of bits to use for color (8/16/24/32).
        /// </param>
        /// <param name="fullscreenflag">
        ///     Use fullscreen mode (<c>true</c>) or windowed mode (<c>false</c>).
        /// </param>
        /// <returns>
        ///     <c>true</c> on successful window creation, otherwise <c>false</c>.
        /// </returns>
        private static bool CreateGLWindow(string title, int width, int height, int bits, bool fullscreenflag)
        {
            int pixelFormat;                                                    // Holds The Results After Searching For A Match
            fullscreen = fullscreenflag;                                        // Set The Global Fullscreen Flag
            form = null;                                                        // Null The Form

            GC.Collect();                                                       // Request A Collection
            // This Forces A Swap
            Kernel.SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);

            if (fullscreen)
            {                                                    // Attempt Fullscreen Mode?
                Gdi.DEVMODE dmScreenSettings = new Gdi.DEVMODE();               // Device Mode
                // Size Of The Devmode Structure
                dmScreenSettings.dmSize = (short)Marshal.SizeOf(dmScreenSettings);
                dmScreenSettings.dmPelsWidth = width;                           // Selected Screen Width
                dmScreenSettings.dmPelsHeight = height ;                         // Selected Screen Height
                dmScreenSettings.dmBitsPerPel = bits;                           // Selected Bits Per Pixel
                dmScreenSettings.dmFields = Gdi.DM_BITSPERPEL | Gdi.DM_PELSWIDTH | Gdi.DM_PELSHEIGHT;

                // Try To Set Selected Mode And Get Results.  NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
                if (User.ChangeDisplaySettings(ref dmScreenSettings, User.CDS_FULLSCREEN) != User.DISP_CHANGE_SUCCESSFUL)
                {
                    // If The Mode Fails, Offer Two Options.  Quit Or Use Windowed Mode.
                    if (MessageBox.Show("The Requested Fullscreen Mode Is Not Supported By\nYour Video Card.  Use Windowed Mode Instead?", "NeHe GL",
                        MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        fullscreen = false;                                     // Windowed Mode Selected.  Fullscreen = false
                    }
                    else
                    {
                        // Pop up A Message Box Lessing User Know The Program Is Closing.
                        MessageBox.Show("Program Will Now Close.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return false;                                           // Return false
                    }
                }
            }

            form = new Form1();                                             // Create The Window

            pc1 = new PictureBox();
            form.Child = pc1;
            if (fullscreen)
            {                                                    // Are We Still In Fullscreen Mode?
                form.FormBorderStyle = FormBorderStyle.None;                    // No Border
                //Cursor.Hide();                                                  // Hide Mouse Pointer

            }
            else
            {                                                              // If Windowed
                form.FormBorderStyle = FormBorderStyle.Sizable;                 // Sizable
                Cursor.Show();                                                  // Show Mouse Pointer
            }

            form.Width = width+bordwidth ;                                                 // Set Window Width
            form.Height = height+bordheight ;                                               // Set Window Height

            //pc1.Location = new System.Drawing.Point(42, 42);

            //pc1.Width = width ;
            //pc1.Height =height  ;
            //pc1.Width = width-100;
            //pc1.Height = height-100 ;
            //form.Width = 100 + width;
            //form.Height = 100 + height;
            form.Text = title;                                                  // Set Window Title

            Gdi.PIXELFORMATDESCRIPTOR pfd = new Gdi.PIXELFORMATDESCRIPTOR();    // pfd Tells Windows How We Want Things To Be
            pfd.nSize = (short)Marshal.SizeOf(pfd);                            // Size Of This Pixel Format Descriptor
            pfd.nVersion = 1;                                                   // Version Number
            pfd.dwFlags = Gdi.PFD_DRAW_TO_WINDOW|                            // Format Must Support Window
                Gdi.PFD_SUPPORT_OPENGL |                                        // Format Must Support OpenGL
                Gdi.PFD_DOUBLEBUFFER;                                           // Format Must Support Double Buffering
            pfd.iPixelType = (byte)Gdi.PFD_TYPE_RGBA;                          // Request An RGBA Format
            pfd.cColorBits = (byte)bits;                                       // Select Our Color Depth
            pfd.cRedBits = 0;                                                   // Color Bits Ignored
            pfd.cRedShift = 0;
            pfd.cGreenBits = 0;
            pfd.cGreenShift = 0;
            pfd.cBlueBits = 0;
            pfd.cBlueShift = 0;
            pfd.cAlphaBits = 0;                                                 // No Alpha Buffer
            pfd.cAlphaShift = 0;                                                // Shift Bit Ignored
            pfd.cAccumBits = 0;                                                 // No Accumulation Buffer
            pfd.cAccumRedBits = 0;                                              // Accumulation Bits Ignored
            pfd.cAccumGreenBits = 0;
            pfd.cAccumBlueBits = 0;
            pfd.cAccumAlphaBits = 0;
            pfd.cDepthBits = 16;                                                // 16Bit Z-Buffer (Depth Buffer)
            pfd.cStencilBits = 0;                                               // No Stencil Buffer
            pfd.cAuxBuffers = 0;                                                // No Auxiliary Buffer
            pfd.iLayerType = (byte)Gdi.PFD_MAIN_PLANE;                         // Main Drawing Layer
            pfd.bReserved = 0;                                                  // Reserved
            pfd.dwLayerMask = 0;                                                // Layer Masks Ignored
            pfd.dwVisibleMask = 0;
            pfd.dwDamageMask = 0;
            hDC = User.GetDC(pc1.Handle);
            //hDC = User.GetDC(form.Handle);                                      // Attempt To Get A Device Context
            if (hDC == IntPtr.Zero)
            {                                            // Did We Get A Device Context?
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Can't Create A GL Device Context.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            pixelFormat = Gdi.ChoosePixelFormat(hDC, ref pfd);                  // Attempt To Find An Appropriate Pixel Format
            if (pixelFormat == 0)
            {                                              // Did Windows Find A Matching Pixel Format?
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Can't Find A Suitable PixelFormat.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (!Gdi.SetPixelFormat(hDC, pixelFormat, ref pfd))
            {                // Are We Able To Set The Pixel Format?
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Can't Set The PixelFormat.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            hRC = Wgl.wglCreateContext(hDC);                                    // Attempt To Get The Rendering Context
            if (hRC == IntPtr.Zero)
            {                                            // Are We Able To Get A Rendering Context?
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Can't Create A GL Rendering Context.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (!Wgl.wglMakeCurrent(hDC, hRC))
            {                                 // Try To Activate The Rendering Context
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Can't Activate The GL Rendering Context.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            form.Show();                                                        // Show The Window

            form.TopMost = true;                                                // Topmost Window
            form.Focus();                                                       // Focus The Window
               // pc1.Focus();
            if (fullscreen)
            {                                                    // This Shouldn't Be Necessary, But Is
                Cursor.Hide();
            }
            ReSizeGLScene(width, height);                                       // Set Up Our Perspective GL Screen

            if (!InitGL())
            {                                                     // Initialize Our Newly Created GL Window
                KillGLWindow();                                                 // Reset The Display
                MessageBox.Show("Initialization Failed.", "ERROR",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            return true;                                                        // Success
        }
 private void btnVoltar_Click(object sender, EventArgs e)
 {
     Form1 f1 = new Form1();
     f1.Show();
     this.Dispose();
 }
Exemple #21
0
 /// <summary>
 /// Set the timeout period for the length of time the splashscreen is shown.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void timeoutTimer_Tick(object sender, EventArgs e)
 {
     if (firstRun)
     {
         firstRun = false;
         this.BackgroundImage = Properties.Resources.ControlsPic;
         this.copywriteLabel.Visible = false;
     }
     else
     {
         this.TopMost = true;
         timeoutTimer.Stop();
         Form1 mainWindow = new Form1();
         mainWindow.Show();
         fadeOutTimer.Start();
     }
 }
Exemple #22
0
        /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
        /// <param term='commandName'>The name of the command to execute.</param>
        /// <param term='executeOption'>Describes how the command should be run.</param>
        /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
        /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
        /// <param term='handled'>Informs the caller if the command was handled or not.</param>
        /// <seealso class='Exec' />
        public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            handled = false;
            if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
            {

                //switch(commandName){ ........ }
                switch(commandName){
                    case "MyAddin1.Connect.MyAddin1":
                        Form1 fm = new Form1();
                        fm.Show();
                        handled = true;
                        /*return;*/
                        break;
                    case "MyAddin1.Connect.MyAddin1_2":
                        MessageBox.Show(" Exec() cmd_MyAddin1_2 !");
            //                         string res = "";
            //
            //                         try
            //                         {
            //                             int l = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars).Count;
            //                              for (int i = 1; i<l; ++i){
            //                                 res += ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject.CommandBars)[i].Name;
            //                                 res += "\n";
            //                             }
            //                         }
            //                         catch
            //                         {
            //                             MessageBox.Show("error");
            //                         }
            //                         finally
            //                         {
            //                             //MessageBox.Show(res);
            //                             //Console.Write(res);
            //                             StreamWriter sw = new StreamWriter("C:/cmd.txt");
            //                             sw.Write(res);
            //                             sw.Close();
            //                         }
                        handled = true;
                        /*return;*/
                        break;
                    case "MyAddin1.Connect.AddToolbar2":
                       //MessageBox.Show("Toolbar item Clicked! ");

                        TextSelection selection =this._applicationObject.ActiveDocument.Selection as TextSelection;
                        MessageBox.Show(selection.Text);

                        handled = true;
                        /*return;*/
                        break;
                    case "MyAddin1.Connect.AddCmd":
                        //MessageBox.Show("Toolbar item Clicked! ");

                        TextSelection selection1 = this._applicationObject.ActiveDocument.Selection as TextSelection;
                        MessageBox.Show(selection1.Text);

                        handled = true;
                        /*return;*/
                        break;
                }
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            //edit selected questionnaire

            //do we have a questionnaire open already ?
            if (qFormIsOpen)
            {
                //still open
                errorBox.setLabel("Error: You have a Questionnaire already open: you must close it first.");
                errorBox.ShowDialog();
                return;

            }

            Participant selectedPart = (Participant)listBox2.SelectedItem;

            if (selectedPart == null)
            {

                errorBox.setLabel("Error: Please select a Participant from the list");
                errorBox.ShowDialog();
                return;

            }

            //is the Part locked
            if (selectedPart.Locked)
            {
                errorBox.setLabel("Error: Cannot edit a locked Participant");
                errorBox.ShowDialog();
                return;

            }

            if (dataDir == null)
            {
                errorBox.setLabel("Error: Please set the data directory (settings)");
                errorBox.ShowDialog();
                return;

            }

            //open the form

            //has the user selected a language and participant ID

            string language = selectedPart.getLanguage();

            string xmlFilePath;

            //what is the filePath for the xml config file
            if (language == "English")
            {

                xmlFilePath = dataDir + "\\EQuestionnaire_English.xml";

            }
            else if (language == "Chewa")
            {

                xmlFilePath = dataDir + "\\EQuestionnaire_Chewa.xml";

            }
            else
            {

                //language not supported
                errorBox.setLabel("Error: Language '" + language + " is not currently supported");
                errorBox.ShowDialog();
                return;

            }

            //check that the xml file exists
            if (!File.Exists(xmlFilePath))
            {

                errorBox.setLabel("Error: Cannot find expected configuration file:" + xmlFilePath);
                errorBox.ShowDialog();
                return;

            }

            //participantID
            string partID = selectedPart.getID();

            //has the user set the GPS baud rate, port and the main data dir ?

            portNum = (string)comboBox1.SelectedItem;
            baudRate = (string)comboBox2.SelectedItem;
            gpsCountry = (string)comboBox3.SelectedItem;

            if (portNum == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS port Number (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (baudRate == null && Utils.GPSenabled)
            {

                errorBox.setLabel("Error: Please set the GPS baudrate (settings)");
                errorBox.ShowDialog();
                return;

            }

            if (gpsCountry == null && Utils.GPSenabled)
            {
                errorBox.setLabel("Error: Please set the GPS country (settings)");
                errorBox.ShowDialog();
                return;

            }

            //check that this participant does not already exist, i.e. that the new datadir does not exist

            string partDataDir = selectedPart.getPath();

            //turn off the GPS logger if on
            /*
            if (loggerStatus == "on")
            {

                //turn off until user exits the Q window
                //disable the timer
                timer1.Enabled = false;

                //close the serial port
                if (serialPort1.IsOpen)
                {
                    serialPort1.Close();

                }

                label11.Text = "suspended while Questionnaire is open";
                label12.Text = "suspended while Questionnaire is open";

                loggerStatus = "suspended";

            }
             * */

            //open the form
            currentSurvey = new Form1();

            try
            {

                //start the survey
                currentSurvey.startSurvey(xmlFilePath, partDataDir, partID, false, portNum, baudRate, this, gpsCountry);

                currentSurvey.Show();

                qFormIsOpen = true;

                openParticipantID = partID;

            }
            catch(ObjectDisposedException e2){

                //something went wrong with startup, e.g. XML parsing exception

                qFormIsOpen = false;

            }
        }
 //Recently Added
 // public string _saveFileDialog1
 //{
 //get
 //{
 //   return _saveFileDialog1;
 // }
 // }
 //Recently Added2
 // public string _saveFile
 // {
 //  get
 //  {
 //  return saveFileDialog1.FileName.ToString();
 //  }
 // }
 private void bttCaptureArea_Click(object sender, EventArgs e)
 {
     fileDetails();
     projectNumber = Settings.Default.projectNumber;
     projectName = Settings.Default.projectName;
     fileName = Settings.Default.fileName;
     version = Settings.Default.version;
     author = Settings.Default.author;
     DateTime mydate = DateTime.UtcNow;
     date = mydate.ToString("yyMMdd");
     saveFileDialog1.FileName = date + "_" + projectNumber + "_" + projectName + "_" + fileName + "_" + version + "_" + author;
     FileInfo f = new FileInfo(saveFileDialog1.FileName);
     saveFileName = f.Name;
     //saveFileDialog1.FileName = date + "_" + projectNumber + "_" + projectName + "_" + fileName + "_" + version + "_" + author;
     this.Hide();
     Form1 form1 = new Form1();
     form1.InstanceRef = this;
     //Recently Added line
     //form1._saveFile = saveFileDialog1.FileName.ToString();
     saveFileDialog1.DefaultExt = "png";
     saveFileDialog1.FileName = date + "_" + projectNumber + "_" + projectName + "_" + fileName + "_" + version + "_" + author;
     //savedetails = saveFileDialog1.FileName.ToString();
     //fileDetails();
     form1.Show();
     //projectNumber = Settings.Default.projectNumber;
     //projectName = Settings.Default.projectName;
     //fileName = Settings.Default.fileName;
     //version = Settings.Default.version;
     //author = Settings.Default.author;
     //date = DateTime.Now.ToString("yymmd");
     //saveFileDialog1.FileName = date + "_" + projectNumber + "_" + projectName + "_" + fileName + "_" + version + "_" + author;
 }
Exemple #25
0
 private void button1_Click(object sender, EventArgs e)
 {
     Form1 gameView = new Form1();
     gameView.Show();
     this.Hide();
 }
Exemple #26
0
 private void button1_Click(object sender, EventArgs e)
 {
     Form1 game = new Form1();
     game.Show();
 }