/// <summary> /// Implement active service Command /// </summary> private void ExecuteActiveCommand(object prameter) { if (SelectedWSConnection != null) { Setting.ChangeActiveConnection(SelectedWSConnection.Url); SettingsBLL.SaveSetting(Setting); base.MessageManager.OnServiceActivated(SelectedWSConnection.Url); WSConnections = new ObservableCollection <WSConnection>(Setting.WSConnections); } }
/// <summary> /// Show Selection File Dialog /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenerateButtonClicked(object sender, RoutedEventArgs e) { ReportingVM _reportingVm = (DataContext as ReportingVM); if (_reportingVm == null) { return; } SaveFileDialog dialog = new SaveFileDialog { Filter = (_reportingVm.SelectedTemplateFile.Extension != ".xlsx") ? string.Format("*{0}, *.pdf|*{0};*.pdf", _reportingVm.SelectedTemplateFile.Extension) : string.Format("*{0}|*{0}", _reportingVm.SelectedTemplateFile.Extension), DefaultExt = _reportingVm.SelectedTemplateFile.Extension, FileName = _reportingVm.SelectedTemplateFile.Name.Replace('-', ' ') }; var settings = SettingsBLL.GetSetting(); if (string.IsNullOrEmpty(settings.ReportingParameter.TemplatePath) || !Directory.Exists(settings.ReportingParameter.TemplatePath)) { dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } else { dialog.InitialDirectory = settings.ReportingParameter.GeneratedFilePath; } var result = dialog.ShowDialog(); var _vm = (ReportingVM)DataContext; if (result != null && result.Value) { settings.ReportingParameter.GeneratedFilePath = Path.GetDirectoryName(dialog.FileName); SettingsBLL.SaveSetting(settings); if (_vm != null) { _vm.ReportFileName = dialog.FileName; } } else { if (_vm != null) { _vm.ReportFileName = string.Empty; } } }
/// <summary> /// Implement Add service Command /// </summary> public void SaveSettings() { SettingsBLL.SaveSetting(Setting); MessageManager.OnSettingsSaved(); if (Thread.CurrentThread.CurrentCulture.Name.Equals(Setting.ReportingParameter.CultureName)) { return; } Thread.CurrentThread.CurrentCulture = Culture; Thread.CurrentThread.CurrentUICulture = Culture; LangageChanged?.Invoke(this, null); }
/// <summary> /// Implement Add service Command /// </summary> public void SaveSettings() { SettingsBLL.SaveSetting(Setting); base.MessageManager.OnSettingsSaved(); if (!Thread.CurrentThread.CurrentCulture.Name.Equals(Setting.ReportingParameter.CultureName)) { Thread.CurrentThread.CurrentCulture = Culture; Thread.CurrentThread.CurrentUICulture = Culture; if (LangageChanged != null) { LangageChanged(this, null); } } }
/// <summary> /// Show Selection File Dialog /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GenerateButtonClicked(object sender, RoutedEventArgs e) { ReportingVM reportingVM = (this.DataContext as ReportingVM); SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = string.Format("*{0}|*{0}", reportingVM.SelectedTemplateFile.Extension); dialog.DefaultExt = reportingVM.SelectedTemplateFile.Extension; var settings = SettingsBLL.GetSetting(); if (string.IsNullOrEmpty(settings.ReportingParameter.TemplatePath) || !Directory.Exists(settings.ReportingParameter.TemplatePath)) { dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } else { dialog.InitialDirectory = settings.ReportingParameter.GeneratedFilePath; } var result = dialog.ShowDialog(); if (result.Value) { settings.ReportingParameter.GeneratedFilePath = Path.GetDirectoryName(dialog.FileName); SettingsBLL.SaveSetting(settings); (this.DataContext as ReportingVM).ReportFileName = dialog.FileName; } else { (this.DataContext as ReportingVM).ReportFileName = string.Empty; } }