Example #1
0
        private void btnExecuteCLS_Click(object sender, EventArgs e)
        {
            Form2 fr2 = new Form2();
            try
            {
                fr2.Show();

                Thread th = new Thread(ExecCls);
                th.Start();
                while (th.ThreadState == ThreadState.Running)
                    Application.DoEvents();

                gridControl1.DataSource = StaticTable.computecell.dtVar;
                //gridView1.PopulateColumns(); //会删除手动建立的字段,需要在窗口中定义其属性,一一映射

                gridView1.OptionsView.ColumnAutoWidth = true;
                ConditionsAdjustment();

                gridControl1.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                fr2.Hide();
            }
        }
Example #2
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     DialogResult _dlgResult;
     Form2 _frm = new Form2();
     _dlgResult = _frm.ShowDialog();
     if (_dlgResult == DialogResult.OK)
         Application.Run(new Form1());
 }
Example #3
0
 private void button3_Click(object sender, EventArgs e)
 {
     Form2 f2 = new Form2();
     f2.ShowDialog();
     if (DialogResult.OK == f2.DialogResult)
     {
         Show_game(g, 0);
     }
     else Close();
 }
Example #4
0
 //        public static Flags Flag;
 public static void Main(String[] args)
 {
     LoadAppConfigSetting();
     MainForm = new Form2 {Text = @"Web Portal Server - v1.2.285"};
     //            Flag = new Flags();
     MainForm.FormClosing += mainForm_FormClosing;
     MainForm.resetBtn.Click += resetBtn_Click;
     MainForm.forceSync.Click += forceSync_Click;
     MainForm.StartStop.Click +=StartStop_Click;
     MainForm.configSave.Click +=configSave_Click;
     Application.Run(MainForm);
 }
Example #5
0
        private async void Blink(Form2 form2)
        {
            
            form2.Controls.Find("label3", true).FirstOrDefault().BackColor = Color.Green;
            //   TODO: timer, ktery za chvilku zmeni barvu zpet na cervenou
            
            myTimer.Interval = 50;
            myTimer.Tick += new EventHandler(myTimerTick);
            myTimer.Start();
            // form2.Controls.Find("label3", true).FirstOrDefault().BackColor = Color.Red;


        }
Example #6
0
        public void StartUdpServer (Form2 form2)
        {
            //myTimer.Interval = 50;
            //myTimer.Tick += new EventHandler(myTimerTick);
            publicForm2 = form2;
            JsonHelper jsh = new JsonHelper();
            Task.Run(async () =>
            {

                using (var udpClient = new UdpClient(9992))
                {
                    StartConversation2(udpClient);
                   // SetTime(udpClient);
                    //string path = @"Jsons/" + jsh.deleteAllButNumbers(DateTime.Now.ToString()) + ".txt";
                    //File.Create(path);
                    string udpString = "";
                    while (true)
                    {
                        //IPEndPoint object will allow us to read datagrams sent from any source.
                        var receivedResults = await udpClient.ReceiveAsync();
                        udpString = Encoding.ASCII.GetString(receivedResults.Buffer);

                        //using (StreamWriter writetext = new StreamWriter(path, true))
                        //{
                        //    writetext.WriteLine(udpString);
                        //}

                        // Blink(form2);

                        form2.Controls.Find("label3", true).FirstOrDefault().BackColor = Color.Green;
                        //   TODO: timer, ktery za chvilku zmeni barvu zpet na cervenou

                       
                        //myTimer.Start();

                        Monitor.Enter(lstBuffer);
                            lstBuffer.Add(udpString);
                            Monitor.Exit(lstBuffer);
                         //  MessageBox.Show(loggingEvent);
                        
                        
                                               
                    }
                }
            });
        }
Example #7
0
        private void Insert(object sender, EventArgs e)
        {
            string passWord;
            string userName;
            string userID;
            string key;
            double currency;

            Form2 AddUser = new Form2();
            DialogResult dr = AddUser.ShowDialog();

            userName = AddUser.userName;
            passWord = AddUser.passWord;
            currency = AddUser.accountBalance;

            if(currency >0 && dr == DialogResult.OK)
            {
            ///Reference Encrypt Later On
                MD5 md = new MD5CryptoServiceProvider();
                string toHash;
                byte[] hash;

                toHash = userName + "+" + passWord;
                hash = md.ComputeHash(Encoding.ASCII.GetBytes(toHash));

                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < hash.Length; i++)
                {
                    sb.Append(hash[i].ToString("x2"));
                }

                key = sb.ToString();
                //End Encrypt

                Guid guid = Guid.NewGuid();
                userID = guid.ToString("N");

                this.userDetailsTableAdapter.InsertQuery(userID, userName, key, Convert.ToDecimal(currency));
            }
            else
            {
                ErrorLabel.Text = "Failed Insert";
            }

            this.userDetailsTableAdapter.Fill(this.blackJackDBDataSet.UserDetails);
        }
Example #8
0
 private void renameToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     TFunc f = GetSelectedFunction();
     if (f != null)
     {
         Form2 Fm = new Form2();
         Fm.NName = f.FName;
         if (Fm.ShowDialog() == DialogResult.OK)
             MyGNIDA.RenameFunction(f, Fm.NName);
     }
 }
Example #9
0
 //public constructor
 public Form1()
 {
     //Initialize form
     InitializeComponent();
     //Set instance of a new form with this form passed as a parameter
     BattleScene = new Form2(this);
 }
Example #10
0
 public Form1()
 {
     logForm = new Form2();
     InitializeComponent();
 }
        private void BaseForm_Load(object sender, EventArgs e)
        {
            //set English as default language
            listBox1.SelectedItem = "English";

            groupBox1.ForeColor = GlobalColours.mainTextColour;

            //set active cursor on the partID box
            textBox1.Focus();

            //init dialogs
            warningMessageBox = new Form3();
            stdMessageBox = new MessageForm();
            errorBox = new Form2();
            confirmForm = new ConfirmForm();

            //get saved values from registry if they exist
            //readonly access
            RegistryKey regKey = Registry.CurrentUser.OpenSubKey(keyName);
            if (regKey != null)
            {

                //get values
                dataDir = (string)regKey.GetValue("DATA_DIR");
                portNum = (string)regKey.GetValue("GPS_PORT");
                baudRate = (string)regKey.GetValue("GPS_BAUD");
                gpsCountry = (string)regKey.GetValue("GPS_COUNTRY");

                string GPSenabled = (string)regKey.GetValue("GPS_ENABLED");

                if (GPSenabled == "TRUE")
                {

                    Utils.GPSenabled = true;

                    //enable checkbox
                    checkBox1.Checked = true;

                }
                else
                {
                    Utils.GPSenabled = false;

                    checkBox1.Checked = false;

                }

                if (dataDir != null)
                {
                    label7.Text = dataDir;

                }

                if (portNum != null)
                {

                    comboBox1.SelectedItem = portNum;

                }

                if (baudRate != null)
                {

                    comboBox2.SelectedItem = baudRate;

                }

                if (gpsCountry != null)
                {

                    comboBox3.SelectedItem = gpsCountry;

                }

                regKey.Close();

            }

            if (dataDir != null)
            {

                //does the base dir still exist, i.e. its possible that the user has moved or deleted it.
                if (Directory.Exists(dataDir))
                {
                    //populate the current questionnaires, if any
                    updateExistingQuestionList();

                    //load help text file
                    loadHelp();

                }
                else
                {
                    warningMessageBox.setLabel("Warning: The Data Directory has been changed: please update the settings");
                    warningMessageBox.ShowDialog();

                }

            }
        }
Example #12
0
        /// <summary>
        /// This method is an alternate way of saving PCCs
        /// Instead of reconstructing the PCC from the data taken, it instead copies across the existing
        /// data, appends new exports, updates the export list, changes the namelist location and updates the
        /// value in the header
        /// </summary>
        /// <param name="newFileName">The filename to write to</param>
        /// <param name="attemptOverwrite">Do you wish to attempt to overwrite the existing export</param>
        public string altSaveToFile(string newFileName, bool attemptOverwrite, int HeadeNameOffset = 34)
        {
            string rtValues = "";
            string loc = Path.GetDirectoryName(Application.ExecutablePath);

            //Check whether compressed
            if (this.bCompressed)
            {
                Form2 decompress = new Form2();
                decompress.Decompress(this.pccFileName);
                decompress.Close();
                //MessageBox.Show("Decompression complete");
            }

            //Get info
            expInfoEndOffset = ExportOffset + Exports.Sum(export => export.info.Length);
            if (expDataBegOffset < expInfoEndOffset)
                expDataBegOffset = expInfoEndOffset;
            //List<ExportEntry> unchangedExports = Exports.Where(export => !export.hasChanged || (export.hasChanged && export.Data.Length <= export.DataSize)).ToList();
            List<ExportEntry> unchangedExports = Exports.Where(export => !export.hasChanged).ToList();
            List<ExportEntry> changedExports;
            List<ExportEntry> replaceExports = null;
            if (!attemptOverwrite)
            {
                //If not trying to overwrite, then select all exports that have been changed
                changedExports = Exports.Where(export => export.hasChanged).ToList();
                //MessageBox.Show("No changed exports = " + changedExports.Count);
                //throw new NullReferenceException();
            }
            else
            {
                //If we are trying to overwrite, then split up the exports that have been changed that can and can't overwrite the originals
                changedExports = Exports.Where(export => export.hasChanged && export.Data.Length > export.DataSize).ToList();
                replaceExports = Exports.Where(export => export.hasChanged && export.Data.Length <= export.DataSize).ToList();
            }
            //ExportEntry lastExport = unchangedExports.Find(export => export.DataOffset == unchangedExports.Max(maxExport => maxExport.DataOffset));
            ExportEntry lastExport = Exports.Find(export => export.DataOffset == Exports.Max(maxExport => maxExport.DataOffset));
            int lastDataOffset = lastExport.DataOffset + lastExport.DataSize;
            byte[] oldPCC = new byte[lastDataOffset];
            //byte[] oldName;

            if (!attemptOverwrite)
            {
                int offset = ExportOffset;
                foreach (ExportEntry export in Exports)
                {
                    if (!export.hasChanged)
                    {
                        offset += export.info.Length;
                    }
                    else
                        break;
                }
                rtValues += offset.ToString() + " ";
                using (FileStream stream = new FileStream(loc + "\\exec\\infoCache.bin", FileMode.Append))
                {
                    stream.Seek(0, SeekOrigin.End);
                    rtValues += stream.Position + " ";
                    //throw new FileNotFoundException();
                    stream.Write(changedExports[0].info, 32, 8);
                }
            }

            using (FileStream oldPccStream = new FileStream(this.pccFileName, FileMode.Open))
            {
                //Read the original data up to the last export
                oldPccStream.Read(oldPCC, 0, lastDataOffset);
                #region Unused code
                /* Maybe implement this if I want to directly copy the names across.
                 * Not useful at this time
                if (NameOffset == 0x8E)
                {
                    oldName = new byte[ImportOffset - 0x8E];
                    oldPccStream.Seek(0x8E, SeekOrigin.Begin);
                    oldPccStream.Read(oldName, 0, (int)oldPccStream.Length - lastDataOffset);
                }
                else
                {
                    oldName = new byte[oldPccStream.Length - lastDataOffset];
                    oldPccStream.Seek(lastDataOffset, SeekOrigin.Begin);
                    oldPccStream.Read(oldName, 0, (int)oldPccStream.Length - lastDataOffset);
                }
                 * */
                #endregion
            }
            //Start writing the new file
            using (FileStream newPCCStream = new FileStream(newFileName, FileMode.Create))
            {
                newPCCStream.Seek(0, SeekOrigin.Begin);
                //Write the original file up til the last original export (note that this leaves in all the original exports)
                newPCCStream.Write(oldPCC, 0, lastDataOffset);
                if (!attemptOverwrite)
                {
                    //If we're not trying to overwrite then just append all the changed exports
                    foreach (ExportEntry export in changedExports)
                    {
                        export.DataOffset = (int)newPCCStream.Position;
                        export.DataSize = export.Data.Length;
                        newPCCStream.Write(export.Data, 0, export.Data.Length);
                    }
                }
                else
                {
                    //If we are then move to each offset and overwrite the data with the new exports
                    foreach (ExportEntry export in replaceExports)
                    {
                        //newPCCStream.Position = export.DataOffset;
                        newPCCStream.Seek(export.DataOffset, SeekOrigin.Begin);
                        export.DataSize = export.Data.Length;
                        newPCCStream.Write(export.Data, 0, export.Data.Length);
                    }
                    //Then move to the end and append the new data
                    //newPCCStream.Position = lastDataOffset;
                    newPCCStream.Seek(lastDataOffset, SeekOrigin.Begin);

                    foreach (ExportEntry export in changedExports)
                    {
                        export.DataOffset = (int)newPCCStream.Position;
                        export.DataSize = export.Data.Length;
                        newPCCStream.Write(export.Data, 0, export.Data.Length);
                    }
                }
                //Set the new nameoffset and namecounts
                NameOffset = (int)newPCCStream.Position;
                NameCount = Names.Count;
                //Then write out the namelist
                foreach (string name in Names)
                {
                    newPCCStream.WriteValueS32(-(name.Length + 1));
                    newPCCStream.WriteString(name + "\0", (uint)(name.Length + 1) * 2, Encoding.Unicode);
                }
                //Move to the name info position in the header - not a strong piece of code, but it's working so far
                //newPCCStream.Position = 34;
                newPCCStream.Seek(HeadeNameOffset, SeekOrigin.Begin);
                //And write the new info
                byte[] nameHeader = new byte[8];
                byte[] nameCount = BitConverter.GetBytes(NameCount);
                byte[] nameOff = BitConverter.GetBytes(NameOffset);
                for (int i = 0; i < 4; i++)
                    nameHeader[i] = nameCount[i];
                for (int i = 0; i < 4; i++)
                    nameHeader[i + 4] = nameOff[i];
                newPCCStream.Write(nameHeader, 0, 8);

                //Finally, update the export list
                newPCCStream.Seek(ExportOffset, SeekOrigin.Begin);
                foreach (ExportEntry export in Exports)
                {
                    newPCCStream.Write(export.info, 0, export.info.Length);
                }

                if (!attemptOverwrite)
                {
                    using (FileStream stream = new FileStream(loc + "\\exec\\infoCache.bin", FileMode.Append))
                    {
                        stream.Seek(0, SeekOrigin.End);
                        rtValues += stream.Position + " ";
                        stream.Write(changedExports[0].info, 32, 8);
                    }
                }
            }
            return rtValues;
        }
Example #13
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text = "验证版本...";
            timer1.Enabled = false;
            bool b1 = HttpClass.DownloadFile(VersionFileUrl, VersionFileLocal, progressBar1);
            if (b1)
            {

                Text = string.Format("{0}/{1}", MainAppBuildVersion, UpdateAppBuildVersion);
                if (UpdateAppBuildVersion > MainAppBuildVersion)
                {
                    Form2 f2 = new Form2();
                    f2.edit1.Text = WhatsNew;
                    if (f2.ShowDialog() == DialogResult.OK)
                    {
                        label1.Text = "下载文件...";
                        progressBar1.Value = 1;
                        Task downloadtask1 = new Task(new Action(DownloadFileProc));
                        downloadtask1.Start();
                    }
                    else
                    {
                        label1.Text = "用户取消了操作";
                        progressBar1.Value = 0;
                    }
                }
                else
                {
                    label1.Text = "服务器上没有最新的版本";
                }
            }
            else
            {
                label1.Text = ("版本验证失败");
                label1.ForeColor = Color.Red;
                progressBar1.Value = 0;
            }
        }
Example #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            string inputfile = openFileDialog1.FileName;
            DateTime created = dateTimePicker1.Value;
            DateTime createdtime = dateTimePicker2.Value;
            string titel = textBox1.Text;
            Mp3File mp3 = listBox1.SelectedItem as Mp3File;
            CategoryObj c = comboBox1.SelectedItem as CategoryObj;

            if (!string.IsNullOrEmpty(openFileDialog1.FileName) && System.IO.File.Exists(openFileDialog1.FileName))
            {
                Thread t = new Thread(new ThreadStart(delegate()
                    {
                        try
                        {
                            SetProgress(0);
                            mp3 = _proxy.UploadNewFile(inputfile, created, titel, c);
                            SetProgress(50);
                            _proxy.NewPost(titel, c.ToString(), mp3.url, mp3.size, new DateTime(created.Year, created.Month, created.Day, createdtime.Hour, createdtime.Minute, createdtime.Second));
                        }
                        catch (Exception exc)
                        {
                            CloseBezig(exc);
                        }
                        SetProgress(100);
                        CloseBezig();
                    }));
                t.Start();
            }
            else if (mp3 != null && c != null)
            {
                Thread t = new Thread(new ThreadStart(delegate()
                {
                    try
                    {
                        _proxy.NewPost(titel, c.ToString(), mp3.url, mp3.size, new DateTime(created.Year, created.Month, created.Day, createdtime.Hour, createdtime.Minute, createdtime.Second));
                    }
                    catch (Exception exc)
                    {
                        CloseBezig(exc);
                    }
                    CloseBezig();
                }));
                t.Start();
            }

            _bezigForm = new Form2();
            _bezigForm.ShowDialog(this);
        }
Example #15
0
File: Form1.cs Project: jjaimez/DA1
 private void cliente_Click(object sender, EventArgs e)
 {
     gestionCliente = new Form2();
        gestionCliente.BringToFront();
        gestionCliente.Visible = true;
 }
Example #16
0
        public void CreateDefaultLang()
        {
            Language l = new Language();
            Form1 f1 = new Form1();
            Form2 f2 = new Form2();
            DLCExplorer dlc = new DLCExplorer();
            TOCeditor toc = new TOCeditor();
            Conditionals con = new Conditionals();
            Language_Selector lng = new Language_Selector();
            AFCExtract afc = new AFCExtract();
            BIKExtract bik = new BIKExtract();
            PropertyManager prop = new PropertyManager();
            XBoxConverter xbox = new XBoxConverter();
            Language_Editor lne = new Language_Editor();
            string[] t = new string[0];
            MainWindow tlk = new MainWindow();
            l.name = "Default";
            l.Entries = new List<string>();
#region Form1
            l.Entries.Add(f1.userToolsToolStripMenuItem.Text);                  //0
            l.Entries.Add(f1.dLCEditorToolStripMenuItem.Text);
            l.Entries.Add(f1.tLKEditorToolStripMenuItem.Text);

            l.Entries.Add(f1.tOCbinEditorToolStripMenuItem.Text);           //5
            l.Entries.Add(f1.decompressorToolStripMenuItem.Text);
            l.Entries.Add(f1.conditionalsToolStripMenuItem.Text);
            l.Entries.Add(f1.lanugageSelectorToolStripMenuItem.Text);
            //l.Entries.Add("Extractor");  // KFreon: Not sure what all this is for exactly, so just filling in bits

            l.Entries.Add(f1.aFCToWAVToolStripMenuItem.Text);                    //10
            l.Entries.Add(f1.moviestfcToBIKToolStripMenuItem.Text);
            l.Entries.Add(f1.propertyManagerToolStripMenuItem.Text);
            //l.Entries.Add(f1.xBoxConverterToolStripMenuItem.Text);
            l.Entries.Add(f1.optionsToolStripMenuItem.Text);

            l.Entries.Add(f1.selectToolLanguageToolStripMenuItem.Text);     //15
#endregion
#region Form2
            l.Entries.Add(f2.Text);
            l.Entries.Add(f2.fileOpenToolStripMenuItem.Text);
#endregion
#region DLC Explorer
            l.Entries.Add(dlc.Text);                                        //60
            l.Entries.Add(dlc.groupBoxSfar.Text);
            l.Entries.Add(dlc.labelNumOfFiles.Text);
            l.Entries.Add(dlc.labelTotalUncSize.Text);
            l.Entries.Add(dlc.labelTotalUncBytes.Text);

            l.Entries.Add(dlc.labelTotalComprSize.Text);                    //65
            l.Entries.Add(dlc.labelTotalComprBytes.Text);
            l.Entries.Add(dlc.labelComprRatio.Text);
            l.Entries.Add(dlc.labelFirstEntryOffset.Text);
            l.Entries.Add(dlc.labelFirstBlockOffset.Text);

            l.Entries.Add(dlc.labelFirstDataOffset.Text);                   //70
            l.Entries.Add(dlc.groupBoxFile.Text);
            l.Entries.Add(dlc.labelFullName.Text);
            l.Entries.Add(dlc.labelHash.Text);
            l.Entries.Add(dlc.labelFileSize.Text);

            l.Entries.Add(dlc.labelUncSizeBytes.Text);                      //75
            l.Entries.Add(dlc.labelComprSize.Text);
            l.Entries.Add(dlc.labelComprSizeBytes.Text);
            l.Entries.Add(dlc.labelEntry.Text);
            l.Entries.Add(dlc.labelBlockIndex.Text);

            l.Entries.Add(dlc.labelDataOffset.Text);                        //80
            l.Entries.Add(dlc.toolStripOpenFile.Text);
            l.Entries.Add(dlc.toolStripSaveFile.Text);
            l.Entries.Add(dlc.toolStripInfo.Text);
            l.Entries.Add(dlc.toolStripAbout.Text);
#endregion
#region TOC Editor
            l.Entries.Add(toc.Text);                                        //85
            l.Entries.Add(toc.fileToolStripMenuItem.Text);
            l.Entries.Add(toc.openToolStripMenuItem.Text);
            l.Entries.Add(toc.saveToolStripMenuItem.Text);
            l.Entries.Add(toc.searchToolStripMenuItem.Text);

            l.Entries.Add(toc.searchAgainToolStripMenuItem.Text);           //90
            l.Entries.Add(toc.editFilesizeToolStripMenuItem.Text);
#endregion
#region Conditionals
            l.Entries.Add(con.Text);
            l.Entries.Add(con.fileToolStripMenuItem.Text);
            l.Entries.Add(con.openToolStripMenuItem.Text);

            l.Entries.Add(con.saveToolStripMenuItem.Text);                  //95
            l.Entries.Add(con.mapToSVGToolStripMenuItem.Text);
            l.Entries.Add(con.editToolStripMenuItem.Text);
#endregion
#region Language Select
            l.Entries.Add(lng.Text);
            l.Entries.Add(lng.radioButton1.Text);

            l.Entries.Add(lng.radioButton2.Text);                           //100
            l.Entries.Add(lng.radioButton3.Text);
            l.Entries.Add(lng.radioButton4.Text);
            l.Entries.Add(lng.radioButton5.Text);
            l.Entries.Add(lng.radioButton6.Text);

            l.Entries.Add(lng.button1.Text);                                //105
            l.Entries.Add(lng.button2.Text);
#endregion
#region AFC
            l.Entries.Add(afc.Text);
            l.Entries.Add(afc.fileToolStripMenuItem.Text);
            l.Entries.Add(afc.openToolStripMenuItem.Text);

            l.Entries.Add(afc.extractToolStripMenuItem.Text);               //110
            l.Entries.Add(afc.selectedToolStripMenuItem.Text);
            l.Entries.Add(afc.allToolStripMenuItem.Text);
#endregion
#region BIK
            l.Entries.Add(bik.Text);
            l.Entries.Add(bik.fileToolStripMenuItem.Text);

            l.Entries.Add(bik.openToolStripMenuItem.Text);                  //115
            l.Entries.Add(bik.extractToolStripMenuItem.Text);
            l.Entries.Add(bik.selectedToolStripMenuItem.Text);
            l.Entries.Add(bik.allToolStripMenuItem.Text);
#endregion
#region PropertyMan
            l.Entries.Add(prop.Text);

            l.Entries.Add(prop.fileToolStripMenuItem.Text);                 //120
            l.Entries.Add(prop.newToolStripMenuItem.Text);
            l.Entries.Add(prop.loadDefinitonsToolStripMenuItem.Text);
            l.Entries.Add(prop.saveDefinitionsToolStripMenuItem.Text);
            l.Entries.Add(prop.loadDefaultToolStripMenuItem.Text);

            l.Entries.Add(prop.saveAsDefaultToolStripMenuItem.Text);        //125
            l.Entries.Add(prop.importFromFileToolStripMenuItem.Text);
            l.Entries.Add(prop.actionToolStripMenuItem.Text);
            l.Entries.Add(prop.addClassToolStripMenuItem.Text);
            l.Entries.Add(prop.addPropertyToolStripMenuItem.Text);

            l.Entries.Add(prop.deleteClassToolStripMenuItem.Text);          //130
            l.Entries.Add(prop.deletePropertyToolStripMenuItem.Text);
#endregion
#region xboxconverter
            l.Entries.Add(xbox.Text);
            l.Entries.Add(xbox.fileToolStripMenuItem.Text);
            l.Entries.Add(xbox.xXXPCCToolStripMenuItem.Text);

            l.Entries.Add(xbox.pCCXXXToolStripMenuItem.Text);               //135
#endregion
#region Language Editor
            l.Entries.Add(lne.Text);
            l.Entries.Add(lne.fileToolStripMenuItem.Text);
            l.Entries.Add(lne.saveToolStripMenuItem.Text);
            l.Entries.Add(lne.editToolStripMenuItem.Text);

            l.Entries.Add(lne.copyLanguagToolStripMenuItem.Text);           //140
            l.Entries.Add(lne.deleteLanguageToolStripMenuItem.Text);
            l.Entries.Add(lne.renameLanguageToolStripMenuItem.Text);
            l.Entries.Add(lne.editEntryToolStripMenuItem.Text);
            l.Entries.Add(lne.setLanguageAsDefaultToolStripMenuItem.Text);
#endregion
            GlobalLang.Add(l);
        }
Example #17
0
 public void SetLang(Form2 f2)
 {
     f2.Text = GlobalLang[CurrentLanguage].Entries[16];
     f2.fileOpenToolStripMenuItem.Text = GlobalLang[CurrentLanguage].Entries[17];
 }
Example #18
0
        public static void runSearchProcess()
        {
            userDefinedGoals udg = new userDefinedGoals();
            Form2 inputBox = new Form2(udg);
            //inputBox.ShowDialog();

            ruleSet.loadAndCompileSourceFiles(rulesets, Program.settings.recompileRules, Program.settings.compiledparamRules, Program.settings.execDir);

            List<candidate> candidates = new List<candidate>();
            candidate current = null;
            candidate seedCandidate = new candidate(seed, Program.settings.numOfRuleSets);
            Boolean found = false;
            candidates.Add(seedCandidate);
            GearEvaluator ge = new GearEvaluator(udg);
            Guidance.PNormProportionalPopulationSelection GuidanceApproach
                = new Guidance.PNormProportionalPopulationSelection(0, Guidance.optimize.minimize, true, true, 1);
            int maxPop = 10000;
            while (!found && (candidates.Count != 0))
            {
                current = candidates[0];
                candidates.RemoveAt(0);
                SearchIO.iteration = current.recipe.Count;
                //RECOGNIZE
                List<option> ruleChoices = rulesets[0].recognize(current.graph);
                SearchIO.miscObject = candidates.Count;
                //
                if (current.recipe.Count >= 2)
                {
                    found = isCurrentTheGoal(current, udg);
                    if (found == true)
                    {
                        ge.evalGT(current);
                        break;
                    }
                }
                //else current.f0 = double.PositiveInfinity;

                for (int i = 0; i != ruleChoices.Count; i++)
                {
                    candidate child = current.copy();

                    ruleChoices = rulesets[0].recognize(child.graph);
                    ruleChoices[i].apply(child.graph, null);

                    child.addToRecipe(ruleChoices[i]);
                    child.f0 = double.NaN;
                    child.f1 = double.NaN;
                    child.f2 = double.NaN;
                    ge.evalGT(child);
                    child.f3 = (child.f0)/100 + child.f1;
                    //1 efficiency
                    //2 mass
                    //3 combination
                    addChildToSortedCandList(candidates, child, 3);
                    //candidates.Add(child);
                }

            }
            Program.addAndShowGraphDisplay(current.graph, "Here is your gear train!!!");
            candidate.saveToXml(current, "testTuned", settings.outputDirectory);
        }
Example #19
0
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView3.SelectedItems.Count == 1)
     {
         Form2 Fm = new Form2();
         Fm.NName = (listView3.SelectedItems[0].Tag as TFunc).FName;
         if (Fm.ShowDialog() == DialogResult.OK)
             MyGNIDA.RenameFunction((listView3.SelectedItems[0].Tag as TFunc), Fm.NName);
     };
 }
Example #20
0
        private void button3_Click(object sender, EventArgs e)
        {
            //form2.Location = new Point(this.Location.X+100,this.Location.Y+150);
            // zhj.修改输入路径判空条件
            if (inPath.Length == 0)
            {
                MessageBox.Show("Please select a DEM file");
                return;
            }
            /*if (inPath == null)
            {
                MessageBox.Show("Please select a DEM file");
                return;
            }*/

            if (outPath == null)
            {
                MessageBox.Show("Output path can not be empty!");
                return;
            }

            if (radioButton_nodata_repair_no.Checked)
            {
                xiufu = false;//修复无值栅格
            }

            //if (radioButton1.Checked)
            //{
            //    guodu = true;
            //}//2010.01.05修改,以前没有else语句,存在问题
            //else
            //{
            //    guodu = false;
            //}
            if (radioButton_fill_min.Checked)
            {
                fillWay = false;
            }
            //2010.6.8改,无须选择单位了
            //if (radioButton_mul_dir.Checked)
            //{
            //    unit = false;
            //}
            //if (radioButton7.Checked)
            //{
            //    unit = true;
            //}
            if (radioButton_channel_no.Checked)
            {
                //CumulatWay = false;
                Channel_Consider = false;
                threshold = 0;
            }
            else
            {
                //CumulatWay = true;
                Channel_Consider = true;
                threshold = Convert.ToSingle(textBox_threshold.Text);//2011.04.20目前只有D8和MS多流向的方法中涉及到了河网的问题
            }
            if (radioButton_cutoff_no.Checked)
            {
                flowcut = false;
            }
            else
            {
                flowcut = true;
            }
            if (radioButton_sinkfill_no.Checked)
            {
                fillsink = false;
            }
            else
            {
                fillsink = true;
            }
            if (radioButton_Cumulated_Max.Checked)
            {
                CumulatWay = true;
            }
            else
            {
                CumulatWay = false;
            }
            if (radioButton_model_CSLE.Checked)
            {
                RUSLE_CSLE = 1;//CSLE
            }
            else
            {
                RUSLE_CSLE = 0;//RUSLE
            }
            button_start.Enabled = false;
            qianzhui = textBox_profix.Text;
            xiaoyu5 = float.Parse(textBox_cutoff_slopeless.Text);
            dayu5 = float.Parse(textBox_cutoff_slopegreat.Text);

            form2 = new Form2();
            form2.progressTextBox.Text = "OK";
            // zhj.开始计算
            for (int fileCount = 0; fileCount < inPath.Length; ++fileCount)
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();

                string form2Title = "正在计算 Calculating:  "
                    + (fileCount) + "/" + inPath.Length + " missions are completed";
                form2.Text = form2Title;
                //form2.progressTextBox
                form2.progressBar.Value = 0;
                form2.progressBar.Maximum = 28;
                form2.progressTextBox.Update();
                form2.Owner = this;
                //form2.StartPosition = this.StartPosition;
                form2.StartPosition = FormStartPosition.CenterScreen;
                form2.Show();
                //2010.06.06添加单流向及多流向的选择
                //string tempOutPath = outPath;
                //string tempQianZhui = "";
                string tempOutPath = outPath;
                string tempQianZhui = outDir[fileCount];
                try
                {
                    //tempOutPath += ("\\" + outDir[fileCount]);
                    //tempOutPath += DateTime.Now.ToString(" yyyy_MM_dd HH_mm_ss");
                    //Directory.CreateDirectory(tempOutPath);
                    if (radioButton_flowdir_mul.Checked)
                    {
                        if (radioButton_Mul_MS.Checked)
                        {
                            LS_MultDir_MSClass lsClass = new LS_MultDir_MSClass();
                            //lsClass.LSBegin(inPath, outPath, qianzhui, xiufu, xiaoyu5, dayu5, unit, fillWay, flowcut, fillsink, threshold, ExportAll, MyCheckBox, this);
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, flowcut, fillsink, threshold, CumulatWay, RUSLE_CSLE, Channel_Consider, ExportAll, MyCheckBox, this);
                            lsClass = null;
                        }
                        else if (radioButton_Mul_FMFD.Checked)
                        {
                            LS_MultDir_FMFDClass lsClass = new LS_MultDir_FMFDClass();
                            // 显示一个窗口
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, flowcut, fillsink, ExportAll, MyCheckBox, float.Parse(textBox_slope_exp.Text), this);
                            lsClass = null;
                        }
                        else if (radioButton_Mul_DEMON.Checked)
                        {
                            LS_MultDir_DEMONClass lsClass = new LS_MultDir_DEMONClass();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, CumulatWay, ExportAll, MyCheckBox, this);
                            lsClass = null;

                        }
                        else
                        {
                            LS_MultDir_PilesjClass lsClass = new LS_MultDir_PilesjClass();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, CumulatWay, ExportAll, MyCheckBox, this);
                            lsClass = null;
                        }

                    }
                    else
                    {
                        if (radioButton_Sgn_D8.Checked)
                        {
                            LS_SingleDir_D8Class lsClass = new LS_SingleDir_D8Class();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, flowcut, fillsink, threshold, CumulatWay, RUSLE_CSLE, Channel_Consider, ExportAll, MyCheckBox, this);
                            //导入路径、输出路径、前缀、是否修复、小于5%、大于5%、单位、填充方式、是否截断、是否进行洼地填充、阈值、是否考虑河网、哪一个模型、是否所有都输出、输出的复选框选择
                            lsClass = null;
                        }
                        else if (radioButton_Sgn_Rho4.Checked)
                        {
                            LS_SingleDir_Rho4Class lsClass = new LS_SingleDir_Rho4Class();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, CumulatWay, ExportAll, MyCheckBox, this);
                            lsClass = null;
                        }
                        else if (radioButton_Sgn_Rho8.Checked)
                        {
                            LS_SingleDir_Rho8Class lsClass = new LS_SingleDir_Rho8Class();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, CumulatWay, ExportAll, MyCheckBox, this);
                            lsClass = null;

                        }
                        else if (radioButton_Sgn_Rho.Checked)
                        {
                            LS_SingleDir_RhoClass lsClass = new LS_SingleDir_RhoClass();
                            lsClass.LSBegin(inPath[fileCount], tempOutPath, tempQianZhui, xiufu, xiaoyu5, dayu5, unit, fillWay, CumulatWay, ExportAll, MyCheckBox, this);
                            lsClass = null;

                        }//以上是单流向,以下是多流向

                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("物理内存空间不足,无法完成计算!" + ex.ToString(), "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    form2.Close();
                    form2.Dispose();
                }
            }
            form2.Text = "全部文件计算完成(All missions are completed)";
            form2.button_form2_ok.Visible = true;
            //form2.Dispose();
            button_start.Enabled = false;
            textBox_outputpath.Text = "";
            textBox_inputpath.Text = "";
            // 清空路径数组
            inPath = null;
            outPath = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();
        }
Example #21
0
        public Form1()
        {
            //System.Collections.Generic.List<int> f = new List<int>(3);

            f2 = new Form2(this);
            InitializeComponent();
            dbw = new DBWork(this);
            dbw.SetPenaltyAll();
            dbw.DeleteExceededOrders();
            //ReaderRecord = new DBWork.dbReader("9643907728022200024 " + "07020077");
            //sc = new _BarcScan(this);
            //this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
            //this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.label16 = new System.Windows.Forms.Label();
            //this.Controls.Add(RndPrg);
            //
            // label16
            //
            this.Controls.Add(this.label16);
            f2.ShowDialog();

            /*if (EmpID == null)
            {
                MessageBox.Show("�� �� ������������! ��������� ��������� ���� ������.", "������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }*/
            Form1.Scanned += new ScannedEventHandler(Form1_Scanned);
            Form1.AbonChanged += new AbonChangedEventHandler(Form1_AbonChanged);
            //dataGridView1.Rows.RemoveAt(0);// .Remove(dataGridView1.Rows[0].);
            //ReaderRecord = new DBWork.dbReader();
            //BookRecord = new DBWork.dbBook();
            this.button2.Enabled = false;
            this.button4.Enabled = false;
            label4.Text = "������ ������� " + DateTime.Now.ToShortDateString() + ":";
            //this.Controls.Add(this.panel1);
            //this.tabPage3.Controls.Remove(this.panel1);
            //MessageBox.Show(tabControl1.SelectedTab.ToString());// = tabControl1.TabPages[1];
            this.label16.AutoSize = true;
            this.label16.BringToFront();
            this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.label16.Location = new System.Drawing.Point(328, 458);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(355, 39);
            this.label16.TabIndex = 0;
            this.label16.Text = "�������� ��������";
            this.label16.Visible = false;
            this.label16.ForeColor = Color.Green;
            Formular.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            Formular.Columns.Clear();

            port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
            port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
            port.Handshake = Handshake.RequestToSend;
            port.NewLine = Convert.ToChar(13).ToString();

            try
            {
                port.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void button3_Click(object sender, EventArgs e)
 {
     base.Hide();
     Form2 frm = new Form2();
     frm.Show();
 }
Example #23
0
 private void назадToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form2 frm = new Form2();
     frm.Show();
     base.Hide();
 }
Example #24
0
 private void sucheToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Form2 form2 = new Form2(this);
     form2.Show();
 }
Example #25
0
        // заполнение массива и отображение крестиков, ноликов
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            int row = (int)(e.Y / H);
            int col = (int)(e.X / W);

            if (Pole[row,col] == 0)
            {
                this.field(g, row, col, what);

                if (what == 1)
                {
                    Pole[row, col] = 2;
                    what = 2;
                    if (if_win())
                    {
                        label1.Text = "Вы победили";
                        Form2 f2 = new Form2();
                        f2.ShowDialog();
                        if (DialogResult.OK == f2.DialogResult)
                        {
                            Show_game(g, 0);
                        }
                        else Close();
                    }
                    else label1.Text = "Ход соперника";
                }
                else
                {
                    Pole[row, col] = 5;
                    what = 1;
                    if (if_win())
                    {
                        label1.Text = "Соперник победил";
                        Form2 f2 = new Form2();
                        f2.ShowDialog();
                        if (DialogResult.OK == f2.DialogResult)
                        {
                            Show_game(g, 0);
                        }
                        else Close();

                    }
                    else label1.Text = "Ваш ход";
                }
            }
        }