Exemplo n.º 1
0
        private void Changesaveasbtn_Click(object sender, EventArgs e)
        {
            string exc1 = Path.GetExtension(FileSelectiontxt.Text);

            MainSaveFileDialog.FileName = "CorruptedFile" + exc1;
            if (MainSaveFileDialog.ShowDialog() != DialogResult.Cancel)
            {
                SaveasTxt.Text = MainSaveFileDialog.FileName;
            }
        }
Exemplo n.º 2
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (MainSaveFileDialog.ShowDialog() == DialogResult.OK)
         {
             SavingAndLoading.SaveNetwork(MainSaveFileDialog.FileName, network);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemplo n.º 3
0
 private void PlaceInfo_SaveCurrentDataButton_Click(object sender, EventArgs e)
 {
     try {
         MainSaveFileDialog.Title    = "Сохранение файла с данными";
         MainSaveFileDialog.FileName = "";
         MainSaveFileDialog.Filter   = "Текстовый файл|*.txt|Все файлы|*.*";
         if (MainSaveFileDialog.ShowDialog() == DialogResult.OK)
         {
             PlaceInfoHelper.SaveTextFile(MainSaveFileDialog.FileName, PlaceInfo_CurrentDataBox.Text);
         }
     }
     catch (Exception ex) {
         AppHelper.CreateMessage(ex.ToString(), Feodosiya.Lib.Logs.MessageType.Error, true);
     }
 }
Exemplo n.º 4
0
        protected virtual void SaveImage(Image image)
        {
            if (image == default)
            {
                return;
            }

            MainSaveFileDialog.FileName = string.Empty;

            if (MainSaveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                var extension = Path.GetExtension(MainSaveFileDialog.FileName).ToLowerInvariant()
                                .Replace(".", string.Empty).Replace("ico", "icon").Replace("jpg", "jpeg").Replace("tif", "tiff");;

                var imageFormatProperty = typeof(ImageFormat).GetProperties(BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty)
                                          .FirstOrDefault(p => p.Name.ToLowerInvariant() == extension);

                if (imageFormatProperty == default)
                {
                    MessageBox.Show(this, string.Format("Unable to save the image in {0} format. Save as BMP.", extension.ToUpperInvariant()), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                var imageFormat = imageFormatProperty != default ? (ImageFormat)imageFormatProperty.GetValue(default, default) : ImageFormat.Bmp;