Ejemplo n.º 1
0
        private void docToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SFD.Filter   = "Microsoft Word File (*.doc) | *.doc | Microsoft Word File (*.docx) | *.docx | Rich Text Format File (*.rtf) | *.rtf | Text File (*.txt) | *.txt";
            SFD.FileName = "Log";
            if (SFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(SFD.FileName))
            {
                switch (System.IO.Path.GetExtension(SFD.FileName).ToLower())
                {
                case ".docx":
                    Output(Aspose.Words.SaveFormat.Docx, SFD.FileName, false);
                    break;

                case ".txt":
                    Output(Aspose.Words.SaveFormat.Text, SFD.FileName, false);
                    break;

                case ".rtf":
                    Output(Aspose.Words.SaveFormat.Rtf, SFD.FileName, false);
                    break;

                default:
                    Output(Aspose.Words.SaveFormat.Doc, SFD.FileName, false);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
 private void tsb_Export_Click(object sender, EventArgs e)
 {
     Restart(false);
     SFD.Filter   = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension;
     SFD.FileName = ReportStyle.Name;
     if (SFD.InitialDirectory == null)
     {
         SFD.InitialDirectory = ReportStyle.GetPath();
     }
     if (!string.IsNullOrEmpty(SFD.FileName))
     {
         SFD.FileName = ReportStyle.Address;
     }
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         ReportStyle rs = new ReportStyle()
         {
             RSID    = ReportStyle.RSID,
             Name    = ReportStyle.Name,
             Address = ReportStyle.Address,
             MRLCode = ReportStyle.MRLCode,
             Css     = ReportStyle.Css,
             Script  = ReportStyle.Script,
             Extra   = ReportStyle.Extra
         };
         MiMFa_IOService.SaveSerializeFile(SFD.FileName, rs);
     }
 }
Ejemplo n.º 3
0
        private void backupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var Node = GetSelectedFile();

            if (Node != null)
            {
                SFD.FileName = Node.Text + ".sav.gz";
                if (SFD.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        double Perc = 0;
                        using (var IN = File.OpenRead(GetName(Node)))
                        {
                            Perc = IN.Length;
                            using (var FS = File.Create(SFD.FileName))
                            {
                                using (var OUT = new GZipStream(FS, CompressionLevel.Optimal, true))
                                {
                                    IN.CopyTo(OUT);
                                }
                                Perc = FS.Position / Perc * 100;
                            }
                        }
                        MessageBox.Show($"Backup complete. Reduced to {Math.Round(Perc)}% of original size", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception ex)
                    {
                        Log.Write(new Exception("Unable to perform a backup", ex));
                        Tools.E($"Unable to back up your savegame\r\n{ex.Message}", "Backup Error");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void saveAsBtn_Click(object sender, EventArgs e)
        {
            double[,] A;
            double[,] B;
            DialogResult Result;

            DGV1.EndEdit();
            DGV2.EndEdit();
            A      = ReadFromDGV(ref DGV1);
            B      = ReadFromDGV(ref DGV2);
            Result = SFD.ShowDialog();
            try
            {
                if (Result == DialogResult.OK)
                {
                    File.Delete(SFD.FileName);
                    StreamWriter FileFromTable = new StreamWriter(SFD.FileName);
                    SaveFileStream(A, B, FileFromTable);
                    CurrentOpenFileName      = SFD.FileName;
                    this.saveBtn.Enabled     = true;
                    MatrixUnsavedChangesDone = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Cursor = Cursors.Arrow;
            }
        }
Ejemplo n.º 5
0
 private void CalculateButton_Click(object sender, EventArgs e)
 {
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         Tree.CalcPaths(bakaut, SFD.FileName);
     }
 }
Ejemplo n.º 6
0
 private void saveBtn_Click(object sender, EventArgs e)
 {
     double[,] A, B;
     DGV1.EndEdit();
     DGV2.EndEdit();
     A = ReadFromDGV(ref DGV1);
     B = ReadFromDGV(ref DGV2);
     if (CurrentOpenFileName == "")
     {
         SFD.ShowDialog();
         CurrentOpenFileName = SFD.FileName;
     }
     try
     {
         File.Delete(CurrentOpenFileName);
         StreamWriter FileFromTable = new StreamWriter(CurrentOpenFileName);
         SaveFileStream(A, B, FileFromTable);
         MatrixUnsavedChangesDone = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Cursor = Cursors.Arrow;
     } // : DGV1.BackgroundColor = Color.LightGreen
 }
Ejemplo n.º 7
0
        private void BSave_Click(object sender, EventArgs e)//кнопка Сохранить игру
        {
            Timer.Enabled = false;

            //SFD.InitialDirectory = Application.StartupPath + @"\Saves";
            if (SFD.ShowDialog() == DialogResult.OK)
            {
                string save = "";

                for (int i = 0; i < startVals.Length; i++)
                {
                    save += startVals[i].val;
                    save += startVals[i].x;
                    save += startVals[i].y;
                }

                save += '!' + Convert.ToString(mytimer.time) + '!' + LDiff.Text + '!';;

                for (int i = 0; i < 9; i++)
                {
                    for (int j = 0; j < 9; j++)
                    {
                        save += Convert.ToInt32(kod.GetValue(j, i));
                    }
                }

                File.WriteAllText(@SFD.FileName, save);
                MessageBox.Show("Игра сохранена в файл \"" + SFD.FileName + "\"!");
            }
            OFD.FileName = "";

            Timer.Enabled = true;
        }
Ejemplo n.º 8
0
        private void toolStripButtonExportar_Click(object sender, EventArgs e)
        {
            SFD.FileName = $"Fundos conta {ContaAtual.Apelido}";
            if (SFD.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            var pck = new ExcelPackage(new FileInfo(SFD.FileName));

            var source = _chkShowAll.Checked ? ContaAtual.Fundos : ContaAtual.FundosNaoZerado;

            CriaPlanilhaResumo(pck, source);

            foreach (var fundo in source)
            {
                CriaPlanilhaFundo(pck, fundo);
            }

            pck.Save();
            if (MessageBox.Show("Dados exportados. Deseja abrir planilha?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                System.Diagnostics.Process.Start(SFD.FileName);
            }
        }
Ejemplo n.º 9
0
 private void exportPagesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         SaveMacros(SFD.FileName);
     }
 }
Ejemplo n.º 10
0
 private void btnBrowseOut_Click(object sender, EventArgs e)
 {
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         tbOutfile.Text = SFD.FileName;
     }
 }
Ejemplo n.º 11
0
        private void ExportDataIntoNotepad(long serialNo, int serialNoCount)
        {
            try
            {
                DialogResult result = SFD.ShowDialog();
                if (result == DialogResult.OK)
                {
                    if (File.Exists(SFD.FileName + ".txt"))
                    {
                        File.Delete(SFD.FileName);
                    }

                    StreamWriter sw = new StreamWriter(SFD.FileName + ".txt");
                    sw.WriteLine("Serial Number");
                    for (int i = 0; i < serialNoCount; i++)
                    {
                        sw.WriteLine(++serialNo);
                    }

                    sw.Close();

                    MessageBox.Show($"The {serialNoCount} serial Number are write into the file..");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception : " + ex.Message);
            }
        }
Ejemplo n.º 12
0
 private void button2_Click(object sender, EventArgs e)
 {
     SFD.Filter = "Файлы Excel (*.xls; *.xlsx) | *.xls; *.xlsx";
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         Microsoft.Office.Interop.Excel._Application app       = new Microsoft.Office.Interop.Excel.Application();
         Microsoft.Office.Interop.Excel._Workbook    workbook  = app.Workbooks.Add(Type.Missing);
         Microsoft.Office.Interop.Excel._Worksheet   worksheet = null;
         app.Visible           = true;
         worksheet             = workbook.ActiveSheet;
         worksheet.Name        = "Выручка";
         worksheet.Cells[1, 1] = "Выручка";
         for (int i = 1; i < dataGridView1.Columns.Count + 1; i++)
         {
             worksheet.Cells[2, i]            = dataGridView1[i - 1, 0].Value;
             worksheet.Columns[i].ColumnWidth = 30;
         }
         for (int i = 1; i < dataGridView1.RowCount; i++)
         {
             for (int j = 0; j < dataGridView1.ColumnCount; j++)
             {
                 worksheet.Cells[i + 2, j + 1] = dataGridView1[j, i].Value;
             }
         }
         workbook.SaveAs(SFD.FileName, Type.Missing, Type.Missing,
                         Type.Missing, Type.Missing, Type.Missing,
                         Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, Type.Missing,
                         Type.Missing, Type.Missing, Type.Missing);
         app.Quit();
     }
 }
Ejemplo n.º 13
0
        private void buttonExport_Click(object sender, EventArgs e)
        {
            var fInfo = new FileInfo(_saveAs);

            SFD.InitialDirectory = fInfo.DirectoryName;
            SFD.FileName         = fInfo.Name;
            SFD.CheckFileExists  = false;
            SFD.OverwritePrompt  = true;

            if (SFD.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            _saveAs        = SFD.FileName;
            Cursor.Current = Cursors.WaitCursor;

            if (_exportador.Exporter())
            {
                MessageBox.Show($@"{bsPesquisa.CurrencyManager.Count} registros exportados.",
                                this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            Cursor.Current = Cursors.Default;
        }
Ejemplo n.º 14
0
        private void btnBackup_Click(object sender, EventArgs e)
        {
            const string ExportAlert =
                "You're about to export at least one RSA key that has private key information.\r\n" +
                "Under no circumstances should you share those keys with anybody, regardless of what they tell you.\r\nContinue?";

            if (lvRSA.SelectedItems.Count > 0)
            {
                var Keys = lvRSA.SelectedItems
                           .OfType <ListViewItem>()
                           .Where(m => m.Tag != null)
                           .Select(m => (RSAKey)m.Tag)
                           .ToArray();
                if (Keys.Length == 0)
                {
                    Program.AlertMsg("You can't export administratively added keys");
                    return;
                }
                if (!Keys.Any(m => RSAEncryption.HasPrivateKey(m.Key)) || Program.AlertMsg(ExportAlert, true) == DialogResult.Yes)
                {
                    if (lvRSA.SelectedItems.Count == 1)
                    {
                        SFD.FileName = Tools.SanitizeName(Keys[0].Name + ".rsa");
                        if (SFD.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                System.IO.File.WriteAllText(SFD.FileName, Keys[0].ToXML());
                            }
                            catch (Exception ex)
                            {
                                Program.ErrorMsg("Unable to back up your key. Error:\r\n" + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        if (FBD.ShowDialog() == DialogResult.OK)
                        {
                            foreach (var K in Keys)
                            {
                                try
                                {
                                    System.IO.File.WriteAllText(Tools.UniqueName(FBD.SelectedPath, Tools.SanitizeName(K.Name + ".rsa")), K.ToXML());
                                }
                                catch (Exception ex)
                                {
                                    Program.ErrorMsg($"Unable to back up your key named {K.Name}. Error:\r\n{ex.Message}");
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                Program.AlertMsg("Please select at least one key");
            }
        }
Ejemplo n.º 15
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            const string ExportAlert =
                "You're about to export only the public RSA key parts.\r\n" +
                "This key will allow encryption only and is meant for sharing with other people and not creating backups.\r\n" +
                "Continue?";

            if (lvRSA.SelectedItems.Count > 0)
            {
                var Keys = lvRSA.SelectedItems
                           .OfType <ListViewItem>()
                           .Where(m => m.Tag != null)
                           .Select(m => RSAEncryption.StripPrivate((RSAKey)m.Tag))
                           .ToArray();
                if (Keys.Length > 0 && Program.AlertMsg(ExportAlert, true) == DialogResult.Yes)
                {
                    if (lvRSA.SelectedItems.Count == 1)
                    {
                        SFD.FileName = Tools.SanitizeName(Keys[0].Name + ".rsa");
                        if (SFD.ShowDialog() == DialogResult.OK)
                        {
                            try
                            {
                                System.IO.File.WriteAllText(SFD.FileName, Keys[0].ToXML());
                            }
                            catch (Exception ex)
                            {
                                Program.ErrorMsg("Unable to export your key. Error:\r\n" + ex.Message);
                            }
                        }
                    }
                    else
                    {
                        if (FBD.ShowDialog() == DialogResult.OK)
                        {
                            foreach (var K in Keys)
                            {
                                try
                                {
                                    System.IO.File.WriteAllText(Tools.UniqueName(FBD.SelectedPath, Tools.SanitizeName(K.Name + ".rsa")), K.ToXML());
                                }
                                catch (Exception ex)
                                {
                                    Program.ErrorMsg($"Unable to export your key named {K.Name}. Error:\r\n{ex.Message}");
                                }
                            }
                        }
                    }
                }
                else if (Keys.Length == 0)
                {
                    Program.AlertMsg("You can't export administratively added keys");
                }
            }
            else
            {
                Program.AlertMsg("Please select at least one key");
            }
        }
Ejemplo n.º 16
0
 private void PurchaseHistoryReportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SFD.Filter   = "PDF файл|*.pdf";
     SFD.Title    = "Сохранить отчет по продажам";
     SFD.FileName = "Отчет по продажам на " + FormatDate.GetNowDate();
     SavingFile   = "PurchaseHistoryReport";
     SFD.ShowDialog();
 }
Ejemplo n.º 17
0
 private void ShipmentReportToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SFD.Filter   = "PDF файл|*.pdf";
     SFD.Title    = "Сохранить отчет по товарам";
     SFD.FileName = "Отчет по товарам на " + FormatDate.GetNowDate();
     SavingFile   = "ShipmentReport";
     SFD.ShowDialog();
 }
Ejemplo n.º 18
0
 private void btnDestinition_Click(object sender, EventArgs e)
 {
     SFD.FileName = ofd.SafeFileName;
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         txtDestinition.Text = SFD.FileName;
     }
 }
Ejemplo n.º 19
0
 private void btnSaveFileBrw_Click(object sender, EventArgs e)
 {
     SFD.Filter = "All types(*.*)|*.*";
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         txtSaveFile.Text = SFD.FileName;
     }
 }
Ejemplo n.º 20
0
 private void CreateBackupToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SFD.Filter   = "XML файл|*.xml";
     SFD.Title    = "Сохранить резервную копию";
     SFD.FileName = "Backup" + FormatDate.GetNowDate();
     SavingFile   = "Backup";
     SFD.ShowDialog();
 }
Ejemplo n.º 21
0
 private void tsSaveAs_Click(object sender, EventArgs e)
 {
     SFD.Filter   = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
     SFD.FileName = Path.Combine(ImageFolder, "Annotations.xml");
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         SaveAnnotations(SFD.FileName);
     }
 }
Ejemplo n.º 22
0
 private void SaveFileBtn_Click(object sender, EventArgs e)
 {
     SFD.Filter = "Текстовые файлы (*.txt)|*.txt";
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         string safname = SFD.FileName;
         graph.SaveGraph(safname);
     }
 }
Ejemplo n.º 23
0
 private void tsExport_Click(object sender, EventArgs e)
 {
     SFD.Filter           = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
     SFD.InitialDirectory = ImageFolder;
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         ExportAnnotations(SFD.FileName);
     }
 }
Ejemplo n.º 24
0
        private void Save_Click(object sender, EventArgs e)
        {
            string   text = "", date, locked = "", active = "", doings = "";
            DateTime now = DateTime.Now;

            date = now.ToString("D");
            for (int i = 0; i < active_admins.Items.Count; i++)
            {
                active = active + active_admins.Items[i].Text + "\n";
            }

            for (int i = 0; i < Locked.Items.Count; i++)
            {
                locked = locked + Locked.Items[i].Text + "\n";
            }

            foreach (var item in this.doings.Items)
            {
                doings = doings + item + "\n";
            }

            text = date + "\n" + "\n" + "Активные администраторы:" + "\n" + "\n" + active + "\n" + "\n" + "Заблокированные администраторы:" + "\n" + "\n" + locked + "\n";
            if (doings != "")
            {
                text = text + "Последние действия:" + "\n" + "\n" + doings;
            }
            foreach (Control control in report.Controls)
            {
                if (control is RadioButton)
                {
                    RadioButton rb = control as RadioButton;
                    if (rb.Checked)
                    {
                        switch (rb.Text)
                        {
                        case "*.doc":
                            SFD.Filter = "документы Word|*.doc";
                            break;

                        case "*.csv":
                            SFD.Filter = "CSV UTF-8 (разделитель - запятая)|*.csv";
                            break;

                        case "*.txt":
                            SFD.Filter = "Текстовые файлы | *.txt";
                            break;
                        }
                    }
                }
            }
            if (SFD.ShowDialog() == DialogResult.OK)
            {
                string filename = SFD.FileName;
                System.IO.File.WriteAllText(filename, text, Encoding.UTF8);
                MessageBox.Show("Ваш файл сохранен!");
            }
        }
Ejemplo n.º 25
0
 private void pDFToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SFD.Filter   = "Adobe Acrobat Reader File (*.pdf) | *.pdf";
     SFD.FileName = "Log";
     if (SFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(SFD.FileName))
     {
         Output(Aspose.Words.SaveFormat.Pdf, SFD.FileName, false);
     }
 }
Ejemplo n.º 26
0
 private void imageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SFD.Filter   = @"JPEG File (*.jpeg, *.jpg) | *.jpg | PNG File (*.png) | *.png | BMP File (*.bmp) | *.bmp | TIFF File (*.tif, *.tiff) | *.tiff | GIF File (*.gif) | *.gif | EMF File (*.emf) | *.emf ";
     SFD.FileName = "Log";
     if (SFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(SFD.FileName))
     {
         MiMFa_Convert.ToImage(this.Browser.DocumentText, SFD.FileName, Browser.Document.Body.ScrollRectangle.Size, false);
     }
 }
Ejemplo n.º 27
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (SFD.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            m_SaveFile = SFD.FileName;
            SaveFile();
        }
Ejemplo n.º 28
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (SFD.ShowDialog() == DialogResult.OK)
     {
         tbOutput.Text = SFD.FileName;
         if (!string.IsNullOrEmpty(tbLinks.Text) && MessageBox.Show("Save the existing list?", "Save list", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             SaveList();
         }
     }
 }
Ejemplo n.º 29
0
 private void MS_File_Save_Click(object sender, System.EventArgs e)
 {
     SFD.FileName     = "";
     SS_LBStatus.Text = "圖片儲存中";
     if (RImg != null && !XProcessing && SFD.ShowDialog() == DialogResult.OK)
     {
         string filepath = SFD.FileName;
         RImg.Save(filepath, ImageFormat.Tiff);
         SS_LBStatus.Text = "成功儲存圖片";
     }
 }
Ejemplo n.º 30
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         SFD.Filter = "txt files(*.txt)|*.txt|all files(*.*)|*.*";
         if (SFD.ShowDialog() == DialogResult.OK)
         {
             File.WriteAllText(SFD.FileName, txtResult.Text);
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }