///<summary></summary> public static void SendData(Program ProgramCur,Patient pat) { _path=Programs.GetProgramPath(Programs.GetCur(ProgramName.DemandForce)); if(!File.Exists(_path)) { MessageBox.Show(_path+" could not be found."); return; } if(MessageBox.Show(Lan.g("DemandForce","This may take 20 minutes or longer")+". "+Lan.g("DemandForce","Continue")+"?","",MessageBoxButtons.OKCancel)!=DialogResult.OK) { return; } _formProg=new FormProgress(); _formProg.MaxVal=100; _formProg.NumberMultiplication=1; _formProg.DisplayText=""; _formProg.NumberFormat="F";//Show whole percentages, not fractional percentages. Thread workerThread=new Thread(new ThreadStart(InstanceBridgeExport)); workerThread.Start(); if(_formProg.ShowDialog()==DialogResult.Cancel) { workerThread.Abort(); MessageBox.Show(Lan.g("DemandForce","Export cancelled")+". "+Lan.g("DemandForce","Partially created file has been deleted")+"."); CheckCreatedFile(CodeBase.ODFileUtils.CombinePaths(Path.GetDirectoryName(_path),"extract.xml")); _formProg.Dispose(); return; } MessageBox.Show(Lan.g("DemandForce","Export complete")+". "+Lan.g("DemandForce","Press OK to launch DemandForce")+"."); try { Process.Start(_path);//We might have to add extract.xml to launch command in the future. } catch { MessageBox.Show(_path+" is not available."); } _formProg.Dispose(); }
private void BeginCodeGeneration(GMacCodeLibraryComposer libGen) { var formProgress = new FormProgress(libGen.Progress, libGen.Generate, null); formProgress.ShowDialog(this); var formFiles = new FormFilesComposer(libGen.CodeFilesComposer); formFiles.ShowDialog(this); }
private bool ImportFiles(string[] data, bool refreshList, Dictionary <string, Guid> providers) { IRasterClass rc = _exObject.Object as IRasterClass; if (rc == null) { return(false); } IRasterDataset rDS = rc.Dataset as IRasterDataset; if (rDS == null || rDS.Database == null) { return(false); } Thread thread = new Thread(new ParameterizedThreadStart(Import)); FDBImageDataset operations = new FDBImageDataset(rDS.Database as IImageDB, rDS.DatasetName); // refreshList = false wenn ganzen Verzeichnis durchsucht wird... // dann sollen auch keine Fehler verursacht werden wenn ein bild nicht gereferenziert ist, // in diesem fall bild einfach ignorieren operations.handleNonGeorefAsError = refreshList; ImageImportProgressReporter reporter = new ImageImportProgressReporter(operations, data.Length); ImportArguments args = new ImportArguments(operations, rDS, data, providers); FormProgress progress = new FormProgress(reporter, thread, args); progress.Text = "Import Images: " + rDS.DatasetName; progress.Mode = ProgressMode.ProgressDisk; progress.ShowDialog(); if (refreshList) { RefreshList(); } if (!reporter.CancelTracker.Continue) { MessageBox.Show("Cancel..."); return(false); } if (operations.lastErrorMessage != String.Empty) { MessageBox.Show("ERROR: " + operations.lastErrorMessage); return(false); } rDS.RefreshClasses(); return(true); }
/// <summary> /// Refresh the disk selection by (re-)enumerating the available disks of the system. /// </summary> private void RefreshPage() { // store the currently selected physical drive (if any) Device selectedDisk = SelectedDisk; // clear the physical drives already enumerated in the list-view lsvPhysicalDrives.Items.Clear(); // enumerating the physical drives can take quite a time if a harddisk has to spin up: use progress dialog FormProgress dlg = new FormProgress(); dlg.DoWork += backgroundWorker_DoWork; dlg.ShowDialog(this); // the physical drives have been enumerated foreach (PhysicalDrive.DriveInfo drive in drives) { ListViewItem item = new ListViewItem(string.Format("{0} {1}", PageContext.GetInstance().GetResourceString("Disk"), drive.DriveNumber)); item.Tag = new Device(drive); string type; switch (drive.PartitionStyle) { case PhysicalDrive.PARTITION_STYLE.PARTITION_STYLE_MBR: type = "MBR"; break; case PhysicalDrive.PARTITION_STYLE.PARTITION_STYLE_GPT: type = "GPT"; break; default: type = "RAW"; break; } item.SubItems.Add(type); item.SubItems.Add(PhysicalDrive.GetAsBestFitSizeUnit(drive.Size)); item.SubItems.Add((drive.Size / drive.Geometry.BytesPerSector).ToString()); item.SubItems.Add(string.Format("{0}/{1}/{2}", drive.Geometry.Cylinders, drive.Geometry.TracksPerCylinder, drive.Geometry.SectorsPerTrack)); lsvPhysicalDrives.Items.Add(item); // re-select the previously selected physical drive if it still exists if ((selectedDisk != null) && (drive.DriveNumber == selectedDisk.Drive.DriveNumber)) { item.Focused = true; item.Selected = true; } } // the ready state of the wizard page might have changed lsvPhysicalDrives_SelectedIndexChanged(this, new EventArgs()); }
/// <summary> /// Given GMacDSL code this factory class compiles the code into a GMacAST structure and /// use the blades code library composer for C# to compose target C# code /// </summary> /// <param name="dslCode"></param> /// <param name="outputFolder"></param> /// <param name="generateMacros"></param> /// <param name="targetLanguageName"></param> /// <returns></returns> public static FilesComposer ComposeLibrary(string dslCode, string outputFolder, bool generateMacros, string targetLanguageName) { //Clear the progress log composer GMacSystemUtils.ResetProgress(); //Compile GMacDSL code into a GMacAST structure var ast = BeginCompilation(dslCode); //If compilation fails return nothing if (ReferenceEquals(ast, null)) { return(null); } //Create and initialize code library composer for C# GMacCodeLibraryComposer activeGenerator; //Select the composer based on the target language name switch (targetLanguageName) { case "C#": activeGenerator = new BladesLibrary(ast); break; default: activeGenerator = new BladesLibrary(ast); break; } //Set the output folder for generated files activeGenerator.CodeFilesComposer.RootFolder = outputFolder; //Select option for generating macros code, this takes the longest time //in the composition process and may be skipped initially while designing //structure of composed library activeGenerator.MacroGenDefaults.AllowGenerateMacroCode = generateMacros; //Specify GMacAST frames to be used for code compositions activeGenerator.SelectedSymbols.SetSymbols(ast.Frames); //Start code composition process and display its progress var formProgress = new FormProgress(activeGenerator.Progress, activeGenerator.Generate, null); formProgress.ShowDialog(); //Save all generated files //activeGenerator.CodeFilesComposer.SaveToFolder(); //Return generated folders\files as a FilesComposer object return(activeGenerator.CodeFilesComposer); }
private void btnPreRender_Click(object sender, EventArgs e) { _preRenderScales.Clear(); foreach (ListViewItem item in lstScales.Items) { if (item.Checked) { _preRenderScales.Add(double.Parse(item.Text.Replace(",", "."), _nhi)); } } _maxParallelRequests = (int)numMaxParallelRequest.Value; switch (cmbImageFormat.SelectedItem.ToString().ToLower()) { case "image/png": _imgExt = ".png"; break; case "image/jpeg": _imgExt = ".jpg"; break; } switch (cmbOrigin.SelectedItem.ToString().ToLower()) { case "upper left": _orientation = GridOrientation.UpperLeft; break; case "lower left": _orientation = GridOrientation.LowerLeft; break; } _selectedEpsg = (int)cmbEpsg.SelectedItem; if (chkUseExtent.Checked == true) { _bounds = this.CurrentExtent; } else { _bounds = null; } _cacheFormat = cmbCacheFormat.SelectedItem.ToString().ToLower(); Thread thread = new Thread(new ThreadStart(this.Run)); FormProgress dlg = new FormProgress(this, thread); dlg.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { if (Directory.Exists(SaveDir) == false) { return; } button1.Enabled = false; int cout = Convert.ToInt32(this.nmbud.Value); this.fpro.progressBar1.Minimum = 0; this.fpro.progressBar1.Maximum = cout; this.fpro.progressBar1.Value = this.fpro.progressBar1.Minimum; this.backgroundWorker1.RunWorkerAsync(cout); // 在开始异步操作后ShowDialog // 这样即使代码停在那里也不会影响后台任务的执行 fpro.ShowDialog(this); }
private AstRoot BeginCompilation(string dslCode) { //GMacSystemUtils.InitializeGMac(); //Compile GMacDSL code into GMacAST var compiler = GMacProjectCompiler.CompileDslCode(dslCode, Application.LocalUserAppDataPath, "tempTask"); compiler.Progress.DisableAfterNextReport = true; if (compiler.Progress.History.HasErrorsOrFailures) { var formProgress = new FormProgress(compiler.Progress, null, null); formProgress.ShowDialog(this); return(null); } return(compiler.Root); }
private void btnRun_Click(object sender, EventArgs e) { try { var appConfig = AppConfigManager.Load(); var directoryDestiny = string.IsNullOrEmpty(appConfig.DefaultDirectorySaveFiles) ? GetDirectoryApp() : appConfig.DefaultDirectorySaveFiles; foreach (var file in _listFiles) { if (file.HeaderLength <= 0) { file.HeaderLength = appConfig.HeaderLength; } if (file.SeparatorCSV == null) { file.SeparatorCSV = appConfig.SeparadorCSV; } } var frmProgress = new FormProgress( _listFiles.ToArray(), directoryDestiny, appConfig.HeaderAction, appConfig.EndProcessAction); frmProgress.ShowDialog(); frmProgress.Dispose(); SetLastFile(); } catch (Exception ex) { MessageBox.Show( this, ex.Message, "Erro inesperado durante o processamento", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Compile given GMacDSL code into a GMacAST structure /// </summary> /// <param name="dslCode"></param> /// <returns></returns> private static AstRoot BeginCompilation(string dslCode) { //GMacSystemUtils.InitializeGMac(); //Compile GMacDSL code into GMacAST var compiler = GMacProjectCompiler.CompileDslCode(dslCode, Application.LocalUserAppDataPath, "tempTask"); //Reduce details of progress reporting during code composition compiler.Progress.DisableAfterNextReport = true; if (compiler.Progress.History.HasErrorsOrFailures) { //Compilation of GMacDSL code failed var formProgress = new FormProgress(compiler.Progress, null, null); formProgress.ShowDialog(); return(null); } //Compilation of GMacDSL code successful, return constructed GMacAST root return(compiler.Root); }
private void ReviewBoardCommand(object caller, EventArgs args) { // TODO:(pv) Preselect most of the changed files according to the items selected in the Solution Explorer. // See below "GetCurrentSelection()" code. // I am holding off doing this because it is a little complicated trying to figure out what the user intended to submit. // Does selecting a folder mean to also submit all files in that folder? // What if a few files/subfolders of that folder are also selected? // Should none of the other items be selected? // For now, just check *all* visible solution items for changes... IVsOutputWindowPane owp = GetOutputWindowPaneGeneral(); if (owp != null) { owp.Activate(); } if (!solutionTracker.BackgroundInitialSolutionCrawl.IsBusy) { // The initial solution crawl is finished. // Just show the submit form as usual... ShowFormSubmit(); } else { // The initial solution crawl is still in progress. // Display a cancelable modal dialog until the solution crawl is finished. string message = "Waiting for initial solution crawl to complete..."; FormProgress progress = new FormProgress(message, message, solutionTracker.BackgroundInitialSolutionCrawl); DialogResult result = progress.ShowDialog(); if (result == DialogResult.OK) { ShowFormSubmit(); } } }
///<summary></summary> public static void SendData(Program ProgramCur, Patient pat) { _path = Programs.GetProgramPath(Programs.GetCur(ProgramName.DemandForce)); if (!File.Exists(_path)) { MessageBox.Show(_path + " could not be found."); return; } if (MessageBox.Show(Lan.g("DemandForce", "This may take 20 minutes or longer") + ". " + Lan.g("DemandForce", "Continue") + "?", "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } _formProg = new FormProgress(); _formProg.MaxVal = 100; _formProg.NumberMultiplication = 1; _formProg.DisplayText = ""; _formProg.NumberFormat = "F"; //Show whole percentages, not fractional percentages. Thread workerThread = new Thread(new ThreadStart(InstanceBridgeExport)); workerThread.Start(); if (_formProg.ShowDialog() == DialogResult.Cancel) { workerThread.Abort(); MessageBox.Show(Lan.g("DemandForce", "Export cancelled") + ". " + Lan.g("DemandForce", "Partially created file has been deleted") + "."); CheckCreatedFile(CodeBase.ODFileUtils.CombinePaths(Path.GetDirectoryName(_path), "extract.xml")); _formProg.Dispose(); return; } MessageBox.Show(Lan.g("DemandForce", "Export complete") + ". " + Lan.g("DemandForce", "Press OK to launch DemandForce") + "."); try { ODFileUtils.ProcessStart(_path); //We might have to add extract.xml to launch command in the future. } catch { MessageBox.Show(_path + " is not available."); } _formProg.Dispose(); }
/// <summary> /// Refresh the disk selection by (re-)enumerating the available devices of the system. /// </summary> private void RefreshPage() { // store the currently selected device (if any) Device selectedDevice = SelectedDevice; // clear the devices already enumerated in the list-view lsvDevices.Items.Clear(); // enumerating the devices can take quite a time if a harddisk has to spin up: use progress dialog FormProgress dlg = new FormProgress(); dlg.DoWork += backgroundWorker_DoWork; dlg.ShowDialog(this); // the devices have been enumerated foreach (PhysicalDrive.DriveInfo drive in drives) { ListViewItem item = new ListViewItem(string.Format("{0} {1}:", PageContext.GetInstance().GetResourceString("Disk"), drive.DriveNumber)); item.Font = new Font(item.Font, FontStyle.Bold); item.Tag = new Device(drive); item.SubItems.Add(""); item.SubItems.Add(PhysicalDrive.GetAsBestFitSizeUnit(drive.Size)); item.SubItems.Add(""); lsvDevices.Items.Add(item); foreach (PhysicalDrive.PARTITION_INFORMATION_EX partition in drive.Partitions) { PhysicalDrive.VolumeInfo volumeInfo = null; foreach (PhysicalDrive.VolumeInfo volume in volumes) { if ((volume.DeviceInfo.DeviceNumber == drive.DriveNumber) && (volume.DeviceInfo.PartitionNumber == partition.PartitionNumber)) { volumeInfo = volume; break; } } item = new ListViewItem(string.Format(@"\Device\Harddisk{0}\Partition{1}", drive.DriveNumber, partition.PartitionNumber)); item.Tag = new Device(drive, partition.PartitionNumber); item.SubItems.Add((volumeInfo != null) ? volumeInfo.RootPath : string.Empty); item.SubItems.Add(PhysicalDrive.GetAsBestFitSizeUnit(partition.PartitionLength)); item.SubItems.Add((volumeInfo != null) ? volumeInfo.Label : string.Empty); lsvDevices.Items.Add(item); // re-select the previously selected device if it still exists if ((selectedDevice != null) && selectedDevice.Partition.HasValue && (drive.DriveNumber == selectedDevice.Drive.DriveNumber) && (partition.PartitionNumber == selectedDevice.Partition.Value)) { item.Focused = true; item.Selected = true; } } } // the ready state of the wizard page might have changed lsvPhysicalDrives_SelectedIndexChanged(this, new EventArgs()); }
private void menuItemView_Progress_Click(object sender, EventArgs e) { var formProgress = new FormProgress(_gmacScript.Progress); formProgress.ShowDialog(this); }