public frmProcesses(List<FileInfo> files, List<Process> rProcesses, ClientLanguage cLang) { runningProcesses = rProcesses; //sets to SegoeUI on Vista Font = SystemFonts.MessageBoxFont; InitializeComponent(); filenames = files; clientLang = cLang; //translate the buttons & text Text = clientLang.ProcessDialog.Title; btnCloseProc.Text = clientLang.ClosePrc; btnCloseAll.Text = clientLang.CloseAllPrc; btnCancel.Text = clientLang.CancelUpdate; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); //reposition buttons btnCloseAll.Left = btnCloseProc.Right + 10; //position all the components UpdateSizes(); // update the list with the running proccesses UpdateList(); bw.WorkerSupportsCancellation = true; bw.DoWork += bw_DoWork; bw.RunWorkerCompleted += bw_RunWorkerCompleted; //begin checking the for the filenames bw.RunWorkerAsync(); }
public frmFilesInUse(ClientLanguage cLang, string filename) { InitializeComponent(); clientLang = cLang; // translate the buttons & text Text = clientLang.FilesInUseDialog.Title; btnCancel.Text = clientLang.CancelUpdate; FilenameInUse = filename; txtFile.Text = filename; if (VistaTools.AtLeastVista()) { // get the list of processes using the file try { runningProcesses = GetProcessesUsingFiles(new[] {filename}); } catch { } if (runningProcesses != null && runningProcesses.Count > 0) { UpdateList(); // translate the items lblProc.Text = clientLang.FilesInUseDialog.SubTitle; btnCloseProc.Text = clientLang.ClosePrc; btnCloseAll.Text = clientLang.CloseAllPrc; // show the list box of the running processes lblProc.Visible = true; listProc.Visible = true; btnCloseAll.Visible = true; btnCloseProc.Visible = true; showingProcesses = true; chkProc = new Timer {Enabled = true, Interval = 2000}; chkProc.Tick += chkProc_Tick; bw = new BackgroundWorker {WorkerSupportsCancellation = true}; bw.DoWork += bw_DoWork; bw.RunWorkerCompleted += bw_RunWorkerCompleted; //begin checking the for the filenames bw.RunWorkerAsync(); } } SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); // position all the components UpdateSizes(); }