/********************************************* ОБРАБОТЧИКИ ***************************************************************/ // Удаление элемента дерева void wc_ws_deleteNodeCompleted(object sender, WS_Link.ws_deleteNodeCompletedEventArgs e) { if (e.Result == 1) { w.txt_Message.Text = "Раздел удален"; w.Show(); } else { cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_DELETE, e.OpStatus.ToString()); w.Show(); } }
public void Save <T>(string collection, T item, string id = "", Action <T> callback = null) where T : DataItem, new() { if (string.IsNullOrEmpty(item.Id)) { item.Id = id; } var jString = JsonConvert.SerializeObject(item); //TODO. Почитать возможно надо использовать Push() или Transaction? DbRoot.Child(collection).Child(item.Id).SetRawJsonValueAsync(jString).ContinueWith( delegate(Task t) { if (t.Exception != null) { var message = this + " Error Saving:" + jString + " \n" + t.Exception.ToString(); Debug.LogError(message); InfoWindow.Show(message); return; } if (callback != null) { callback.Invoke(item); } } ); }
private void BtnContinue_Click(object sender, RoutedEventArgs e) { BtnContinue.IsEnabled = false; BtnOpenXml.IsEnabled = false; MainController.Instance.IsValid = true; if (MainController.Instance.IsValid) { try { //MainController.Instance.Recetas = MainController.XmlToObject<List<Receta>>(); var infoWindow = new InfoWindow(); infoWindow.Show(); Close(); } catch { MessageBox.Show("Error al obtener los datos del archivo XML"); BtnContinue.IsEnabled = true; BtnOpenXml.IsEnabled = true; } } }
/********************************************* HANDLERS *******************************************************************/ // --- Check ProducerType data before insert/update Passport void wc_ws_checkPassportProducerCompleted(object sender, ws_checkPassportProducerCompletedEventArgs e) { int i = e.OpValue; string s = e.OpStatus; if (e.Result == 1) { switch (ucMode) { case 'U': // mode_U wc.ws_updatePassportAsync(Ex_Pass); break; case 'W': // mode_W wc.ws_insertPassportAsync(Ex_Pass, (int)ucPID); break; } } else if (e.OpValue == 50017) { InfoWindow w = new InfoWindow(Messages.m_Warning, e.OpStatus.ToString()); w.Show(); } else { cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_DB, e.OpStatus.ToString()); w.Show(); } }
//format addr, instruction bytes & asm ops into a list of strings for all bytes in code section public void showSectionCode(Section section) { if (section.isCode()) { InfoWindow infoWin = new InfoWindow(); infoWin.setTitle("Section [" + section.secNum + "] " + section.secName + " Code"); uint srcpos = 0; List <String> codeList = new List <String>(); String asmLine = null; i32Disasm disasm = new i32Disasm(section.data, srcpos); Instruction instr; uint instrlen = 0; uint codeaddr = section.imageBase + section.memloc; //starting pos of code in mem, used for instr addrs while (srcpos < (section.data.Length - MAXINSTRLEN)) { instr = disasm.getInstr(codeaddr); //disasm bytes at cur source pos into next instruction asmLine = instr.displayIntruction(); codeList.Add(asmLine); instrlen = (uint)instr.getBytes().Count; //determines how many bytes to format in line srcpos += instrlen; codeaddr += instrlen; } String text = String.Join("\r\n", codeList); infoWin.setText(text); infoWin.Show(fwindow); } }
/// <summary> /// Show Help window in a dialog /// </summary> internal static void InfoDialogWindow() { if (InfoWindow == null) { InfoWindow = new InfoWindow { Owner = GetMainWindow }; } else { if (InfoWindow.Visibility == Visibility.Visible) { InfoWindow.Focus(); } else { InfoWindow.Visibility = Visibility.Visible; InfoWindow.ShowDialog(); } } InfoWindow.Show(); #if DEBUG Trace.WriteLine("HelpWindow loaded "); #endif }
// --- Update Passport void wc_ws_updatePassportCompleted(object sender, ws_updatePassportCompletedEventArgs e) { if (e.Result == 1) { ucResult = 1; ucPID = Ex_Pass.DevID; resultChildWindow.init(Messages.m_Message, Messages.m_PassportUpdated); resultChildWindow.Show(); resultChildWindow.Closed += new EventHandler(resultChildWindow_Closed); } else { cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_UPDATE, e.OpStatus.ToString()); w.Show(); } }
private void BeginHelp(object sender, RoutedEventArgs e) { string msg = ""; if (MainMenu.IsSelected) { msg = msg + "Here You can start a private chat! Set your preferences, and then begin chatting!\n"; } if (FriendListPage.IsSelected) { msg = msg + "Here You can see your friendlist! You can see the mutual and onesided friendlists.\n"; } if (MessageHistoryPage.IsSelected) { msg = msg + "Here You can see your archived chats. Click on an entry, and relive the moments!\n"; } if (PrivateChat.IsSelected) { msg = msg + "Type your message, and then send it by either clicking on the button or hitting enter!\n"; } if (BeforeLogin.IsSelected) { msg = "Either sign up, or register! Add Your username and password, and then let's chat!"; } InfoWindow iw = new InfoWindow(msg); iw.Show(); }
public void LoadSubtitles(string filename) { if (!File.Exists(filename)) { Ready = false; return; } try { RawSubtitles.Clear(); using (StreamReader sr = new StreamReader(filename, System.Text.Encoding.Default)) { string line; while ((line = sr.ReadLine()) != null) { RawSubtitles.Add(line); } } } catch (Exception e) { Ready = false; InfoWindow.Show("Ошибка считывания файлов титров: " + e.Message); } Parser.ParseRawTitles(RawSubtitles, out subtitles); RawSubtitles = new List <string>(); Parser.SegregateSubtitlesToRecords(subtitles, out records); Ready = true; }
void wc_ws_insertProducerCompleted(object sender, ws_insertProducerCompletedEventArgs e) { if (e.Result != 0) { ucResult = 2; ucPID = globalProducer.ProducerID; resultChildWindow.init(Messages.m_Message, Messages.m_ProducerInserted); resultChildWindow.Show(); resultChildWindow.Closed += new EventHandler(resultChildWindowW_Closed); } else { cwnd_ShitHappens w = new cwnd_ShitHappens(ErrorResources.err_UPDATE, e.OpStatus.ToString()); w.Show(); } }
internal static void Navi(Process process = null) { if (process != null) { _infoWindow = new InfoWindow(process); _infoWindow.Show(); } }
private void ShowInfoWindow() { if (Settings.Default.ShowInfoWindowOnStartChecked) { var infoWindow = new InfoWindow(); infoWindow.Show(); } }
private void DisplayInfo(object obj) { if (_infoWindow == null) { _infoWindow = new InfoWindow(); } _infoWindow.Show(); }
private void SyncLeadIndicator_MouseUp(object sender, MouseButtonEventArgs e) { var res = InfoWindow.Show("Вы уверены что хотите сменить плеер-лидер синхронизации?", "Смена плеера-лидера синхронизации", InfoWindowButtons.OkCancel, InfoWindowIcons.Warning); if (res == InfoWindowResult.Ok) { OnSyncLeaderSet(this, null); } }
public void OnSaveScore() { if (string.IsNullOrEmpty(nameInputField.text)) { InfoWindow.Show("Please enter your name"); return; } //TODO //DataLoader.Instance.SaveResults(nameInputField.text, }
protected override void OnDeleteClickedCommand() { try { Repository.Remove(CurrentEntityObject); } catch (Exception ex) { InfoWindow.Show(ex.Message); } }
private void OnDeleteService() { try { ServicesRepository.Remove(CurrentService); } catch { InfoWindow.Show("Удаление запрещено"); } }
private void Delete() { try { Repository.Remove(CurrentHotel); } catch { InfoWindow.Show("Удаление отеля невозможно"); } }
void InfoButtCommandAction() { if (Helper.IsWindowOpen <InfoWindow>()) // Check if any Window of a certain Type(mainWindow) or if a Window with a certain name is open { System.Windows.MessageBox.Show("Window Info already open", "Notification", 0); } else { InfoWindow infoWindow = new InfoWindow(); infoWindow.Show(); } }
public void LoadFile(string filename) { if (File.Exists(filename)) { Body.Load(filename); OnPropertyChanged("SourceFilename"); } else { InfoWindow.Show("Файл " + filename + " не найден."); } }
public static string ReadSetting(string key) { string result = ""; try { var appSettings = ConfigurationManager.AppSettings; result = appSettings[key] ?? "Not Found"; return(result); } catch (ConfigurationErrorsException) { InfoWindow.Show("Error reading app settings"); return(result); } }
public void showSectionData(Section section) { StringBuilder dataStr = new StringBuilder(); //the whole thing as one LONG string StringBuilder ascii = new StringBuilder(); //the ascii representation of the bytes on one line InfoWindow infoWin = new InfoWindow(); infoWin.setTitle("Section [" + section.secNum + "] " + section.secName + " Data"); int bpos = 0; uint loc = section.memloc; for (; bpos < section.data.Length;) { if (bpos % 16 == 0) { dataStr.Append(loc.ToString("X8") + ": "); //address field if at start of line } uint b = section.data[bpos]; dataStr.Append(b.ToString("X2")); //single byte value in hex dataStr.Append(" "); ascii.Append((b >= 0x20 && b <= 0x7E) ? ((char)b).ToString() : "."); //and its ascii equivalent bpos++; loc++; if (bpos % 16 == 0) { dataStr.AppendLine(ascii.ToString()); //ascii field if at end of line ascii.Clear(); } } if (bpos % 16 != 0) //fill out partial last line { int remainder = (bpos % 16); for (; remainder < 16; remainder++) { dataStr.Append(" "); //space over to line up ascii field } dataStr.AppendLine(ascii.ToString()); } String text = dataStr.ToString(); infoWin.setText(text); infoWin.Show(fwindow); }
/// <summary> /// Show Help window in a dialog /// </summary> internal static void InfoWindow() { if (GetInfoWindow == null) { GetInfoWindow = new InfoWindow(); GetInfoWindow.Show(); } else { if (GetInfoWindow.Visibility == Visibility.Visible) { GetInfoWindow.Focus(); } else { GetInfoWindow.Show(); } } }
public void Remove <T>(string collection, string id = "", Action <string> callback = null) { DbRoot.Child(collection).Child(id).RemoveValueAsync().ContinueWith( delegate(Task t) { if (t.Exception != null) { var message = this + " Error Removing:" + id + " \n" + t.Exception.ToString(); Debug.LogError(message); InfoWindow.Show(message); return; } if (callback != null) { callback.Invoke(id); } } ); }
public static void AddUpdateAppSettings(string key, string value) { try { var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var settings = configFile.AppSettings.Settings; if (settings[key] == null) { settings.Add(key, value); } else { settings[key].Value = value; } configFile.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name); } catch (ConfigurationErrorsException) { InfoWindow.Show("Error writing app settings"); } }
public static void Restore(string filename, VM vm) { XmlSerializer formatter = new XmlSerializer(typeof(ApplicationStateSerialized)); ApplicationStateSerialized sets; if (!File.Exists(filename)) { InfoWindow.Show("Файл настроек " + filename + " не найден.", "Ошибка", InfoWindowButtons.Ok, InfoWindowIcons.Error); return; } using (FileStream fs = new FileStream(filename, FileMode.Open)) { sets = (ApplicationStateSerialized)formatter.Deserialize(fs); } if (sets == null) { InfoWindow.Show("Ошибка открытия файла настроек. Десериализатор вернул null."); return; } vm.СloseAllCommand.Execute(null); ValidateSets(sets); RestoreViewModel(sets, vm); }
/////////// <summary> /////////// Ищет номер записи субтитра по времени видео /////////// </summary> /////////// <param name="timeVideo">Время по видео</param> /////////// <returns>Номер соответствующего титра в коллекции Subtitles</returns> /// <summary> /// Функция возвращает титр соответствующий данному моменту на видео /// </summary> /// <param name="TimeVideo">Время на видео</param> /// <returns></returns> public Subtitle GetSubtitle(TimeSpan TimeVideo) { Subtitle S = new Subtitle(); if (!Ready) { return(S); } try { int N = SearchAndTools.BinarySearch(TimeVideo, subtitles); if (N < 0 || N > subtitles.Count - 1) { S.Text += "0;00;00;000 Не найден субтитр для текущего времени"; return(S); } S = subtitles[N]; } catch (Exception e) { InfoWindow.Show("Ошибка при поиске субтитров: " + e.Message); } return(S); }
/// <summary> /// Функция возвращает титр через поиск его по времени, указанному в титрах /// </summary> /// <param name="TimeTitles">Время, которое должно быть указано в тексте титров</param> /// <returns></returns> public Subtitle GetSubtitleOfTitlesTimeText(TimeSpan TimeTitles) { Subtitle S = new Subtitle(); if (!Ready) { return(S); } try { int N = SearchAndTools.BinarySearchInTimesFromTitles(TimeTitles, subtitles, 0, subtitles.FindLastIndex((x) => { return(x.Begin > TimeSpan.FromSeconds(-1)); })); if (N < 0 || N > subtitles.Count - 1) { throw new Exception(); } S = subtitles[N]; } catch (Exception e) { InfoWindow.Show("Ошибка синхронизации " + e.Message); } return(S); // return subtitles[SearchAndTools.BinarySearchInTimesFromTitles(TimeTitles, subtitles,0, subtitles.FindLastIndex((x)=> {return x.Begin > TimeSpan.FromSeconds(-1); } ))]; }
private void infoToolStripMenuItem_Click(object sender, EventArgs e) { InfoWindow Info = new InfoWindow(); Info.Show(); }
/*Private methods*/ private void Start() { InfoWindowComponent.Show("Waiting for session start..."); GameManagerComponent.SessionStarted += OnGameManagerComponentSessionStarted; }
void OnConnectFail() { InfoWindow.Show("Server connection failed!"); }