private void itemDeleteProject_Click(object sender, EventArgs e)
        {
            if (dataGridViewProjects.Rows.Count > 0 && dataGridViewProjects.SelectedRows.Count > 0)
            {
                //this.TopMost = true;
                this.Enabled = false;
                _frmWait     = new FrmWait();
                _frmWait.Show();

                //
                //await Task.Run(() => DeleteProjectAndChildern());
                DeleteProjectAndChildern();
                _frmWait.Close();
                this.Enabled = true;
                this.TopMost = false;

                DataView dv = _dtProjects.DefaultView;
                dv.Sort     = "ProjectCode desc";
                _dtProjects = dv.ToTable();
            }
            else
            {
                ClearAll();
            }
        }
        private void LoadBOM_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog dlg_im = new OpenFileDialog();
                dlg_im.Filter = "Excel File|*.xls;*.xlsx;*.xlsm";
                //dlg_im.Filter = "Excel File|*.xlsx";

                if (dlg_im.ShowDialog() == DialogResult.OK)
                {
                    //this.TopMost = true;
                    this.Enabled = false;
                    //dataGridView1.Rows.Clear();
                    txtBOMFilePath.Text = dlg_im.FileName;
                    _frmWait            = new FrmWait();
                    _frmWait.Show();

                    //await Task.Run(() => LoadBOMFromFile());
                    LoadBOMFromFile();
                    dataGridView1.DataSource = _dtSalesBOM;
                    _frmWait.Close();
                    this.Enabled = true;
                    this.TopMost = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 3
0
        // Refresh the list.
        private void mnuFileRefreshList_Click(object sender, System.EventArgs e)
        {
            // Warn them if they have stuff selected.
            if (HasStartedProcessing())
            {
                if (MessageBox.Show("This will wipe out your current selections. Refresh anyway?", "Refresh Lists", MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
            }

            // Reload the claim list.
            FrmWait f = null;

            try
            {
                f = new FrmWait();
                f.Message.Text = "Please wait while the information is retrieved...";
                f.Show(); Application.DoEvents();
                RefreshList();
            }
            catch (Exception ex)
            {
                Globals.Logger.Warn("Could not load claims.", ex);
            }
            finally
            {
                if (f != null)
                {
                    f.Close();
                    f = null;
                }
            }
        }
Esempio n. 4
0
 private void HandleBackreferencing()
 {
     if (this._config.ItemsReferenceList)
     {
         FrmWait.Show(this, "Updating source", null, z => this._config.UntypedApplyChanges(this._list, z, true));
     }
 }
Esempio n. 5
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            SkinHelper.InitSkinPopupMenu(this.barSubItemTemas);
            //string defaultConnection = ConfigurationManager.AppSettings["DefaultConnectionString"].ToString();
            using (FrmWait frm = new FrmWait(InitConnect))
            {
                frm.ShowDialog();
                //frm.MdiParent = this;
                //frm.Show();
            }
            FrmLogin frmLogin = new FrmLogin();
            var      result   = frmLogin.ShowDialog();

            if (result == DialogResult.OK)
            {
                Param.ActiveUser = frmLogin.Usuario;
                MenuBo menuBo   = new MenuBo();
                var    listMenu = menuBo.MenuOfUser(Param.ActiveUser.UserName);
                ucMenuPrincipal.DataSource   = listMenu;
                barStaticItemUsuario.Caption = string.Format("{0} : {1}", StrUsuario, Param.ActiveUser.Descripcion);
                dockPanelMenu.Show();
                dockPanelMenu_Container.Focus();
            }
            else if (result == DialogResult.Cancel)
            {
                Application.Exit();
            }

            ucMenuPrincipal.DoubleClickEvent += UcMenuPrincipal_DoubleClickEvent;
        }
Esempio n. 6
0
        private void UploadAttachment()
        {
            string fileServiceUrl = string.Empty;

            using (BugTraceEntities zentity = new BugTraceEntities(EntityContextHelper.GetEntityConnString()))
            {
                var currVersion = zentity.SYS_Version.Where(p => p.IsDefault == 1).FirstOrDefault();
                fileServiceUrl = currVersion.FileServiceUrlPort;
            }
            try
            {
                string          filepath = this.txtAttachment.Text;
                EndpointAddress address  = new EndpointAddress("http://" + fileServiceUrl + "/JAJ.WinServer/FileService");
                FileTransferSvc.FileServiceClient _client    = new FileTransferSvc.FileServiceClient("BasicHttpBinding_IFileService", address);
                FileTransferSvc.TransferFileData  uploadData = new FileTransferSvc.TransferFileData();
                uploadData.FileName     = Path.GetFileName(filepath);
                uploadData.FileData     = File.OpenRead(filepath);
                uploadData.FileSize     = (int)uploadData.FileData.Length;
                uploadData.FileUniqueID = this._attachmentUniqueID;
                uploadData.FileType     = "PPM_ProblemTrace";
                uploadData.oldFileName  = this._oldFileName;
                wait = new FrmWait("正 在 上 传 请 稍 候");
                wait.Show();
                _client.UploadFileAsync(uploadData.FileName, uploadData.FileSize, uploadData.FileType,
                                        uploadData.FileUniqueID, uploadData.oldFileName, uploadData.FileData);
                _client.UploadFileCompleted += _client_UploadFileCompleted;
            }
            catch (Exception ex)
            {
                MessageBox.Show("文件上传失败!");
                MyLog.LogError("保存问题跟踪时文件上传失败!", ex);
                return;
            }
        }
Esempio n. 7
0
        private void dgvShareFile_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            var obj = this.dgvShareFile.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

            if (obj != null)
            {
                string buttonText = this.dgvShareFile.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                if (buttonText == "下载")
                {
                    if (this.folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        wait = new FrmWait("正 在 下 载 请 稍 候");
                        wait.Show();
                        //WaitForm.Show(this, "正 在 下 载 请 稍 候");
                        Thread downloadThread = new Thread(downloadFile);
                        downloadThread.IsBackground = true;
                        downloadThread.Start(e.RowIndex);
                    }
                }
            }
        }
Esempio n. 8
0
        /// <summary>Initializes an instance of FrmMain.</summary>
        public frmMain()
        {
            // Build and initialize the form.
            InitializeComponent();
            StartEventProcessing();

            // Connect to the database.
            try
            {
                Globals.Logger.Debug("Opening database connection...");
                Globals.Database = new SqlConnection(SettingsManager.Instance.Settings["EClaims"].DatabaseConnection.GetSqlConnectionString("Application Name=EClaims"));
                Globals.Database.Open();
                Globals.Logger.Debug("Database open.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not open connection to database.", "EClaims");
                Globals.Logger.Error("Could not open connection to database.", ex);
            }

            // Load the claim list.
            FrmWait f = null;

            try
            {
                f = new FrmWait();
                f.Message.Text = "Please wait while the information is retrieved...";
                f.Show(); Application.DoEvents();
                RefreshList();
            }
            catch (Exception ex)
            {
                Globals.Logger.Warn("Could not load claims.", ex);
            }
            finally
            {
                if (f != null)
                {
                    f.Close();
                    f = null;
                }
            }

            // Build the handling menus.
            foreach (ClaimHandler hc in Globals.Settings.Handlers)
            {
                mnuClaims.MenuItems.Add(hc.Name, new System.EventHandler(this.SetHandling));
                mnuHandling.MenuItems.Add(hc.Name, new System.EventHandler(this.SetHandling));
            }
            mnuClaims.MenuItems.Add("-");
            mnuClaims.MenuItems.Add("Clear Handling", new System.EventHandler(this.SetNone));
            mnuHandling.MenuItems.Add("-");
            mnuHandling.MenuItems.Add("Clear Handling", new System.EventHandler(this.SetNone));
        }
Esempio n. 9
0
        public static ResultCIDWait Show(Func <Task> action, string message)
        {
            ResultCIDWait resultCIDWait = new ResultCIDWait();

            _FrmEspere = new FrmWait(action, message);
            resultCIDWait.IsCompleted = (_FrmEspere.ShowDialog() == System.Windows.Forms.DialogResult.OK);
            if (!resultCIDWait.IsCompleted)
            {
                resultCIDWait.ExceptionsList = _FrmEspere.Exceptions;
            }
            _FrmEspere.Dispose();
            return(resultCIDWait);
        }
Esempio n. 10
0
        /// <summary>
        /// 显示等待窗口
        /// </summary>
        /// <param name="pComponet">调用对象,可为控件或窗口</param>
        public static void Show(Control pComponet, string message)
        {
            //已显示则返回
            if (mShowing)
            {
                return;
            }
            //创建等待窗口
            mWait = new JAJ.WinForm.FrmWait(message);
            //设置窗口关闭事件
            mWait.FormClosed += new FormClosedEventHandler(WaitForm_FormClosed);
            //启动显示线程
            Thread tmpThread = new Thread(show);

            tmpThread.Start(pComponet);
        }
Esempio n. 11
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            if (!this._keepChanges)
            {
                // Restore any backups (only needed if items are mutable)
                this._backups.RestoreAll();

                // Restore the original list (only needed if source list was modified)
                if (this._config.ItemsReferenceList)
                {
                    FrmWait.Show(this, "Reverting changes", null, z => this._config.UntypedApplyChanges(this._originalList, z, true));
                }
            }
        }
Esempio n. 12
0
        private async void btnSave_Click(object sender, EventArgs e)
        {
            FrmWait frmwait = new FrmWait();

            frmwait.Show();

            //Application.DoEvents();
            this.Enabled = false;

            await Task.Run(() => SaveToRepository());


            //_LstProjects
            this.Enabled = true;
            frmwait.Close();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            //this.TopMost = true;
            this.Enabled = false;
            _frmWait     = new FrmWait();
            _frmWait.Show();
            //await Task.Run(() => SaveToRepository());
            SaveToRepository();

            DataView dv = _dtProjects.DefaultView;

            dv.Sort     = "ProjectCode desc";
            _dtProjects = dv.ToTable();

            //_LstProjects
            _frmWait.Close();
            this.Enabled = true;
            this.TopMost = false;
        }
Esempio n. 14
0
 private void linkAttachment_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.linkAttachment.Text))
     {
         return;
     }
     if (this.folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         wait = new FrmWait("正 在 下 载 请 稍 候");
         wait.Show();
         Thread downloadThread = new Thread(downloadFile);
         downloadThread.IsBackground = true;
         List <KeyValuePair <string, string> > map = new List <KeyValuePair <string, string> >();
         map.Add(new KeyValuePair <string, string>("folder", folderBrowserDialog1.SelectedPath));
         map.Add(new KeyValuePair <string, string>("fileName", this.linkAttachment.Text));
         map.Add(new KeyValuePair <string, string>("uniqueID", this._attachmentUniqueID));
         downloadThread.Start(map);
     }
 }
Esempio n. 15
0
        private void _btnOk_Click(object sender, EventArgs e)
        {
            this._selectionResult = _listViewHelper.Selection;
            this._keepChanges     = true;

            try
            {
                FrmWait.Show(this, "Applying changes", null, z => this._config.UntypedApplyChanges(this._list, z, false));
            }
            catch (TaskCanceledException ex)
            {
                FrmMsgBox.ShowError(this, ex);
                return;
            }

            this._config.UntypedAfterApply(this, this._list);

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 16
0
 /// <summary>
 /// 窗口关闭事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static void WaitForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (mWaiting || !(sender is FrmWait))
     {
         //信号等待中被异常关闭,或主窗口被关闭时自动通知信号复位
         mEvents.Set();
         return;
     }
     mShowing = false;
     //回收等待窗口
     try
     {
         mWait.Dispose();
     }
     finally
     {
         mWait = null;
     }
 }
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (!LinkManagerTest() || !LinkContentTest())
                {
                    MessageBox.Show("请检查数据库设置是否正常!");
                    return;
                }

                config.DbUser     = this.skinTextBox_managerAccount.SkinTxt.Text.Trim();
                config.DbAddress  = this.skinTextBox_managerAddress.SkinTxt.Text.Trim();
                config.DbName     = this.skinTextBox_managerDbName.SkinTxt.Text.Trim();
                config.DbPassword = this.skinTextBox_managerPwd.SkinTxt.Text.Trim();

                config.DbFileContentUser     = this.skinTextBox_contentAccount.SkinTxt.Text.Trim();
                config.DbFileContentAddress  = this.skinTextBox_contentAddress.SkinTxt.Text.Trim();
                config.DbFileContentName     = this.skinTextBox_contentDbName.SkinTxt.Text.Trim();
                config.DbFileContentPassword = this.skinTextBox_contentPwd.SkinTxt.Text.Trim();
                //new SystemConfigBll().saveConifg(config);

                // 开始安装
                FrmWait      frmManager    = new FrmWait(config.DbName, 0, config.DbAddress, config.DbUser, config.DbPassword);
                DialogResult resultManager = frmManager.ShowDialog();

                if (resultManager == System.Windows.Forms.DialogResult.OK)
                {
                    FrmWait      frmContent    = new FrmWait(config.DbFileContentName, 1, config.DbFileContentAddress, config.DbFileContentUser, config.DbFileContentPassword);
                    DialogResult resultContent = frmContent.ShowDialog();

                    if (resultContent == System.Windows.Forms.DialogResult.OK)
                    {
                        MessageBox.Show("安装成功!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("安装失败发生了异常 : ", ex.Message);
                return;
            }
        }
        public static async Task UpdateEmbeddedBarcodeBuddyRelease(Form ownerFormReference = null)
        {
            FrmWait waitWindow = null;

            if (ownerFormReference != null)
            {
                waitWindow = new FrmWait();
                waitWindow.Show(ownerFormReference);
            }

            if (Directory.Exists(BarcodeBuddyExecutingPath))
            {
                Directory.Delete(BarcodeBuddyExecutingPath, true);
            }

            string barcodeBuddyZipPath = Path.GetTempFileName();

            using (WebClient wc = new WebClient())
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_DownloadingBarcodeBuddyRelease.Text"));
                }
                await wc.DownloadFileTaskAsync(new Uri(LATEST_BARCODE_BUDDY_RELEASE_URL), barcodeBuddyZipPath);
            }

            if (waitWindow != null)
            {
                waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingBarcodeBuddy.Text"));
            }
            await Task.Run(() => IOHelper.ExtractZipToDirectory(barcodeBuddyZipPath, BarcodeBuddyExecutingPath + "-tmp", true));

            Directory.Move(Directory.GetDirectories(BarcodeBuddyExecutingPath + "-tmp").First(), BarcodeBuddyExecutingPath);
            Directory.Delete(BarcodeBuddyExecutingPath + "-tmp", true);
            File.Delete(barcodeBuddyZipPath);

            if (waitWindow != null)
            {
                waitWindow.Close();
            }
        }
Esempio n. 19
0
        private void button1_Click(object sender, EventArgs e)
        {
            Person p = new Person();

            p.Name = "Wilson";
            p.Age  = 22;
            frm    = null;
            Thread thread = new Thread(MyFunction);

            thread.IsBackground = true;
            frm = new FrmWait(thread);
            thread.Start(p);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                MessageBox.Show("OK!");
            }
            else
            {
                MessageBox.Show("Cancelled!");
            }
        }
Esempio n. 20
0
 public FrmSettle()
 {
     InitializeComponent();
     this.Width    = 530;
     this.Height   = 330;
     this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2,
                               (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
     if (frmWait == null)
     {
         frmWait = new FrmWait("");
     }
     //初始化委托
     dlgShowWaitMsg     = new DlgShowMsg(ShowWaitMsg);
     dlgHideWaitMsg     = new DlgHideMsg(HideWaitMsg);
     dlgShowErrorMsgBox = new DlgShowMsg(ShowErrorMsgBox);
     dlgShowInfoMsgBox  = new DlgShowMsg(ShowInfoMsgBox);
     dlgCloseForm       = new DlgCloseForm(CloseForm);
     //初始化线程
     readThread = new Thread(new ThreadStart(ReadCard));
     readThread.IsBackground = true;
     readThread.Start();
 }
        public static async Task UpdateEmbeddedGrocyRelease(Form ownerFormReference = null)
        {
            FrmWait waitWindow = null;

            if (ownerFormReference != null)
            {
                waitWindow = new FrmWait();
                waitWindow.Show(ownerFormReference);
            }

            if (Directory.Exists(GrocyExecutingPath))
            {
                Directory.Delete(GrocyExecutingPath, true);
            }

            string grocyZipPath = Path.GetTempFileName();

            using (WebClient wc = new WebClient())
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_DownloadingGrocyRelease.Text"));
                }
                await wc.DownloadFileTaskAsync(new Uri(LATEST_GROCY_RELEASE_URL), grocyZipPath);
            }

            if (waitWindow != null)
            {
                waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingGrocy.Text"));
            }
            await Task.Run(() => IOHelper.ExtractZipToDirectory(grocyZipPath, GrocyExecutingPath, true));

            File.Delete(grocyZipPath);

            if (waitWindow != null)
            {
                waitWindow.Close();
            }
        }
Esempio n. 22
0
        internal static ClusterEvaluationPointer Show(Form owner, Core core, ClusterEvaluationPointer options, bool readOnly)
        {
            ClusterEvaluationConfiguration config;

            if (options == null)
            {
                config = null;
            }
            else
            {
                config = options.Configuration;

                if (config == null)
                {
                    if (!FrmMsgBox.ShowOkCancel(owner, "Open Configuration", "The selected configuration has been saved to disk and must be loaded before it is viewed or modified."))
                    {
                        return(null);
                    }

                    config = FrmWait.Show <ClusterEvaluationResults>(owner, "Loading results", null, z => FrmActEvaluate.LoadResults(core, options.FileName, z))?.Configuration;

                    if (config == null)
                    {
                        return(null);
                    }
                }
            }

            using (FrmEvaluateClusteringOptions frm = new FrmEvaluateClusteringOptions(core, config, readOnly))
            {
                if (UiControls.ShowWithDim(owner, frm) == DialogResult.OK)
                {
                    return(frm.GetSelection());
                }
            }

            return(null);
        }
Esempio n. 23
0
        private void btnImportExcel_Click(object sender, EventArgs e)
        {
            #region 验证
            if (string.IsNullOrWhiteSpace(this.txtExcelPath.Text))
            {
                MessageBox.Show(this, "请选择Excel", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrWhiteSpace(txtTableName.Text))
            {
                MessageBox.Show(this, "表名不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!CheckParameter(txtTableName.Text))
            {
                MessageBox.Show(this, "表命名不合法!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            bool IsCanConnectioned = ConnectionTest();
            if (!IsCanConnectioned)
            {
                MessageBox.Show(this, "连接数据库失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;;
            }
            #endregion

            Thread thread = new Thread(ImportExcel);
            thread.IsBackground = true;
            List <KeyValuePair <string, object> > kv = new List <KeyValuePair <string, object> >();
            kv.Add(new KeyValuePair <string, object>("excelPath", this.txtExcelPath.Text));
            kv.Add(new KeyValuePair <string, object>("oraConn", GetConnectionString()));
            kv.Add(new KeyValuePair <string, object>("tableName", this.txtTableName.Text));
            kv.Add(new KeyValuePair <string, object>("isClearData", false));
            wait = new FrmWait("正 在 导 入 请 稍 候");
            wait.Show();
            thread.Start(kv);
        }
Esempio n. 24
0
        private void DownloadArchive(GClass32 archive)
        {
            string str = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "nand", "00000000000000000000000000000000", "title", archive.TitleId.Low.ToLower(), archive.TitleId.High.ToLower(), "content");

            Directory.CreateDirectory(str);
            string destinationFile = Path.Combine(str, "00000000.app.romfs");

            if (System.IO.File.Exists(destinationFile))
            {
                return;
            }
            GClass80 gclass80 = new GClass80((WebProxy)null, true, true);
            FrmWait  frmWait  = new FrmWait("Downloading system archive from: NUS...", true);

            gclass80.Event_5 += (EventHandler <GClass81>)((_param1, _param2) =>
            {
                string temp_dir = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
                GClass6.smethod_5(temp_dir);
                Directory.CreateDirectory(temp_dir);
                Path.Combine(temp_dir, "game.cia");
                archive.method_5(temp_dir, "game");
                GClass27.smethod_11(temp_dir);
                ProcessStartInfo processStartInfo1 = new ProcessStartInfo()
                {
                    FileName         = Path.Combine(temp_dir, "PART1"),
                    WorkingDirectory = temp_dir
                };
                Process process1 = new Process();
                process1.StartInfo           = processStartInfo1;
                process1.EnableRaisingEvents = true;
                process1.Exited += (EventHandler)((sender1, e1) =>
                {
                    try
                    {
                        IEnumerable <FileInfo> potential_files = new DirectoryInfo(temp_dir).EnumerateFiles("contents.*");
                        if (potential_files.Count <FileInfo>() == 0)
                        {
                            throw new Exception("An error occured while preparing the system archive!");
                        }
                        FileInfo fileInfo = potential_files.First <FileInfo>((Func <FileInfo, bool>)(x => x.Length == potential_files.Max <FileInfo>((Func <FileInfo, long>)(y => y.Length))));
                        ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                        {
                            FileName = Path.Combine(temp_dir, "3dstool.exe"),
                            WorkingDirectory = temp_dir,
                            Arguments = string.Format("-xvtf cfa {0} --romfs 00000000.app.romfs --romfs-auto-key", (object)fileInfo)
                        };
                        Process process2 = new Process();
                        process2.StartInfo = processStartInfo2;
                        process2.Exited += (EventHandler)((sender2, e2) =>
                        {
                            string path = Path.Combine(temp_dir, "00000000.app.romfs");
                            using (FileStream fileStream1 = System.IO.File.Create(destinationFile))
                            {
                                using (FileStream fileStream2 = System.IO.File.Open(path, FileMode.Open))
                                {
                                    fileStream2.Seek(4096L, SeekOrigin.Begin);
                                    for (int index = 0; (long)index < fileStream2.Length - 4096L; ++index)
                                    {
                                        int num = fileStream2.ReadByte();
                                        fileStream1.WriteByte((byte)num);
                                    }
                                }
                            }
                            GClass6.smethod_5(temp_dir);
                            frmWait.method_0();
                        });
                        process2.EnableRaisingEvents = true;
                        process2.Start();
                    }
                    catch
                    {
                    }
                });
                process1.Start();
            });
            gclass80.Event_6 += (EventHandler <GEventArgs0>)((sender, e) => frmWait.method_2(e.GameProgress));
            gclass80.method_1(((IEnumerable <GClass30>) new GClass30[1]
            {
                (GClass30)archive
            }).ToList <GClass30>(), 100, 10000);
            int num1 = (int)frmWait.ShowDialog();
        }
Esempio n. 25
0
        private void DownloadSharedFont()
        {
            string sharedFontDestination = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "sysdata", "shared_font.bin");

            if (System.IO.File.Exists(sharedFontDestination))
            {
                return;
            }
            GClass80 gclass80 = new GClass80((WebProxy)null, true, true);
            FrmWait  frmWait  = new FrmWait("Downloading the Shared Font from NUS...", true);

            gclass80.Event_5 += (EventHandler <GClass81>)((_param1, _param2) =>
            {
                Path.Combine(Path.GetTempPath(), "game.cia");
                GClass28.gclass32_0.method_5(Path.GetTempPath(), "game");
                string outputDir = Path.GetTempPath();
                GClass27.smethod_11(outputDir);
                ProcessStartInfo processStartInfo1 = new ProcessStartInfo()
                {
                    FileName         = Path.Combine(outputDir, "PART1"),
                    WorkingDirectory = outputDir
                };
                Process process1 = new Process();
                process1.StartInfo           = processStartInfo1;
                process1.EnableRaisingEvents = true;
                process1.Exited += (EventHandler)((sender1, e1) =>
                {
                    try
                    {
                        ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                        {
                            FileName = Path.Combine(outputDir, "3dstool.exe"),
                            WorkingDirectory = outputDir,
                            Arguments = "-xvtf cfa contents.0000.00000000 --romfs DecryptedRomFS.bin --romfs-auto-key"
                        };
                        Process process2 = new Process();
                        process2.StartInfo = processStartInfo2;
                        process2.Exited += (EventHandler)((sender2, e2) =>
                        {
                            ProcessStartInfo processStartInfo2 = new ProcessStartInfo()
                            {
                                FileName = "3dstool.exe",
                                WorkingDirectory = outputDir,
                                Arguments = "-xvtf romfs DecryptedRomFS.bin --romfs-dir ExtractedRomFS"
                            };
                            Process process2 = new Process();
                            process2.StartInfo = processStartInfo2;
                            process2.EnableRaisingEvents = true;
                            process2.Exited += (EventHandler)((sender3, e3) =>
                            {
                                byte[] buffer = new LZ11().Decompress(System.IO.File.ReadAllBytes(Path.Combine(outputDir, "ExtractedRomFS", "cbf_std.bcfnt.lz")));
                                Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Citra), "sysdata"));
                                using (FileStream fileStream = System.IO.File.Create(sharedFontDestination))
                                {
                                    using (MemoryStream memoryStream = new MemoryStream(buffer))
                                    {
                                        memoryStream.Seek(928L, SeekOrigin.Begin);
                                        fileStream.Write(Class3.byte_1, 0, Class3.byte_1.Length);
                                        for (int index = 0; index < 3095744; ++index)
                                        {
                                            int num = memoryStream.ReadByte();
                                            fileStream.WriteByte((byte)num);
                                        }
                                        fileStream.Write(Class3.byte_0, 0, Class3.byte_0.Length);
                                    }
                                }
                                frmWait.method_0();
                            });
                            process2.Start();
                        });
                        process2.EnableRaisingEvents = true;
                        process2.Start();
                    }
                    catch
                    {
                    }
                });
                process1.Start();
            });
            gclass80.Event_6 += (EventHandler <GEventArgs0>)((sender, e) => frmWait.method_2(e.GameProgress));
            gclass80.method_1(((IEnumerable <GClass30>) new GClass30[1]
            {
                (GClass30)GClass28.gclass32_0
            }).ToList <GClass30>(), 100, 10000);
            int num1 = (int)frmWait.ShowDialog();
        }
        public static async Task UnpackIncludedDependenciesIfNeeded(UserSettings settings, Form ownerFormReference = null)
        {
            FrmWait waitWindow = null;

            if (ownerFormReference != null)
            {
                waitWindow = new FrmWait();
                waitWindow.Show(ownerFormReference);
            }

            string vc2019x86ZipPath = Path.Combine(Program.BaseExecutingPath, "vc2019x86.zip");

            // CefSharp x86
            string cefZipPathx86 = Path.Combine(Program.BaseExecutingPath, "cefx86.zip");
            string cefPathx86    = Path.Combine(CefExecutingPath, "x86");

            if (!Directory.Exists(cefPathx86))
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingWebbrowser.Text"));
                }
                await Task.Run(() => IOHelper.ExtractZipToDirectory(cefZipPathx86, cefPathx86, true));
            }

            // nginx
            string nginxZipPath = Path.Combine(Program.BaseExecutingPath, "nginx.zip");

            if (!Directory.Exists(NginxExecutingPath))
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingWebserver.Text"));
                }
                await Task.Run(() => IOHelper.ExtractZipToDirectory(nginxZipPath, NginxExecutingPath, true));
            }

            // PHP
            string phpZipPath = Path.Combine(Program.BaseExecutingPath, "php.zip");

            if (!Directory.Exists(PhpExecutingPath))
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingPhpRuntime.Text"));
                }
                await Task.Run(() => IOHelper.ExtractZipToDirectory(phpZipPath, PhpExecutingPath, true));

                await Task.Run(() => IOHelper.ExtractZipToDirectory(vc2019x86ZipPath, PhpExecutingPath, true));
            }

            // grocy
            string grocyZipPath = Path.Combine(Program.BaseExecutingPath, "grocy.zip");

            if (!Directory.Exists(GrocyExecutingPath))
            {
                if (waitWindow != null)
                {
                    waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingGrocy.Text"));
                }
                await Task.Run(() => IOHelper.ExtractZipToDirectory(grocyZipPath, GrocyExecutingPath, true));
            }

            // Barcode Buddy
            if (settings.EnableBarcodeBuddyIntegration)
            {
                string barcodeBuddyZipPath = Path.Combine(Program.BaseExecutingPath, "barcodebuddy.zip");
                if (!Directory.Exists(BarcodeBuddyExecutingPath))
                {
                    if (waitWindow != null)
                    {
                        waitWindow.SetStatus(ResourceManager.GetString("STRING_PreparingBarcodeBuddy.Text"));
                    }
                    await Task.Run(() => IOHelper.ExtractZipToDirectory(barcodeBuddyZipPath, BarcodeBuddyExecutingPath + "-tmp", true));

                    Directory.Move(Directory.GetDirectories(BarcodeBuddyExecutingPath + "-tmp").First(), BarcodeBuddyExecutingPath);
                    Directory.Delete(BarcodeBuddyExecutingPath + "-tmp", true);
                }
            }

            // Cleanup old runtime dependency folders
            foreach (string item in Directory.GetDirectories(Program.RuntimeDependenciesBasePath))
            {
                if (new DirectoryInfo(item).Name != Program.RunningVersion)
                {
                    Directory.Delete(item, true);
                }
            }

            if (waitWindow != null)
            {
                waitWindow.Close();
            }
        }
Esempio n. 27
0
        // Process the claims.
        private void btnProcess_Click(object sender, System.EventArgs e)
        {
            // Make sure they want to do this.
            if (MessageBox.Show("Process the claims as defined?", "Process", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            // Show the 'please wait' dialog.
            FrmWait f = new FrmWait();

            f.Message.Text = "Please wait while the claims are processed.";
            f.Show();
            btnProcess.Enabled = false;
            Application.DoEvents();

            Globals.Logger.Info("Processing claims...");
            SqlTransaction trans = Globals.Database.BeginTransaction();

            // Work the claims one handling method at a time.
            bool         success = true;
            ClaimHandler ch;
            Claim        cl;

            Globals.Settings.ResetHandlers();
            foreach (ListViewItem lvi in listClaims.Items)
            {
                if (lvi.SubItems[5].Text != string.Empty)
                {
                    ch = Globals.Settings.GetHandlerByName(lvi.SubItems[5].Text);
                    if (ch.Batch == null)
                    {
                        ch.CreateBatch(trans);
                    }
                    try
                    {
                        cl = new Claim(((int[])lvi.Tag)[0], ((int[])lvi.Tag)[1], trans);
                        try
                        {
                            ValidateClaim.Validate(cl);
                        }
                        catch (Exception ex2)
                        {
                            if (MessageBox.Show("Warning: " + lvi.SubItems[0].Text + " Claim for " + lvi.SubItems[1].Text + " (" + lvi.SubItems[4].Text + ": " + lvi.SubItems[3].Text + ") failed validation. Process anyway?" + Environment.NewLine + Environment.NewLine + ex2.Message, "Process Claims", MessageBoxButtons.YesNo) == DialogResult.No)
                            {
                                Globals.Logger.Info("Claim " + ((int[])lvi.Tag)[0].ToString() + "/" + ((int[])lvi.Tag)[1].ToString() + " not added to batch. " + ex2.Message);
                                continue;
                            }
                        }
                        ch.AddClaim(trans, cl);
                    }
                    catch (Exception ex)
                    {
                        Globals.Logger.Error("Could not add claim " + ((int[])lvi.Tag)[0].ToString() + "/" + ((int[])lvi.Tag)[1].ToString() + " to batch.", ex);
                        success = false;
                    }
                }
            }
            trans.Commit();


            // Process the electronic claims.
            foreach (ClaimHandler c in Globals.Settings.Handlers)
            {
                if ((c is ElectronicClaimHandler) && (c.Batch != null))
                {
                    Globals.Logger.Info("Executing post-processing for handler " + c.Name + " (batch " + c.Batch.BatchInformation.BatchID.ToString() + ")...");
                    try
                    {
                        ((ElectronicClaimHandler)c).Process();
                    }
                    catch (Exception ex)
                    {
                        Globals.Logger.Error("Processing failed.", ex);
                        success = false;
                    }
                    Globals.Logger.Info("Post-processing complete for handler " + c.Name + " (batch " + c.Batch.BatchInformation.BatchID.ToString() + ").");
                }
            }

            // Let them know we're done.
            Globals.Logger.Info("Claim processing complete.");
            if (success)
            {
                MessageBox.Show("Claim processing complete.", "Process");
            }
            else
            {
                MessageBox.Show("Claim processing completed with errors. See log for details.", "Process");
            }

            // Reload the claim list.
            try
            {
                f.Message.Text = "Please wait while the information is retrieved...";
                Application.DoEvents();
                RefreshList();
            }
            catch (Exception ex)
            {
                Globals.Logger.Warn("Could not load claims.", ex);
            }
            finally
            {
                if (f != null)
                {
                    f.Close();
                    f = null;
                }
            }

            btnProcess.Enabled = true;
        }
        void wizard_OkClicked(object sender, EventArgs e)
        {
            // Check
            if (!this._wizard.RevalidateAll())
            {
                FrmMsgBox.ShowError(this, "Not all options have been selected.");
                return;
            }

            int    param1_numClusters   = this._radStopN.Checked ? int.Parse(this._txtStopN.Text) : int.MinValue;
            double param2_distanceLimit = this._radStopD.Checked ? double.Parse(this._txtStopD.Text) : double.MinValue;

            Debug.Assert(this._ecbSeedPeak.HasSelection, "Expected a seed peak to be selected");
            WeakReference <Peak> param3_seedPeak  = new WeakReference <Peak>(this._ecbSeedPeak.SelectedItem);
            GroupInfo            param4_seedGroup = NamedItem <GroupInfo> .Extract(this._lstGroups.SelectedItem);

            int             param5_doKMeans = this._radFinishK.Checked ? 1 : 0;
            IMatrixProvider source          = this._ecbSource.SelectedItem;

            object[] parameters = { param1_numClusters, param2_distanceLimit, param3_seedPeak, param4_seedGroup, param5_doKMeans };
            string   name       = "DK";

            // Create a constraint that only allows overlapping timepoints
            HashSet <int>       overlappingPoints = new HashSet <int>();
            var                 fil           = this._ecbFilter.SelectedItem ?? ObsFilter.Empty;
            var                 passed        = fil.Test(source.Provide.Columns.Select(z => z.Observation)).Passed;
            HashSet <GroupInfo> groups        = new HashSet <GroupInfo>(passed.Select(z => z.Group));
            bool                needsExFilter = false;

            foreach (int ctp in this._core.Times)
            {
                bool trueInAny  = false;
                bool falseInAny = false;

                foreach (GroupInfo g in groups)
                {
                    if (passed.Any(z => z.Group == g && z.Time == ctp))
                    {
                        trueInAny = true;
                    }
                    else
                    {
                        falseInAny = true;
                    }
                }

                if (trueInAny && !falseInAny) // i.e. true in all          TT
                {
                    overlappingPoints.Add(ctp);
                }
                else if (trueInAny) // i.e. true in one but not all        TF
                {
                    needsExFilter = true;
                }
                //else if (falseInAny) //  False in all (accptable)        FT
                // else       //     No groups                             FF
            }

            ObsFilter trueFilter;

            if (needsExFilter)
            {
                List <ObsFilter.Condition> conditions = new List <ObsFilter.Condition>
                {
                    new ObsFilter.ConditionFilter(Filter.ELogicOperator.And, false,
                                                  this._ecbFilter.SelectedItem, true),
                    new ObsFilter.ConditionTime(Filter.ELogicOperator.And, false,
                                                Filter.EElementOperator.Is,
                                                overlappingPoints)
                };


                trueFilter = new ObsFilter(null, null, conditions);
                this._core.AddObsFilter(trueFilter);
            }
            else
            {
                trueFilter = this._ecbFilter.SelectedItem;
            }

            ArgsClusterer args = new ArgsClusterer(
                Algo.ID_DKMEANSPPWIZ,
                this._ecbSource.SelectedItem,
                this._ecbPeakFilter.SelectedItem,
                new ConfigurationMetric()
            {
                Args = new ArgsMetric(this._ecbDistance.SelectedItem.Id, this._ecbSource.SelectedItem, this._ecbDistance.SelectedItem.Parameters.StringToParams(this._core, this._txtDistanceParams.Text))
            },
                trueFilter,
                this._chkClusterIndividually.Checked,
                EClustererStatistics.None,
                parameters,
                "DK")
            {
                OverrideDisplayName = name,
                Comment             = "Generated using wizard"
            };

            ConfigurationClusterer config = new ConfigurationClusterer()
            {
                Args = args
            };

            FrmWait.Show(this, "Clustering", null, z => this._core.AddClusterer(config, z));
            this.DialogResult = DialogResult.OK;
        }