//------------------------------------------------------------------------------------------
        private void Btn_SaveInfoIntoFile(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show("Do you want to save data in default file?", "File reading", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                var exePath = AppDomain.CurrentDomain.BaseDirectory;
                var path    = System.IO.Path.Combine(exePath, "Result.txt");

                _jsonFileService.Save(path, _elevators);
            }
            else
            {
                if (_defaultDialogService.SaveFileDialog())
                {
                    var path = _defaultDialogService.FilePath;
                    _jsonFileService.Save(path, _elevators);
                }
                else
                {
                    var exePath = AppDomain.CurrentDomain.BaseDirectory;
                    var path    = System.IO.Path.Combine(exePath, "Result.txt");
                    _jsonFileService.Save(path, _elevators);
                }
            }
        }
Exemplo n.º 2
0
 private void MenuItem2_OnClick(object sender, RoutedEventArgs e)
 {
     if (dialogService.SaveFileDialog())
     {
         fileService._Model = Items;
         fileService.CreateModel(dialogService.FilePath);
     }
 }
Exemplo n.º 3
0
        private void OnSaveAsTest()
        {
            bool?success = dialogService.SaveFileDialog("C:\\", "File (.xml)|*.xml", "Save As", true, false, true);

            if (success == true)
            {
                // Do something
                fileName = dialogService.FilePath;
                sesControl.SaveSession(fileName);
            }
        }
Exemplo n.º 4
0
 private void RibbonButtonSave_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (sesControl.session.ListOfReportOSR.Count > 0)
     {
         dialogService.SaveFileDialog();
         sesControl.SaveSession(dialogService.FilePath);
     }
     else
     {
         dialogService.ShowMessage("В сессии отсутствуют акты. Добавьте акты в комплект.");
     }
 }
Exemplo n.º 5
0
        private void ButtonSave_Click(object sender, RoutedEventArgs e)
        {
            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.SaveFileDialog())
            {
                dialogService.ShowMessage("File save!");
                EmployeViewModel.SaveToFile(dialogService.FilePath, EmployeViewModel.Employees);
            }
            else
            {
                dialogService.ShowMessage("Bad!");
            }
        }
 private void ExportAsPngFile_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (partScanView != null)
     {
         IDialog SaveFileService = new DefaultDialogService();
         var     ScanTime        = DateTime.Now;
         if (SaveFileService.SaveFileDialog(Item.Name + "_" + ScanTime.ToShortDateString().Replace(".", "_") + "_" + ScanTime.ToLongTimeString().Replace(":", "_"), "PNG files|*.png") == true)
         {
             var partScanViewBackground = partScanView.Background;
             partScanView.Background = ThemeManager.GetResource(Theme, "WindowBackgroundBrush") as SolidColorBrush;
             MemoryStream stream = new MemoryStream();
             VisualHelper.SnapShotPNG(partScanView).Save(stream);
             var image = System.Drawing.Image.FromStream(stream);
             image.Save(SaveFileService.FilePath);
             partScanView.Background = partScanViewBackground;
         }
     }
 }
 private void ExportAsHtmlFile_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (partSwitch != null)
     {
         if (partScans != null)
         {
             if (partScans.SelectedValue != null)
             {
                 IDialog SaveFileService = new DefaultDialogService();
                 var     ScanTime        = DateTime.Now;
                 if (SaveFileService.SaveFileDialog(Item.Name + "_" + ScanTime.ToShortDateString().Replace(".", "_") + "_" + ScanTime.ToLongTimeString().Replace(":", "_"), "html files|*.html") == true)
                 {
                     var result = htmlSerializer.Serialize(Item.Name, partScans.SelectedValue as ComputerHardwareScan, Pupulate(), partSwitch.SelectedItems, Item.Description, Item.Address, Item.FQDN, true);
                     File.WriteAllText(SaveFileService.FilePath, result);
                 }
             }
         }
     }
 }
Exemplo n.º 8
0
        private void SaveFile(ICollection <YDPostModel> records)
        {
            IFileService   fileService   = new CsvFileService();
            IDialogService dialogService = new DefaultDialogService();

            try
            {
                if (records == null || records.Count < 1)
                {
                    throw new Exception("Нет данных для сохранения");
                }

                if (dialogService.SaveFileDialog() == true)
                {
                    fileService.Save(dialogService.FilePath, PostToCsvConverter.Convert(records));
                    dialogService.ShowMessage("Файл сохранен");
                }
            }
            catch (Exception ex)
            {
                dialogService.ShowMessage(ex.Message);
            }
        }
Exemplo n.º 9
0
        private void SaveReportToFile()
        {
            DefaultDialogService dialogService = new DefaultDialogService();

            if (dialogService.SaveFileDialog())
            {
                if (dialogService.FileFormat == ".csv")
                {
                    FileExtension.SaveToCsvFile(dialogService.FilePath, UsersSelectionByParameters());
                }
                else if (dialogService.FileFormat == ".xml")
                {
                    FileExtension.SaveToXmlFile(dialogService.FilePath, UsersSelectionByParameters());
                }
                else
                {
                    dialogService.ShowMessage("Error saving report!");
                }
            }
            else
            {
                dialogService.ShowMessage("Error saving report!");
            }
        }