public void PerformTranslation() { var culture = Application.CurrentCulture; Text = ResourceManagerProvider.GetLocalizedString("WND_CALL_SETTINGS_FORM_TITLE", culture); lWaitCall.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_WAIT_CALL", culture)); pbWaitCall.SetHint(ResourceManagerProvider.GetLocalizedString("L_WAIT_CALL_HINT", culture)); cbSendNotification.Text = ResourceManagerProvider.GetLocalizedString("L_SEND_NOTIFICATION", culture); pbSendNotification.SetHint(ResourceManagerProvider.GetLocalizedString("L_SEND_NOTIFICATION_HINT", culture)); cbPlaySound.Text = ResourceManagerProvider.GetLocalizedString("L_PLAY_SOUND", culture); pbPlaySound.SetHint(ResourceManagerProvider.GetLocalizedString("L_PLAY_SOUND_HINT", culture)); cbRepeatable.Text = ResourceManagerProvider.GetLocalizedString("L_REPEATABLE", culture); pbRepeatable.SetHint(ResourceManagerProvider.GetLocalizedString("L_REPEATABLE_HINT", culture)); cbShutdown.Text = ResourceManagerProvider.GetLocalizedString("L_SHUTDOWN", culture); pbShutdown.SetHint(ResourceManagerProvider.GetLocalizedString("L_SHUTDOWN_HINT", culture)); lWorkingDirectory.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_WORKING_DIRECTORY", culture)); btnOpenWorkingDirectory.SetHint(ResourceManagerProvider.GetLocalizedString("BTN_OPEN_WORKING_DIRECTORY_HINT", culture)); pbWorkingDirectory.SetHint(ResourceManagerProvider.GetLocalizedString("L_WORKING_DIRECTORY_HINT", culture)); btnAddGroup.SetHint(ResourceManagerProvider.GetLocalizedString("BTN_ADD_GROUP_HINT", culture)); btnRemoveGroup.SetHint(ResourceManagerProvider.GetLocalizedString("BTN_REMOVE_GROUP_HINT", culture)); btnOk.Text = ResourceManagerProvider.GetLocalizedString("BTN_OK", culture); btnCancel.Text = ResourceManagerProvider.GetLocalizedString("BTN_CANCEL", culture); }
public static void AddLogItem(this ListBox listView, ReadPortEvent guiEvent) { string parameter; if (guiEvent.Code == ResponseCode.BLACKLISTED) { parameter = String.Format(ResourceManagerProvider.GetLocalizedString("LOG_NUMBER_BLACKLISTED", Application.CurrentCulture), guiEvent.Telephone, guiEvent.DialingSeconds, guiEvent.RingingSeconds); } else if (guiEvent.Code == ResponseCode.NO_ANSWER_MODEM) { parameter = String.Format(ResourceManagerProvider.GetLocalizedString("LOG_NUMBER_NO_ANSWER_MODEM", Application.CurrentCulture), guiEvent.Telephone, guiEvent.DialingSeconds, guiEvent.RingingSeconds); } else if (guiEvent.Code == ResponseCode.ERROR) { parameter = String.Format(ResourceManagerProvider.GetLocalizedString("LOG_NUMBER_ERROR", Application.CurrentCulture), guiEvent.Telephone, guiEvent.DialingSeconds, guiEvent.RingingSeconds); } else { parameter = String.Format(ResourceManagerProvider.GetLocalizedString("LOG_NUMBER_PROCESSED", Application.CurrentCulture), guiEvent.Telephone, guiEvent.DialingSeconds, guiEvent.RingingSeconds); } listView.AddLogItem(parameter); }
public static void AddLogItem(this ListBox listView, string message, SessionStatistics statistics) { var parameter = String.Format(ResourceManagerProvider.GetLocalizedString("LOG_STATISTICS", Application.CurrentCulture), statistics.ProcessedCount, statistics.ActivatedCount); listView.Items.Add(string.Format("{0:HH}:{0:mm}:{0:ss} - {1} {2}", DateTime.Now, message, parameter)); }
/// <summary> /// Sends SMS message /// </summary> /// <param name="telephone">Telephone number activated</param> /// <returns>Response code from modem</returns> private ResponseCode SendSms(string telephone) { //var e = ExecCommand("AT+CSCA?", Timeout, new[] { ResponseCode.OK, ResponseCode.ERROR }).Code; Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_SMS_EXECUTING", Application.CurrentCulture), telephone)); // Select SMS text mode var res = ExecCommand("AT+CMGF=1", TimeoutCommand, new[] { ResponseCode.OK, ResponseCode.ERROR }).Code; if (res == ResponseCode.OK) { res = ExecCommand(String.Format("AT+CMGS=\"{0}\"", SmsRecipient), TimeoutCommand, new[] { ResponseCode.SMS_TEXT, ResponseCode.ERROR }).Code; if (res == ResponseCode.SMS_TEXT) { var smsText = SmsText.Replace("%PHONE%", telephone); // m_port.WriteLine(m_CurTelephone + System.Environment.NewLine + (char)(26)); //return ExecCommand(telephone + char.ConvertFromUtf32(26) + "\r", 10000, new ResponseCode[] { ResponseCode.OK }); // Ctrl+z is used on keyboard to send filled up text res = ExecCommand(smsText + char.ConvertFromUtf32(26), TimeoutSms, new[] { ResponseCode.OK, ResponseCode.SMS, ResponseCode.ERROR }).Code; if (res == ResponseCode.TIMEOUT) { res = ResponseCode.OK; Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_RESPONSE_CODE_CHANGED", Application.CurrentCulture), res)); } } } else if (res == ResponseCode.TIMEOUT) { res = ResponseCode.ERROR; Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_RESPONSE_CODE_CHANGED", Application.CurrentCulture), res)); } //e = ExecCommand("AT+CMEE=305", Timeout, new[] { ResponseCode.OK, ResponseCode.ERROR }).Code; return(res); }
/// <summary> /// Check if registration is valid and check if mobile phone can support required AT commands /// </summary> private void ValidateMobile() { if (CPassword.Verify()) { if (GetIMEI() != CPassword.IMEI) { throw new Exception(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_WRONG_IMEI_REGISTRATION", Application.CurrentCulture), CPassword.User, CPassword.IMEI)); } _isIntroductoryVersion = false; } else { _isIntroductoryVersion = true; } // Check support of SMS/USSD by phone if (SendNotification || Operation == PortReaderOperation.Notification) { if (CheckSendSms() != ResponseCode.OK) { throw new Exception(ResourceManagerProvider.GetLocalizedString("MSG_SMS_NOT_SUPPORTED", Application.CurrentCulture)); } if (CheckSendUSSD() != ResponseCode.OK) { throw new Exception(ResourceManagerProvider.GetLocalizedString("MSG_USSD_NOT_SUPPORTED", Application.CurrentCulture)); } } }
private void UpdateStatusBarInfo() { var culture = Application.CurrentCulture; int seconds = 0; if (_currentSessionStatistics.Telephones != null) { seconds = _currentSessionStatistics.Telephones .Skip(_currentSessionStatistics.ProcessedCount) .SelectMany( tel => _xmlWrapper.GroupSettings.Where(g => tel.GroupName == g.GroupName) .Select(gg => gg.WaitAnswer)) .Sum(); seconds += _currentSessionStatistics.RemainedCount * _xmlWrapper.CallSettings.WaitCall; } var remainedTime = new TimeSpan(0, 0, seconds); statTelephoneCount.Text = String.Format(ResourceManagerProvider.GetLocalizedString("STAT_TELEPHONE_COUNT", culture), listTelephones.Items.Count); statTelephoneActivatedCount.Text = String.Format(ResourceManagerProvider.GetLocalizedString("STAT_TELEPHONE_ACTIVATED_COUNT", culture), listTelephones.ActivatedCount()); statRemainedTime.Text = String.Format(ResourceManagerProvider.GetLocalizedString("STAT_SESSION_REMAINED_TIME", culture), remainedTime.Hours, remainedTime.Minutes); statBar.Value = _currentSessionStatistics.ProcessedCount; statBar.ToolTipText = String.Format("{0}\t\n{1}\t\n{2}\t\n{3}\t", ResourceManagerProvider.GetLocalizedString("STAT_SESSION_HEADER", culture), String.Format(ResourceManagerProvider.GetLocalizedString("STAT_SESSION_PROCESSED_COUNT", culture), _currentSessionStatistics.ProcessedCount), String.Format(ResourceManagerProvider.GetLocalizedString("STAT_SESSION_REMAINED_COUNT", culture), _currentSessionStatistics.RemainedCount), String.Format(ResourceManagerProvider.GetLocalizedString("STAT_SESSION_ACTIVATED_COUNT", culture), _currentSessionStatistics.ActivatedCount)); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (_xmlWrapper.IsChanged) { var culture = Application.CurrentCulture; var result = MessageBox.Show(ResourceManagerProvider.GetLocalizedString("MSG_PROGRAM_DATA_CHANGED", culture), ResourceManagerProvider.GetLocalizedString("MSG_SAVE_TITLE", culture), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); switch (result) { case DialogResult.Yes: { _xmlWrapper.SaveXml(); break; } case DialogResult.No: { break; } case DialogResult.Cancel: { e.Cancel = true; break; } } } }
private ResponseExecCommand ExecCommand(string command, IEnumerable <ResponseCode> responses) { var culture = Application.CurrentCulture; _port.DiscardOutBuffer(); _port.DiscardInBuffer(); _receiveNow.Reset(); _port.Write(command + "\r"); // <CR> - should be supplied for the command to be executed Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_EXECUTED", culture), command)); Thread.Sleep(TimeoutCommand); var buffer = _port.ReadExisting(); Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_RESPONSE_AT", Application.CurrentCulture), buffer)); var res = GetResponse(buffer, responses); if (res == null) { if (String.IsNullOrEmpty(buffer)) { if (responses.Any(r => r == ResponseCode.NO_ANSWER_MODEM)) { res = new ResponseExecCommand(ResponseCode.NO_ANSWER_MODEM, buffer); } } res = new ResponseExecCommand(ResponseCode.TIMEOUT, buffer); } Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_RESPONSE_CODE", culture), res.Code)); return(res); }
private void miRegistration_Click(object sender, EventArgs e) { var passwordForm = new CKeyForm(); if (passwordForm.ShowDialog() == DialogResult.OK) { // The interruption on half of one second at registration of user data allows to avoid searching of keys in hack Thread.Sleep(500); CPassword.UpdateHash(passwordForm.Login + passwordForm.Email + passwordForm.IMEI + "'", passwordForm.Key); var culture = Application.CurrentCulture; if (CPassword.Verify()) { MessageBox.Show(ResourceManagerProvider.GetLocalizedString("MSG_REGISTRATION_SUCCESSFUL", culture), ResourceManagerProvider.GetLocalizedString("MSG_INFORMATION_TITLE", culture), MessageBoxButtons.OK, MessageBoxIcon.None); // Successful registration data CPassword.UpdateRegistrationInfo(passwordForm.Login, passwordForm.Email, passwordForm.IMEI); miRegistration.Visible = false; UpdateRegisteredUserInfo(); } else { // Wrong registration data MessageBox.Show(ResourceManagerProvider.GetLocalizedString("MSG_REGISTRATION_WRONG", culture), ResourceManagerProvider.GetLocalizedString("MSG_INFORMATION_TITLE", culture), MessageBoxButtons.OK, MessageBoxIcon.None); } } }
/// <summary> /// Check if modem is responding on AT commands and show IMEI of mobile phone /// </summary> private void CheckModemStatus() { var culture = Application.CurrentCulture; if (cbComPort.SelectedIndex == -1) { lModemConnectionStatus.Text = ResourceManagerProvider.GetLocalizedString("L_PORT_INFORMATION_MODEM_NOT_SELECTED", culture); } else { try { _portReader.PortName = _comPort; _portReader.BaudRate = _baudRate; _portReader.OpenPort(); _portReader.Initialize3GModem(); tbIEMI.Text = _portReader.GetIMEI(); _portReader.ClosePort(); lModemConnectionStatus.Text = ResourceManagerProvider.GetLocalizedString("L_PORT_INFORMATION_MODEM_SELECTED", culture); } catch (Exception ex) { _portReader.ClosePort(); tbIEMI.Text = String.Empty; lModemConnectionStatus.Text = ResourceManagerProvider.GetLocalizedString("L_PORT_INFORMATION_MODEM_NOT_ANSWERED", culture); Logger.Write(ResourceManagerProvider.GetLocalizedString("L_PORT_INFORMATION_MODEM_NOT_ANSWERED", culture) + " " + ex.Message); } } }
private void PortReader_NotificationFinishedReady(object sender, FinishPortEvent e) { var culture = Application.CurrentCulture; if (e.Exception != null) { MessageBox.Show(e.Exception.Message, ResourceManagerProvider.GetLocalizedString("MSG_ERROR_MODEM_TITLE", Application.CurrentCulture), MessageBoxButtons.OK, MessageBoxIcon.Error); // Enable gui as call process is finished SetGUIAvailableForCallProcess(true); SetCallButtonAvailability(true); } else { // Enable gui as call process is finished SetGUIAvailableForCallProcess(true); SetCallButtonAvailability(true); if (_xmlWrapper.CallSettings.PlaySound) { PlaySystemSound(); } } lbLog.AddLogItem(String.Format(ResourceManagerProvider.GetLocalizedString("LOG_NOTIFICATION_FINISHED", culture), _currentSessionStatistics.ActivatedCount)); }
/// <summary> /// Sends Unstructured Supplementary Service Data request /// </summary> /// <param name="telephone">Telephone number activated</param> /// <returns>Response code from modem</returns> private ResponseCode SendUSSD(string telephone) { Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_USSD_EXECUTING", Application.CurrentCulture), telephone)); var ussdText = UssdText.Replace("%PHONE%", telephone); var res = ExecCommand("AT+CUSD=1,\"" + ussdText + "\",15" /*+ (char)13 + (char)26*/, TimeoutUssd, new[] { ResponseCode.OK, ResponseCode.ERROR }).Code; return(res); }
public void PerformTranslation() { var culture = Application.CurrentCulture; this.Text = string.Format(ResourceManagerProvider.GetLocalizedString("WND_COMMENT_FORM_TITLE", culture), PhoneNumber); btnEnter.Text = ResourceManagerProvider.GetLocalizedString("BTN_ENTER", culture); btnCancel.Text = ResourceManagerProvider.GetLocalizedString("BTN_CANCEL", culture); }
private void GroupFilterDataBind() { var selectedCountry = _xmlWrapper.CountrySettings.First(c => c.CountryName == (string)cbCountryFilter.SelectedItem); cbGroupFilter.Items.Clear(); cbGroupFilter.Items.Add(ResourceManagerProvider.GetLocalizedString("CB_GROUP_FILTER_ALL", Application.CurrentCulture)); cbGroupFilter.Items.AddRange(_xmlWrapper.GroupSettings.Where(s => selectedCountry.GroupNameList.Contains(s.GroupName)).Select(s => s.GroupName).ToArray()); cbGroupFilter.SelectedIndex = 0; }
private void InitializeGroupsGridView() { // Set the style of Data Grid View gvGroups.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; gvGroups.SelectionMode = DataGridViewSelectionMode.FullRowSelect; gvGroups.AutoGenerateColumns = false; gvGroups.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "GroupName", Name = "GroupName" }); gvGroups.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "WaitAnswer", Name = "WaitAnswer" }); var doubleCheckOnTimeoutColumn = new DataGridViewCheckBoxColumn { DataPropertyName = "DoubleCheckOnTimeout", Name = "DoubleCheckOnTimeout" }; gvGroups.Columns.Add(doubleCheckOnTimeoutColumn); gvGroups.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "SmsRecipient", Name = "SmsRecipient" }); gvGroups.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "SmsText", Name = "SmsText" }); gvGroups.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "UssdText", Name = "UssdText" }); var notificationTypeColumn = new DataGridViewComboBoxColumn { DataSource = Enum.GetValues(typeof(NotificationType)), DataPropertyName = "NotificationType", Name = "NotificationType" }; gvGroups.Columns.Add(notificationTypeColumn); // Localization of Data Grid View var culture = Application.CurrentCulture; gvGroups.Columns["GroupName"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_GROUP_NAME", culture); gvGroups.Columns["GroupName"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_GROUP_NAME_HINT", culture); gvGroups.Columns["WaitAnswer"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_WAIT_ANSWER", culture); gvGroups.Columns["WaitAnswer"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_WAIT_ANSWER_HINT", culture); gvGroups.Columns["DoubleCheckOnTimeout"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_DOUBLE_CHECK_ON_TIMEOUT", culture); gvGroups.Columns["DoubleCheckOnTimeout"].ToolTipText = String.Format(ResourceManagerProvider.GetLocalizedString("LST_DOUBLE_CHECK_ON_TIMEOUT_HINT", culture), ResourceManagerProvider.GetLocalizedString("LST_WAIT_ANSWER", culture)); gvGroups.Columns["SmsRecipient"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_SMS_RECIPIENT", culture); gvGroups.Columns["SmsRecipient"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_SMS_RECIPIENT_HINT", culture); gvGroups.Columns["SmsText"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_SMS_TEXT", culture); gvGroups.Columns["SmsText"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_SMS_TEXT_HINT", culture); gvGroups.Columns["UssdText"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_USSD_TEXT", culture); gvGroups.Columns["UssdText"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_USSD_TEXT_HINT", culture); gvGroups.Columns["NotificationType"].HeaderText = ResourceManagerProvider.GetLocalizedString("LST_NOTIFICATION_TYPE", culture); gvGroups.Columns["NotificationType"].ToolTipText = ResourceManagerProvider.GetLocalizedString("LST_NOTIFICATION_TYPE_HINT", culture); }
private void bOk_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(tbWaitCall.Text)) { var culture = Application.CurrentCulture; var fieldWaitCall = ResourceManagerProvider.GetLocalizedString("L_WAIT_CALL", culture); MessageBox.Show(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_FIELD_EMPTY", culture), fieldWaitCall), ResourceManagerProvider.GetLocalizedString("MSG_INFORMATION_TITLE", culture), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void PerformTranslation() { var culture = Application.CurrentCulture; this.Text = ResourceManagerProvider.GetLocalizedString("WND_SEARCH_FORM_TITLE", culture); lEnterSearchedPhone.Text = ResourceManagerProvider.GetLocalizedString("L_ENTER_SEARCHED_PHONE", culture); btnSearch.Text = ResourceManagerProvider.GetLocalizedString("BTN_SEARCH", culture); btnCancel.Text = ResourceManagerProvider.GetLocalizedString("BTN_CANCEL", culture); }
public string GetIMEI() { var phoneCgsn = ExecCommand("AT+CGSN", TimeoutCommand, new[] { ResponseCode.OK, ResponseCode.ERROR }).Text; var match = _regexImei.Match(phoneCgsn.Replace(" ", "")); if (match.Success) { return(match.Groups["IMEI"].Value); } throw new Exception(ResourceManagerProvider.GetLocalizedString("MSG_IMEI_NOT_SUPPORTED", Application.CurrentCulture)); }
private void bAddGroup_Click(object sender, EventArgs e) { var smsSettings = new XmlGroupSettings(); smsSettings.GroupName = ResourceManagerProvider.GetLocalizedString("LST_GROUP_NAME_NEW", Application.CurrentCulture); smsSettings.SmsRecipient = "0000"; smsSettings.SmsText = "%PHONE%"; smsSettings.UssdText = "%PHONE%"; GroupSettings.Add(smsSettings); DataBind(); }
/// <summary> /// Function which delimits functional for user without registration /// </summary> private void ValidateIntroductoryVersion() { if (_isIntroductoryVersion) { if (_introductoryVersionCounter > 5) { throw new Exception(ResourceManagerProvider.GetLocalizedString("MSG_INTRODUCTORY_VERSION", Application.CurrentCulture)); } ++_introductoryVersionCounter; } }
private void PortReader_TelephoneFinishedReady(object sender, FinishPortEvent e) { var culture = Application.CurrentCulture; if (e.Exception != null) { MessageBox.Show(e.Exception.Message, ResourceManagerProvider.GetLocalizedString("MSG_ERROR_MODEM_TITLE", Application.CurrentCulture), MessageBoxButtons.OK, MessageBoxIcon.Error); // Enable gui as call process is finished SetGUIAvailableForCallProcess(true); SetCallButtonAvailability(true); } else { var nonActivatedList = _currentSessionStatistics.Telephones.Where(tel => !tel.IsActivated()).ToList(); // If we have to repeat call process and stop button was not pressed and list contains any not activated telephone if (_xmlWrapper.CallSettings.Repeatable && btnCall.Enabled && nonActivatedList.Any()) { StartOperation(nonActivatedList, PortReaderOperation.Call); lbLog.AddLogItem(ResourceManagerProvider.GetLocalizedString("LOG_CALL_RESTARTED", culture), _currentSessionStatistics); return; } // Enable gui as call process is finished SetGUIAvailableForCallProcess(true); SetCallButtonAvailability(true); if (_xmlWrapper.CallSettings.PlaySound) { PlaySystemSound(); } if (_xmlWrapper.CallSettings.Shutdown) { _xmlWrapper.SaveXml(); try { Process.Start("Shutdown", "-s -t 10"); } catch (Exception ex) { Logger.Write(ex.Message + ex.StackTrace); } Application.Exit(); } } lbLog.AddLogItem(ResourceManagerProvider.GetLocalizedString("LOG_CALL_FINISHED", culture), _currentSessionStatistics); }
public void PerformTranslation() { var culture = Application.CurrentCulture; this.Text = ResourceManagerProvider.GetLocalizedString("WND_ABOUT_FORM_TITLE", culture); var assembly = Assembly.GetExecutingAssembly(); var fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); lProgramVersion.Text = String.Format(ResourceManagerProvider.GetLocalizedString("L_PROGRAM_VERSION", culture), fileVersionInfo.ProductVersion); lCopyright.Text = ResourceManagerProvider.GetLocalizedString("L_COPYRIGHT", culture); lAllRightsReserved.Text = ResourceManagerProvider.GetLocalizedString("L_ALL_RIGHTS_RESERVED", culture); }
public void PerformTranslation() { var culture = Application.CurrentCulture; Text = ResourceManagerProvider.GetLocalizedString("WND_MODEM_SETTINGS_FORM_TITLE", culture); lPort.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_PORT", culture)); pbPort.SetHint(ResourceManagerProvider.GetLocalizedString("L_PORT_HINT", culture)); lPortRate.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_PORT_RATE", culture)); pbPortRate.SetHint(ResourceManagerProvider.GetLocalizedString("L_PORT_RATE_HINT", culture)); btnOk.Text = ResourceManagerProvider.GetLocalizedString("BTN_OK", culture); btnCancel.Text = ResourceManagerProvider.GetLocalizedString("BTN_CANCEL", culture); }
private ResponseCode DialUpHibryd(string telephone, ReadPortEvent guiEvent) { var res = DialUpHandler(telephone, guiEvent, "AT+CPAS", "AT+CLCC", new[] { ResponseCode.CONNECT, ResponseCode.RING, ResponseCode.NO_CARRIER, ResponseCode.NO_ANSWER_MODEM }, new[] { ResponseCode.CONNECT, ResponseCode.BUSY, ResponseCode.OK, ResponseCode.NO_ANSWER, ResponseCode.NO_CARRIER }); // In case command returns OК that means the connection line is interrupted // Если команда CLCC была выполнена, но соединений нет, то ответ не передается(мы получаем от телефона ответ ОК) if (res == ResponseCode.OK) { res = ResponseCode.NO_CARRIER; Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_COMMAND_RESPONSE_CODE_CHANGED", Application.CurrentCulture), res)); } return(res); }
public void Bind() { var sut = ResourceManagerProvider.CreateResourceManagerProvider(); var boundClass = sut.Bind <TestBindClass>( mockResourceDictionary: DictionaryBuilder .CreateBuilder <string, object>() .Add("Text", "Hello") .Add("Number", 123456) .Add("Amount", 225.89m) .ToDictionary()); Assert.Equal("Hello", boundClass.Text); Assert.Equal(123456, boundClass.Number); Assert.Equal(225.89m, boundClass.Amount); }
private void miDeleteSelected_Click(object sender, EventArgs e) { var culture = Application.CurrentCulture; if (MessageBox.Show( String.Format(ResourceManagerProvider.GetLocalizedString("MSG_DELETE_SELECTED_CONFIRMATION", culture), listTelephones.SelectedItems.Count), ResourceManagerProvider.GetLocalizedString("MSG_DELETION_TITLE", culture), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { foreach (var phoneDeleted in listTelephones.DeleteSelected()) { _xmlWrapper.TelephoneItems.Remove(_xmlWrapper.TelephoneItems.Find(x => x.Telephone == phoneDeleted)); } UpdateStatusBarInfo(); } }
public void PerformTranslation() { var culture = Application.CurrentCulture; this.Text = ResourceManagerProvider.GetLocalizedString("WND_KEY_FORM_TITLE", culture); lRegistrationWarning.Text = ResourceManagerProvider.GetLocalizedString("L_REGISTRATION_WARNING", culture); lRegistrationInvitation.Text = ResourceManagerProvider.GetLocalizedString("L_REGISTRATION_INVITATION", culture); lUser.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_REGISTERED_USER", culture)); lEmail.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_REGISTERED_EMAIL", culture)); lIMEI.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_REGISTERED_IMEI", culture)); lActivationKey.Text = String.Format("{0}:", ResourceManagerProvider.GetLocalizedString("L_REGISTERED_ACTIVATION_KEY", culture)); btnEnter.Text = ResourceManagerProvider.GetLocalizedString("BTN_ENTER", culture); btnCancel.Text = ResourceManagerProvider.GetLocalizedString("BTN_CANCEL", culture); }
/// <summary> /// It is fired just when the DataGridView is about to leave the edition mode and allows you to not accept the value /// that has been entered by the user. To reject the value entered, in the code of the event-handler, /// you must set the e.Cancel to True /// </summary> private void gvGroups_CellValidating(object sender, DataGridViewCellValidatingEventArgs e) { var culture = Application.CurrentCulture; string columnName = gvGroups.Columns[e.ColumnIndex].Name; string value = e.FormattedValue.ToString(); if (columnName.Equals("GroupName")) { // Confirm that the cell is not empty. if (string.IsNullOrEmpty(value)) { var fieldGroupName = ResourceManagerProvider.GetLocalizedString("LST_GROUP_NAME", culture); var errorText = String.Format(ResourceManagerProvider.GetLocalizedString("MSG_FIELD_EMPTY", culture), fieldGroupName); gvGroups.Rows[e.RowIndex].ErrorText = errorText; e.Cancel = true; // Disable gvGroups_CellEndEdit } } else if (columnName.Equals("WaitAnswer")) { int res; if (!Int32.TryParse(value, out res)) { var fieldWaitAnswer = ResourceManagerProvider.GetLocalizedString("LST_WAIT_ANSWER", culture); var errorText = String.Format(ResourceManagerProvider.GetLocalizedString("MSG_FIELD_NOT_NUMBER", culture), fieldWaitAnswer); gvGroups.Rows[e.RowIndex].ErrorText = errorText; e.Cancel = true; // Disable gvGroups_CellEndEdit } else if (res < WaitAnswerLimit) { var fieldWaitAnswer = ResourceManagerProvider.GetLocalizedString("LST_WAIT_ANSWER", culture); var errorText = String.Format(ResourceManagerProvider.GetLocalizedString("MSG_WAIT_ANSWER_LIMIT", culture), fieldWaitAnswer, WaitAnswerLimit); gvGroups.Rows[e.RowIndex].ErrorText = errorText; e.Cancel = true; // Disable gvGroups_CellEndEdit } } else if (columnName.Equals("SmsRecipient") && (NotificationType)Enum.Parse(typeof(NotificationType), gvGroups.Rows[e.RowIndex].Cells["NotificationType"].Value.ToString()) == NotificationType.SMS) { // Confirm that the cell is the phone. if (!Regex.IsMatch(value, @"^[\d\*]{1,10}$")) { var fieldSmsRecipient = ResourceManagerProvider.GetLocalizedString("LST_SMS_RECIPIENT", culture); var errorText = String.Format(ResourceManagerProvider.GetLocalizedString("MSG_FIELD_WRONG_FORMAT", culture), fieldSmsRecipient); gvGroups.Rows[e.RowIndex].ErrorText = errorText; e.Cancel = true; // Disable gvGroups_CellEndEdit } } }
private void PortReader_TelephoneReadReady(object sender, ReadPortEvent e) { BeginInvoke((MethodInvoker) delegate { var culture = Application.CurrentCulture; _currentSessionStatistics.ProcessedCount++; _currentSessionStatistics.RemainedCount--; if (e.Activated) { listTelephones.UpdateDateActivated(_xmlWrapper, e.Telephone, DateTime.Now); _currentSessionStatistics.ActivatedCount++; if (e.Code == ResponseCode.TIMEOUT) { listTelephones.FindItem(e.Telephone).BackColor = Color.Yellow; } else { listTelephones.FindItem(e.Telephone).BackColor = Color.Aqua; } Logger.Write(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_ACTIVATED_NUMBER", culture), e.Telephone)); } else { switch (e.Code) { case ResponseCode.BLACKLISTED: case ResponseCode.NO_ANSWER_MODEM: case ResponseCode.ERROR: listTelephones.FindItem(e.Telephone).BackColor = Color.Red; break; default: listTelephones.FindItem(e.Telephone).BackColor = Color.Aqua; break; } } UpdateStatusBarInfo(); lbLog.AddLogItem(e); }); }
private static void SaveRegFile(string fileName, string regData) { try { using (var streamWriter = new StreamWriter(fileName)) { streamWriter.WriteLine(regData); } } catch (Exception) { var culture = Application.CurrentCulture; MessageBox.Show(String.Format(ResourceManagerProvider.GetLocalizedString("MSG_FILE_WAS_NOT_CREATED", culture), fileName), ResourceManagerProvider.GetLocalizedString("MSG_SYSTEM_ERROR_TITLE", culture), MessageBoxButtons.OK, MessageBoxIcon.Error); } }