private void BtnSoftwareInstallation_Click(object sender, EventArgs e)
        {
            try
            {
                // This part enables IIS features on the system.
                TxtBxLog.AppendText("در حال نصب..." + "\r\n\r\n");
                Task.Run(() =>
                {
                    Installation installation = new Installation(this);
                    if (CheckBxIIS.Checked)
                    {
                        installation.InstallIISAndLog();
                        IISInstalled = true;
                    }
                    if (CheckBxKeyA.Checked)
                    {
                        installation.InstallKeyAAndLog();
                    }
                    if (CheckBxKasraPrintService.Checked)
                    {
                        installation.InstallKasraPrintServiceAndLog();
                    }
                    if (CheckBxFlashPlayer.Checked)
                    {
                        installation.InstallFlashPlayerAndLog();
                    }

                    // Save the log in a physical path. Method 'SaveLog' is static.
                    string logFileName = "PrerequisitesLog";
                    string storagePath = PublishPath + @"\App";
                    string log         = TxtBxLog.Text;
                    FileManager.SaveLog(logFileName, storagePath, log);
                    DisableBtnSoftwareInstallation = false;
                    MessageBox.Show("." + "فرایند نصب با موفقیت کامل شد");
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void LoadLog(string filename)
        {
            try {
                logs.Clear();
                if (TxtBxLog.Text != "")
                {
                    TxtBxLog.Clear();
                }

                using (var reader = new StreamReader(filename)) {
                    while (!reader.EndOfStream)
                    {
                        var line = reader.ReadLine();
                        logs.Add(line);
                    }
                }
            }
            catch (Exception exc) {
                CstmMsgBx.Error("A error occured while trying to load logs");
                Log.Error(Log.GetMethodName(), exc.ToString());
            }
        }
Пример #3
0
        private void BtnClearLog_Click(object sender, RoutedEventArgs e)
        {
            try {
                string path = "";
                switch (CmbBx_Spelling.SelectedIndex)
                {
                case 0:
                    path = Log.GetPath("log.txt");
                    break;

                case 1:
                    path = Log.GetPath("log.err");
                    break;
                }

                System.IO.File.WriteAllText(path, string.Empty);
                TxtBxLog.Clear();
            }
            catch (Exception exc) {
                CstmMsgBx.Error("A error occured while trying to clear logs");
                Log.Error(Log.GetMethodName(), exc.ToString());
            }
        }