Example #1
0
        private void Run()
        {
            int num = 0;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                GlobalConfig configRecord = rPMGlobalConfig.GetConfigRecord("FILEDELETE_MINDAYS");
                if (configRecord != null)
                {
                    num = Convert.ToInt32(configRecord.Value);
                }
            }
            int num1 = 0;

            for (int i1 = 0; i1 < this.FilePanel.Controls.Count; i1++)
            {
                if (((Slide)this.FilePanel.Controls[i1]).sRecord.IsSelected)
                {
                    num1++;
                }
            }
            int num2 = 0;

            this.progBar.Maximum = num1;
            try
            {
                bool flag = false;
                if (num > 0)
                {
                    int num3 = 0;
                    base.BeginInvoke(new MethodInvoker(() => {
                        for (int i = this.FilePanel.Controls.Count - 1; i >= 0; i--)
                        {
                            Slide item = (Slide)this.FilePanel.Controls[i];
                            if (item.sRecord.IsSelected)
                            {
                                this.msgText.Text = item.sRecord.dRecord.ShortDesc;
                                this.pic.Image    = Utilities.ByteArrayToImage(item.sRecord.dRecord.Thumbnail);
                                num2++;
                                this.progBar.Value = num2;
                                flag = true;
                                if (!item.sRecord.dRecord.IsIndefinite & !item.sRecord.dRecord.IsEvidence && item.DeleteSlideFile(num))
                                {
                                    num3++;
                                    this.FilePanel.Controls.Remove(item);
                                }
                            }
                            if (this.IsCancel)
                            {
                                break;
                            }
                        }
                        string str = string.Format(LangCtrl.GetString("txt_FilesDeleted", "Files Deleted: {0}"), num3);
                        if (num2 != num3 && flag)
                        {
                            str = string.Concat(str, LangCtrl.GetString("txt_FilesDeleted2", "\nSome files could not be deleted. Minimum delete days."));
                        }
                        MessageBox.Show(this, str, "Files", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        base.Close();
                    }));
                }
            }
            catch (Exception exception)
            {
                Logger.Logging.WriteSystemLog(VMGlobal.LOG_ACTION.CODE_ERROR, exception.Message, this.Account_ID);
            }
            base.BeginInvoke(new MethodInvoker(() => base.Close()));
        }