Beispiel #1
0
        public string ShowMyDialogBox()
        {
            Form2 testDialog = new Form2();

            // Show testDialog as a modal dialog and determine if DialogResult = OK.
            if (testDialog.ShowDialog(this) == DialogResult.OK)
            {
                // Read the contents of testDialog's TextBox.
                testDialog.Dispose();

                return(testDialog.textBox1.Text);
            }
            else
            {
                testDialog.Dispose();
                return("Cancel");
            }
        }
Beispiel #2
0
        private void startConvert()
        {
            initializeConvert();
            Form2 f2 = new Form2();

            f2.Show(this);
            System.Windows.Forms.Clipboard.SetText(getMessage(f2));
            f2.Dispose();
            MessageBox.Show("クリップボードにWikiフォーマットのデータがコピーされました。\r\n" +
                            "貼り付けて利用してください。",
                            "変換完了");
        }
Beispiel #3
0
        private void login()
        {
            label2.Text = "Login success";
            this.Hide();
            Form2 frm = new Form2();

            frm.ShowDialog();

            if (frm.closed)
            {
                frm.Dispose();
                this.Close();
            }
        }
Beispiel #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form2 RForm = new Form2();

            RForm.ShowDialog();
            if (RForm.DialogResult != DialogResult.OK)
            {
                RForm.Dispose();

                return;
            }
            try
            {
                Object display             = true;
                Outlook._Application olook = new Outlook.Application();
                Outlook._MailItem    omail = olook.CreateItem(0);
                omail.HTMLBody = createMailBody(RForm.ReportCBX.Text);
                omail.Display(display);
            }
            finally
            {
                RForm.Dispose();
            }
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form2 RForm = new Form2();

            RForm.ShowDialog();
            if (RForm.DialogResult != DialogResult.OK)
            {
                RForm.Dispose();

                return;
            }
            Object template = Directory.GetCurrentDirectory() + "\\Includes\\Word_Template.dotx";

            Console.WriteLine(template.ToString());
            Object oMissing  = System.Reflection.Missing.Value;
            Object isvisible = true;

            Word._Application oWord = new Word.Application();
            try
            {
                Word._Document oDoc       = oWord.Documents.Add(template, oMissing, oMissing, isvisible);
                Word.Table     otable     = oDoc.Tables[2];
                String         ReportType = RForm.ReportCBX.Text;
                if (ReportType == "Digitizer Items Only")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm         = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        Boolean      isDigitizer = false;
                        if (itm.GetPropertyResultAsBoolean("isArea", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isLinear", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isSegment", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isCount", false) == true)
                        {
                            isDigitizer = true;
                        }

                        if (isDigitizer)
                        {
                            rowidx++;
                            itmtoword(itm, otable, rowidx, "Digitizer");
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Parts Only")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            rowidx++;
                            itmtoword(itm, otable, rowidx, "Part");
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Digitizer Items w/Parts")
                {
                    int rowidx = 1;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);

                        rowidx++;
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            itmtoword(itm, otable, rowidx, "Part");
                        }
                        else
                        {
                            itmtoword(itm, otable, rowidx, "Digitizer");
                        }

                        this.progressBar1.Value = idx;
                    }
                }
            }
            finally
            {
                this.progressBar1.Value = 0;
                oWord.Visible           = true;
                oWord = null;
                RForm.Dispose();
            }
        }
Beispiel #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            Form2 RForm = new Form2();

            RForm.ShowDialog();
            if (RForm.DialogResult != DialogResult.OK)
            {
                RForm.Dispose();

                return;
            }
            Object template = Directory.GetCurrentDirectory() + "\\Includes\\Excel_Template.XLT";

            Console.WriteLine(template.ToString());
            Object oMissing  = System.Reflection.Missing.Value;
            Object isvisible = true;

            Excel._Application oExcel = new Excel.Application();
            try
            {
                Excel._Workbook  oBook      = oExcel.Workbooks.Add(template);
                Excel._Worksheet oSheet     = oExcel.Worksheets[1];
                String           ReportType = RForm.ReportCBX.Text;
                if (ReportType == "Digitizer Items Only")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm         = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        Boolean      isDigitizer = false;
                        if (itm.GetPropertyResultAsBoolean("isArea", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isLinear", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isSegment", false) == true)
                        {
                            isDigitizer = true;
                        }
                        if (itm.GetPropertyResultAsBoolean("isCount", false) == true)
                        {
                            isDigitizer = true;
                        }

                        if (isDigitizer)
                        {
                            rowidx++;
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Parts Only")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            rowidx++;
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        this.progressBar1.Value = idx;
                    }
                }
                if (ReportType == "Digitizer Items w/Parts")
                {
                    int rowidx = 17;
                    for (int idx = 0; idx <= TGlobal.tlst.Count - 1; idx++)
                    {
                        pswift.IItem itm = TGlobal.ps.GetItem(TGlobal.tlst[idx]);

                        rowidx++;
                        if (itm.GetPropertyResultAsBoolean("isPart", false) == true)
                        {
                            itmtoexcel(itm, rowidx, oSheet);
                        }
                        else
                        {
                            itmtoexcel(itm, rowidx, oSheet);
                        }

                        this.progressBar1.Value = idx;
                    }
                }
            }
            finally
            {
                this.progressBar1.Value = 0;
                oExcel.Visible          = true;
                oExcel = null;
                RForm.Dispose();
            }
        }
    public static bool FilterCommandsToUbiquitiRadio(ref string command)
    {
        //       byte[] msgData = utilHexToBin(text.TrimEnd('\r', '\n', ' '));
        byte[] msgData = utilHexToBin(command);

        switch (msgData[0])
        {
        case (byte)RadioCommands.SET_DATE:                                          //pick date and convert it to the RTC format

            WindowsFormsApplication1.Form2 customForm = new WindowsFormsApplication1.Form2();
            customForm.dateTimePicker1.Format     = DateTimePickerFormat.Long;
            customForm.dateTimePicker1.ShowUpDown = false;
            var fr = customForm.ShowDialog();

            if (DialogResult.Cancel == fr)                                          //data pick was canceled
            {
                customForm.Dispose();
                return(false);
            }
            else
            {
                if (DayOfWeek.Sunday == customForm.dateTimePicker1.Value.DayOfWeek)
                {
                    command = " " + ByteTohexString((byte)RtcDayOfWeek.sun);
                }
                else
                {
                    command = " " + ByteTohexString((byte)customForm.dateTimePicker1.Value.DayOfWeek);
                }
                command += " " + ByteTohexString((byte)customForm.dateTimePicker1.Value.Day);
                command += " " + ByteTohexString((byte)(((customForm.dateTimePicker1.Value.Month / 10) << 4) + customForm.dateTimePicker1.Value.Month % 10));
                command += " " + ByteTohexString((byte)((((customForm.dateTimePicker1.Value.Year - 2000) / 10) << 4) + (customForm.dateTimePicker1.Value.Year - 2000) % 10));
            }

            customForm.Dispose();
            return(true);

        case (byte)RadioCommands.SET_TIME:                                          //pick time and convert it to the RTC format

            WindowsFormsApplication1.Form2 customForm2 = new WindowsFormsApplication1.Form2();
            customForm2.dateTimePicker1.Format     = DateTimePickerFormat.Time;
            customForm2.dateTimePicker1.ShowUpDown = true;
            var fr2 = customForm2.ShowDialog();

            if (DialogResult.Cancel == fr2)                                          //time pick was canceled
            {
                customForm2.Dispose();
                return(false);
            }
            else
            {
                command  = " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Hour / 10) << 4) + customForm2.dateTimePicker1.Value.Hour % 10));
                command += " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Minute / 10) << 4) + customForm2.dateTimePicker1.Value.Minute % 10));
                command += " " + ByteTohexString((byte)(((customForm2.dateTimePicker1.Value.Second / 10) << 4) + customForm2.dateTimePicker1.Value.Second % 10));
            }

            customForm2.Dispose();
            return(true);

        case (byte)RadioCommands.SET_ALARM:                                          //pick time and convert it to the RTC format

            WindowsFormsApplication1.Alarm customForm3 = new WindowsFormsApplication1.Alarm();
            var fr3 = customForm3.ShowDialog();

            if (DialogResult.Cancel == fr3)                                          //time pick was canceled
            {
                customForm3.Dispose();
                return(false);
            }
            else
            {
                command  = " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Hour / 10) << 4) + customForm3.dateTimePickerTime.Value.Hour % 10));
                command += " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Minute / 10) << 4) + customForm3.dateTimePickerTime.Value.Minute % 10));
                command += " " + ByteTohexString((byte)(((customForm3.dateTimePickerTime.Value.Second / 10) << 4) + customForm3.dateTimePickerTime.Value.Second % 10));

                command += " " + ByteTohexString((byte)(customForm3.dateTimePickerDate.Value.Day));
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
                if (customForm3.checkBoxEveryDay.Checked)
                {
                    command += " 80";
                }
                else
                {
                    command += " 00";
                }
            }

            customForm3.Dispose();
            return(true);

        default:
            break;
        }

        return(false);
    }