private string SelectFile() { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); DateTime dt = DateTime.Now; string ext = Cipher.Decrypt("bTbP/Mhm7Iqnec4TfSWxXA==", CipherPwd); dlg.FileName = String.Format("{0}_{1}_{2}", dt.Day, dt.Month, dt.Year); dlg.AddExtension = true; dlg.DefaultExt = ext; // Default file extension string filterCiphered = CodeBehindStringResolver. Resolve(Cipher.Decrypt("khCQHwVb07U/yyMAMJZycg==", CipherPwd)); dlg.Filter = Cipher.Decrypt(filterCiphered, CipherPwd); Nullable <bool> result = dlg.ShowDialog(); if (result == true) { return(dlg.FileName); } return(String.Empty); }
private void CheckClicked(object sender, RoutedEventArgs e) { Disable(); vinOnCheck = textBoxVin.Text; if (!VinValidator.Validate(vinOnCheck)) { textBlockCheckResult.Foreground = new SolidColorBrush(Colors.Red); textBlockCheckResult.Text = CodeBehindStringResolver.Resolve( "IncorrectVinErrorText"); Enable(); return; } Manufacturer?manuf = VinValidator.GetManufacturer(vinOnCheck); if (manuf == null) { textBlockCheckResult.Foreground = new SolidColorBrush(Colors.Red); textBlockCheckResult.Text = CodeBehindStringResolver.Resolve( "UnsupportedManufacturerErrorText"); Enable(); } VtsWebServiceClient service = new VtsWebServiceClient(); service.GetVehicleInformationByVinCompleted += ServiceOnGetVehicleInformationByVinCompleted; service.GetVehicleInformationByVinAsync(vinOnCheck); }
private void MessagesRetrievedCallback(object o, GetDesktopMessagesCompletedEventArgs e) { messages.Clear(); if (e.Error != null) { ErrorWindow w = new ErrorWindow(e.Error, e.Error.Message); w.Show(); } else { IList <string> result = e.Result; if (result.Count == 0) { DisplayEmptyView(); } else { int number = 0; foreach (string s in result) { messages.Add(s); SystemMessageItemControl itemControl = new SystemMessageItemControl(); itemControl.Tag = number; itemControl.Click += ItemClicked; itemControl.SetCaption((number + 1).ToString(CultureInfo.InvariantCulture)); stackPanelMessageItems.Children.Add(itemControl); } textBlockMessageText.Text = CodeBehindStringResolver.Resolve(messages[0]); } } }
public bool CheckDataConsistency() { if (selectedType == null) { ErrorMessage = CodeBehindStringResolver.Resolve( "VehicleEventTypeNotSelectedErrorMessage"); CheckingInProgress = false; return(false); } if (Mileage == 0) { ErrorMessage = CodeBehindStringResolver.Resolve( "VehicleEventMileageNotSetErrorMessage"); CheckingInProgress = false; return(false); } if (Mileage > vehicle.Mileage) { ErrorMessage = CodeBehindStringResolver. Resolve("MileageShouldNoBeMoreThanCurrentErrorMessage"); CheckingInProgress = false; return(false); } if (UseRecurring && Mileage + MileageUntilChange < vehicle.Mileage) { ErrorMessage = CodeBehindStringResolver.Resolve( "PlannedNextReplacementAppearsInThePastErrorMessage"); CheckingInProgress = false; return(false); } return(true); }
private void UpdateCurrentMessageText() { if (messages.Count > 0) { textBlockMessageText.Text = CodeBehindStringResolver. Resolve(messages[currentSelectedNumber]); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string resourceKey = parameter.ToString(); string format = CodeBehindStringResolver.Resolve(resourceKey); return(String.Format(format, value)); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { AnalyticItemSettingsReliability reliability = (AnalyticItemSettingsReliability)value; string key = String.Format("Reliability{0}DisplayName", reliability); return(CodeBehindStringResolver.Resolve(key)); }
private void Success() { string dataDeletedHeader = CodeBehindStringResolver.Resolve("DataDeletedText"); string dataDeletedText = CodeBehindStringResolver.Resolve("SelectedDataDeletedText"); MessageBox.Show(dataDeletedHeader, dataDeletedText, MessageBoxButton.OK); }
public IEnumerable <string> GetUnsupportedFileNames() { if (Directory.Exists(dataDirectory.FullName)) { IEnumerable <FileInfo> xmlFiles = dataDirectory.EnumerateFiles("*.xml"); foreach (FileInfo xmlFile in xmlFiles) { // collecting unsupported graphical data string csvFileName = xmlFile.FullName.Replace(".xml", ".csv"); LexiaGraphSessionRawData data = LexiaScanDataFactory.CreateWithCsv( xmlFile.FullName, csvFileName); foreach (LexiaChannelRawData lcrData in data.Channels) { if (LexiaChannelDataTypeMapper. GetTypeEnum(lcrData.Header.Mnemocode) == LexiaChannelType.NOT_SUPPORTED) { yield return(xmlFile.FullName); yield return(csvFileName); } } } } if (Directory.Exists(lexiaInstallationDisk + tracesDataDirectory)) { LexiaPointTypeDataRetriever retr = new LexiaPointTypeDataRetriever( lexiaInstallationDisk + tracesDataDirectory); foreach (FileInfo traceFile in retr.GetTraceFiles()) { TraceFactory factory = new TraceFactory(traceFile); LexiaTrace trace = factory.Create(); trace.SourceFilePath = traceFile.FullName; if (trace.ParameterSets.Any(ps => ps.Parameters. Any(p => p.Type == PsaParameterType.Unsupported)) || trace.ParameterSets. Any(ps => ps.Name == CodeBehindStringResolver. Resolve("UnsupportedDataSet"))) { yield return(traceFile.FullName); foreach (string additionalFileName in retr.GetAdditionalTraceTxtData(traceFile.FullName)) { yield return(additionalFileName); } } } } }
private static TextBlock CreateNoConnectionStubTextBlock() { TextBlock tb = new TextBlock(); tb.Margin = new Thickness(10); tb.TextWrapping = TextWrapping.Wrap; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.VerticalAlignment = VerticalAlignment.Center; tb.Text = CodeBehindStringResolver.Resolve( "CannotGetDataWithoutNetworkConnectionAndUserLogged"); return(tb); }
private void GoToMonitor(object sender, RoutedEventArgs e) { string linkToVts = CodeBehindStringResolver.Resolve("MonitorLink"); string error = BrowserCaller.GoToLink(linkToVts); if (!String.IsNullOrEmpty(error)) { Log.Error(error); ErrorWindow wnd = new ErrorWindow(error); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } }
private void WikiButtonClick(object sender, RoutedEventArgs e) { string linkToWiki = CodeBehindStringResolver.Resolve("WikiLinkDataUpload"); string error = BrowserCaller.GoToLink(linkToWiki); if (!String.IsNullOrEmpty(error)) { Log.Error(error); ErrorWindow wnd = new ErrorWindow(error); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } }
private void ButtonApplyOnClick( object sender, RoutedEventArgs routedEventArgs) { if (!float.TryParse( controlDisplaySettings.textBlockDiscretionValue.Text, NumberStyles.Float, CultureInfo.InvariantCulture, out discretion)) { string message = CodeBehindStringResolver.Resolve( "IncorrectDiscretionValueMessage"); MessageBox.Show(message); return; } IDictionary <string, long> distribution = GetDistribution(); controlGraphicalRepresentation.DisplayDistribution(distribution); }
private string FormatEventDisplayInfo() { const string format = "{0} {1} {2} {3}"; if (MileageLeftUntilChange < 0) { return(String.Format(format, SelectedType.DisplayName, CodeBehindStringResolver.Resolve("ExpiredText"), MileageLeftUntilChange * -1, CodeBehindStringResolver.Resolve("UnitsKm"))); } return(String.Format(format, SelectedType.DisplayName, CodeBehindStringResolver.Resolve("InPeriodText"), MileageLeftUntilChange, CodeBehindStringResolver.Resolve("UnitsKm"))); }
private string SelectOutputFile() { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.DefaultExt = CodeBehindStringResolver. Resolve( Cipher.Decrypt("Ynbz6JPcC3pNwhk9VU+fegAwfFwG8FxFGBDVQ3pcRWA=", "5c3a7443-d013-4e0b-a61d-4ceede81e581")); // ExportedDataExtension dlg.Filter = CodeBehindStringResolver. Resolve( Cipher.Decrypt("6r+CAEGiPIzlOssxNsl1XqOUOxPJ3+1T0vXvsvJdzD8=", "5c3a7443-d013-4e0b-a61d-4ceede81e581")); Nullable <bool> result = dlg.ShowDialog(); if (result == true) { return(dlg.FileName); } return(null); }
private void DisplayElementDescription(AnalyticItemViewModel item) { if (item == null) { textBlockItemInformation.Text = String.Empty; textBlockReliability.Text = String.Empty; stackPanelReliability.Visibility = Visibility.Collapsed; return; } textBlockItemInformation.Visibility = Visibility.Visible; string typeFormat = "AnalyticItemDescriptionText{0}{1}"; string keyType = item.Model.GetType().Name; string additionalKey = item.Model.AdditionalInfo; textBlockItemInformation.Text = CodeBehindStringResolver.Resolve( String.Format(typeFormat, keyType, additionalKey)); string key = String.Format("Reliability{0}DisplayName", item.Model.Reliability); stackPanelReliability.Visibility = Visibility.Visible; textBlockReliability.Text = CodeBehindStringResolver.Resolve(key); }
private void ServiceOnGetVehicleInformationByVinCompleted(object sender, GetVehicleInformationByVinCompletedEventArgs ea) { VehicleInformation info = VehicleInformationAssembler. FromDtoToDomainObject(ea.Result); if (ea.Error is NotSupportedException) { textBlockCheckResult.Foreground = new SolidColorBrush(Colors.Red); textBlockCheckResult.Text = CodeBehindStringResolver.Resolve( "UnfortunatelyVehicleIsNotSupportedMessage"); Enable(); return; } if (ea.Error is NoInfoForVinException) { textBlockCheckResult.Foreground = new SolidColorBrush(Colors.Red); textBlockCheckResult.Text = CodeBehindStringResolver.Resolve( "NoInformationForThisVin"); Enable(); return; } if (ea.Error != null) { OnError(ea.Error, ea.Error.Message); } string recognizedInfo = String.Format("{0}: {1}, {2}: {3}", CodeBehindStringResolver.Resolve("VehicleRecognizedText"), info.VehicleModel, CodeBehindStringResolver.Resolve("EngineText"), info.Engine.DisplayName); textBlockCheckResult.Foreground = new SolidColorBrush(Colors.Green); textBlockCheckResult.Text = recognizedInfo; Enable(); }
private void OnExported(bool success, string pathOrErrorMessage) { if (success) { DataExportedInformationalWindow window = new DataExportedInformationalWindow(); window.Owner = (Window)MainWindowKeeper.MainWindowInstance; window.ShowDialog(); } else { MessageBox.Show((Window)MainWindowKeeper.MainWindowInstance, String.Format("{0}:\r\n{1}", //DataExportFailedMessage CodeBehindStringResolver.Resolve(Cipher.Decrypt("CqMEEckaxjfkk/gksV0oRWZxBgfn8ILeo5/aNOUcmxI=", "5c3a7443-d013-4e0b-a61d-4ceede81e581")), pathOrErrorMessage), //DataExportText CodeBehindStringResolver.Resolve(Cipher.Decrypt("l3GDl+UGFCDfn2Knn5k1zg==", "5c3a7443-d013-4e0b-a61d-4ceede81e581")), MessageBoxButton.OK, MessageBoxImage.Error); } }
private void SelectFile(object arg) { string fileMask = "(.vts)|*.vts"; string diagDataString = CodeBehindStringResolver.Resolve("DiagnosticData"); OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = String.Format("{0} {1}", diagDataString, fileMask); Nullable <bool> result = dlg.ShowDialog(); if (result == true) { FileStream fileStream = dlg.File.OpenRead(); CurrentSelectedFile = dlg.File.Name; perVeh.Clear(); IsWaitingMode = true; BackgroundWorker worker = new BackgroundWorker(); worker.DoWork += ProcessUploadedFile; worker.RunWorkerCompleted += OnFileProcessingComplete; worker.RunWorkerAsync(fileStream); } }
private void UpdatePrePostPagesNames() { if (prePagesHistory.Count == 0) { textBlockBackwards.Text = CodeBehindStringResolver.Resolve( "BackText"); } else { string prePageName = prePagesHistory.Peek().Header; textBlockBackwards.Text = prePageName; } if (postPagesHistory.Count == 0) { textBlockForward.Text = CodeBehindStringResolver.Resolve( "ForwardText"); } else { string postPageName = postPagesHistory.Peek().Header; textBlockForward.Text = postPageName; } }
private void OnCharacteristicsRetrieved(object sender, RunWorkerCompletedEventArgs e) { characteristicsGetterWorker.DoWork -= GetCharacteristicsInBackground; characteristicsGetterWorker.RunWorkerCompleted -= OnCharacteristicsRetrieved; if (e.Cancelled) { contentControlVehicleCharacteristics.Content = null; return; } VehicleCharacteristics chars = e.Result as VehicleCharacteristics; if (chars == null) { contentControlVehicleCharacteristics.Content = CodeBehindStringResolver.Resolve("CanNotGetVehicleCharacteristics"); return; } VehicleCharacteristicsViewModel vm = new VehicleCharacteristicsViewModel(chars); VehicleCharacteristicsControl control = new VehicleCharacteristicsControl(vm); contentControlVehicleCharacteristics.Content = control; }
public static VehicleCharacteristics Get(string vin) { SupportedLanguage currentLang = TranslationManager.Instance.CurrentLanguageEnum; string vinU = vin.ToUpper(); if (cache.ContainsKey(vinU) && cache[vinU].ContainsKey(currentLang)) { return cache[vinU][currentLang]; } else { VtsWebServiceClient client = new VtsWebServiceClient(); try { VehicleCharacteristicsDto resultDto = client.GetVehicleCharacteristics(vinU, (int)TranslationManager.Instance.CurrentLanguageEnum); VehicleCharacteristics result = VehicleCharacteristicsAssembler.FromDtoToDomainObject(resultDto); if (result == null) { return null; } if (!cache.ContainsKey(vinU)) { cache[vinU] = new Dictionary<SupportedLanguage, VehicleCharacteristics>(); } cache[vinU][currentLang] = result; return cache[vinU][currentLang]; } catch (Exception e) { Log.Error(e, CodeBehindStringResolver.Resolve("CouldNotGetVehicleCharacteristicsMessage")); return null; } } }
private void ShowIncorrectCredentialsText() { MessageText = CodeBehindStringResolver.Resolve( "IncorrectUserCredentialsMessage"); }
private void ExportUnrecognized() { UnrecognizedDataExportTypeSelectionWindow w = new UnrecognizedDataExportTypeSelectionWindow(); w.Owner = MainWindowKeeper.MainWindowInstance as Window; bool?result = w.ShowDialog(); if (result.HasValue && result.Value) { if (w.IsManually) { string file = SelectFile(); if (String.IsNullOrEmpty(file)) { return; } UnrecognizedDataKeeper.ExportUnrecognizedData(file); UnrecognizedDataExportedWindow window = new UnrecognizedDataExportedWindow(); window.Owner = MainWindowKeeper.MainWindowInstance as Window; window.ShowDialog(); } else if (w.IsAutomatically) { Stream dataStream = null; MemoryStream str = null; try { dataStream = UnrecognizedDataKeeper.GetDataStream(); str = new MemoryStream(); dataStream.Position = 0; dataStream.CopyTo(str); str.Position = 0; } catch (Exception) { if (dataStream != null) { dataStream.Close(); } str.Close(); throw; } try { VtsWebServiceClient client = new VtsWebServiceClient(); client.ReportUnrecognizedData(str); if (!(MainWindowKeeper.MainWindowInstance is Window)) { throw new ApplicationException("Main window should have already been here!"); } MessageBox.Show(MainWindowKeeper.MainWindowInstance as Window, CodeBehindStringResolver.Resolve( "UnrecognizedDataReportedSuccessfullyMessage"), "Success", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception e) { ErrorWindow wnd = new ErrorWindow(e, e.Message); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } } else { throw new ArgumentException(); } } }
private void Error(Exception e, string msg) { string error = CodeBehindStringResolver.Resolve("ErrorText"); MessageBox.Show(error, msg, MessageBoxButton.OK); }
private void NotifyAboutFailure() { CurrentSelectedFile = CodeBehindStringResolver.Resolve("UnableToOpenFile"); }
public static string GetName(PsaParametersSetType type) { return(CodeBehindStringResolver.Resolve(type.ToString())); }