protected override void OnDeactivate() { LoadingWindow.EnableGlobalLoadingWindow(false); }
void EnterLoginScene() { LoadingWindow.LoadScene(Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE.SCENE_LOGIN); }
// Analyze videos for the corresponding analysis videos using DLC's built in analyze_videos function // If not in Debug mode, it redirects the output to the loading window accordingly private void AnalyzeVideos(Dictionary <int, AnalysisVideo> videos) { Console.WriteLine("Analyzing video..."); // Prepare script string filePath = EnvDirectory + "\\vdlc_analyze_video.py"; FileSystemUtils.MurderPython(); FileSystemUtils.RenewScript(filePath, AllScripts.AnalyzeVideo); FileSystemUtils.ReplaceStringInFile(filePath, "config_path_identifier", CurrentProject.ConfigPath); // Prepare cmd process Process p = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "cmd.exe"; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; //!ReadShowDebugConsole(); info.UseShellExecute = false; info.Verb = "runas"; info.CreateNoWindow = !ReadShowDebugConsole(); //if show debug console = true, then create no window has to be false Dispatcher.Invoke(() => //once done close the loading window { LoadingWindow = new LoadingWindow(); LoadingWindow.Title = "Analyzing"; LoadingWindow.Show(); LoadingWindow.Closed += LoadingClosed; }); bool errorDuringAnalysis = false; string errorMessage = "No Error"; string progressValue = "0"; string progressMax = "0"; int videoProgValue = 0; //NONDEBUG ----------------------------------------------------------------------------------------------- if (info.CreateNoWindow) { //redirect output if debug mode disabled p.OutputDataReceived += new DataReceivedEventHandler((sender, e) => //feed cmd output to the loading window so the user knows the progress of the analysis { if (!string.IsNullOrEmpty(e.Data)) { string line = e.Data; Console.WriteLine(line); if (line.Contains("OOM")) { errorMessage = "Analysis failed due to insufficient GPU memory. Try importing the video again and reducing its resolution, and/or cropping it."; errorDuringAnalysis = true; FileSystemUtils.MurderPython(); } if (line.Contains("progress_maximum")) { progressMax = line.Substring(line.IndexOf(":") + 1, line.IndexOf("#") - line.IndexOf(":") - 1); Dispatcher.Invoke(() => { LoadingWindow.ProgressBar.Maximum = int.Parse(progressMax); }); } if (line.Contains("progress_value")) { progressValue = line.Substring(line.IndexOf(":") + 1, line.IndexOf("#") - line.IndexOf(":") - 1); Dispatcher.Invoke(() => { LoadingWindow.ProgressLabel2.Content = progressValue + " / " + progressMax + " frames"; LoadingWindow.ProgressBar.Value = int.Parse(progressValue); }); } if (line.Contains("Starting to analyze")) { videoProgValue++; string videoName = line.Split('\\').Last(); Dispatcher.Invoke(() => { LoadingWindow.ProgressLabel.Content = "Analyzing " + videoName + " (" + videoProgValue + "/" + videos.Count + ")"; LoadingWindow.ProgressBar.Value = int.Parse(progressValue); }); } } }); } //NONDEBUG ----------------------------------------------------------------------------------------------- p.EnableRaisingEvents = true; p.Exited += (sender1, e1) => { if (errorDuringAnalysis) { this.Dispatcher.Invoke(() => { LoadingWindow.Close(); EnableInteraction(); }); UpdateVGLConfig(); //update VGLS's config file MessageBox.Show(errorMessage, "Error Occurred", MessageBoxButton.OK, MessageBoxImage.Error); } // If done analyzing, start creating labelled videos this.Dispatcher.Invoke(() => { LoadingWindow.ProgressLabel.Content = "Creating labeled videos (will take a while)..."; LoadingWindow.ProgressLabel2.Content = ""; }); CreateLabeledVideos(videos); }; p.StartInfo = info; p.Start(); using (StreamWriter sw = p.StandardInput) { if (sw.BaseStream.CanWrite) { sw.WriteLine(Drive); sw.WriteLine("cd " + EnvDirectory); sw.WriteLine(FileSystemUtils.CONDA_ACTIVATE_PATH); sw.WriteLine("conda activate " + EnvName); sw.Write("ipython vdlc_analyze_video.py"); // Arguments foreach (var video in videos.Values) { sw.Write(" \"" + video.Path + "\""); } sw.WriteLine(""); if (info.CreateNoWindow == false) { //for debug purposes sw.WriteLine("\n\n\nECHO WHEN YOU'RE DONE, CLOSE THIS WINDOW"); p.WaitForExit(); sw.WriteLine("Done, exiting."); } } } if (info.CreateNoWindow) { p.BeginOutputReadLine(); //only redirect output if debug enabled } }
private async void ButtonBase_OnClick(object sender, RoutedEventArgs e) { var uid = TextBoxUid.Text; if (uid.IsEmptyOrNull()) { return; } if (!uid.IsNumber()) { return; } ListViewRoles.Items.Clear(); //开始加载 var loading = new LoadingWindow { Owner = this }; loading.Show(); OpacityMask = new SolidColorBrush { Opacity = 0.4, Color = Colors.Black }; IsEnabled = false; //查询函数 var stats = await QueryCore.QueryStats(uid); var avatars = (await QueryCore.QueryAvatars(uid)).ToList(); //赋值查询的状态 ActiveDays.Status = stats.ActiveDays; AchievementCount.Status = stats.AchievementCount; WinRate.Status = stats.WinRate; AnemoculusCount.Status = stats.AnemoculusCount; GeoculusCount.Status = stats.GeoculusCount; AvatarCount.Status = stats.AvatarCount; WayPointCount.Status = stats.WayPointCount; DomainCount.Status = stats.DomainCount; SpiralAbyss.Status = stats.SpiralAbyss; PreciousChests.Status = stats.PreciousChests; LuxuriousChests.Status = stats.LuxuriousChests; ExquisiteChests.Status = stats.ExquisiteChests; CommonChests.Status = stats.CommonChests; //赋值人物信息 //var roles = new ObservableCollection<RolesEntity>(); var count = 1; foreach (var a in avatars) { ListViewRoles.Items.Add(new RolesEntity { Avatar = a.Image, Element = a.Element.ToElement(), Fetter = a.Fetter + "级", Index = count++.ToString(), Level = a.Level + "级", Name = a.Name, Rarity = a.Rarity + "星" }); } //结束加载 OpacityMask = null; IsEnabled = true; loading.Close(); }
private void OnWindowHide() { window.OnWindowHide -= OnWindowHide; window = null; }
public void ShowModalWindow(WindowType windowType, object vm) { if (openWindows.Contains(windowType)) { return; } ; openWindows.Add(windowType); Messenger.Default.Send <DialogOpenedMessage>(new DialogOpenedMessage { Sender = this }); if (windowType == WindowType.AddFieldWindow) { addFieldWindow = new AddFieldWindow(); addFieldWindow.DataContext = vm; addFieldWindow.Show(); } else if (windowType == WindowType.PickupWindow) { pickupWindow = new PickupWindow(); pickupWindow.DataContext = vm; pickupWindow.Show(); } else if (windowType == WindowType.LoadingWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { loadingWindow = new LoadingWindow(); loadingWindow.DataContext = vm; loadingWindow.Show(); })); } else if (windowType == WindowType.LoadingAtGin) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { loadingAtGinWindow = new LoadingAtGin(); loadingAtGinWindow.DataContext = vm; loadingAtGinWindow.Show(); })); } else if (windowType == WindowType.UnloadingAtGin) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { unloadingAtGinWindow = new UnloadingWindow(); unloadingAtGinWindow.DataContext = vm; unloadingAtGinWindow.Show(); })); } else if (windowType == WindowType.LoadingIncorrectModuleWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { loadingIncorrectModuleWindow = new LoadingIncorrectModuleWindow(); loadingIncorrectModuleWindow.DataContext = vm; loadingIncorrectModuleWindow.Show(); })); } else if (windowType == WindowType.WaitingForUnloadWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { waitingForUnloadWindow = new WaitingForUnloadWindow(); waitingForUnloadWindow.DataContext = vm; waitingForUnloadWindow.Show(); })); } else if (windowType == WindowType.UnloadCorrectionWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { unloadCorrectionWindow = new UnloadingCorrectionWindow(); unloadCorrectionWindow.DataContext = vm; unloadCorrectionWindow.Show(); })); } else if (windowType == WindowType.ChangeListWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { loadingIncorrectModuleWindow.StopBeep(); changeFieldWindow = new ChangeFieldWindow(); changeFieldWindow.DataContext = vm; changeFieldWindow.Show(); })); } else if (windowType == WindowType.TruckSetupWindow) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { firstRunWindow = new FirstRunWindow(); firstRunWindow.DataContext = vm; firstRunWindow.Show(); })); } }
private void TemplatesGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) { DocumentTemplate documentTemplate = (DocumentTemplate)TemplatesGrid.SelectedItem; List <DocumentTemplateMapping> mappings = ConfigurationManager.GetInstance().GetDocumentTemplateMappings(documentTemplate.ID); DocumentTemplateMapping selectedDocumentTemplateMapping = null; Folder selectedTargetFolder = null; SiteSetting siteSetting = null; ContentType contentType = null; IServiceManager serviceManager = null; if (mappings.Count == 0) { MessageBox.Show(Languages.Translate("This template does not have any mapping for location")); return; } else if (mappings.Count == 1) { selectedDocumentTemplateMapping = mappings[0]; siteSetting = ConfigurationManager.GetInstance().GetSiteSetting(selectedDocumentTemplateMapping.Folder.SiteSettingID); serviceManager = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); selectedTargetFolder = serviceManager.GetFolder(siteSetting, selectedDocumentTemplateMapping.Folder); contentType = serviceManager.GetContentType(siteSetting, selectedTargetFolder, selectedDocumentTemplateMapping.ContentTypeID, false); } else { DocumentTemplateLocationSelectionForm documentTemplateLocationSelectionForm = new DocumentTemplateLocationSelectionForm(); documentTemplateLocationSelectionForm.Initialize(mappings); if (documentTemplateLocationSelectionForm.ShowDialog(null, Languages.Translate("Select a location")) == true) { selectedDocumentTemplateMapping = documentTemplateLocationSelectionForm.SelectedDocumentTemplateMapping; selectedTargetFolder = documentTemplateLocationSelectionForm.SelectedFolder; siteSetting = ConfigurationManager.GetInstance().GetSiteSetting(selectedDocumentTemplateMapping.Folder.SiteSettingID); serviceManager = ServiceManagerFactory.GetServiceManager(siteSetting.SiteSettingType); contentType = serviceManager.GetContentType(siteSetting, selectedTargetFolder, selectedDocumentTemplateMapping.ContentTypeID, false); } else { return; } } List <ContentType> contentTypes = new List <ContentType>(); contentTypes.Add(contentType); FolderSettings folderSettings = ConfigurationManager.GetInstance().GetFolderSettings(ApplicationContext.Current.GetApplicationType()).GetRelatedFolderSettings(selectedTargetFolder.GetUrl()); FolderSetting defaultFolderSetting = ConfigurationManager.GetInstance().GetFolderSettings(ApplicationContext.Current.GetApplicationType()).GetDefaultFolderSetting(); EditItemPropertiesControl editItemPropertiesControl = new EditItemPropertiesControl(selectedTargetFolder.GetWebUrl(), null, contentTypes, folderSettings, defaultFolderSetting, siteSetting, selectedTargetFolder.GetUrl(), null, true); bool?dialogResult = editItemPropertiesControl.ShowDialog(null, Languages.Translate("Meta Data")); if (dialogResult == true) { LoadingWindow lw = new LoadingWindow(); lw.WindowStartupLocation = WindowStartupLocation.CenterScreen; lw.Show(); ContentType selectedContentType; Dictionary <object, object> values = editItemPropertiesControl.GetValues(out selectedContentType); string templateFilePath = documentTemplate.TemplatePath; FileInfo fi = new FileInfo(templateFilePath); string fileName = string.Empty; foreach (object key in values.Keys) { Field f = key as Field; if (f.Name.Equals("Title", StringComparison.InvariantCultureIgnoreCase) == true) { fileName = values[key] + fi.Extension; break; } } //string fileName = string.Format("w_{0}{1}", Guid.NewGuid().ToString().Replace("-", ""), fi.Extension); string actualFilePath = ConfigurationManager.GetInstance().GetTempFolder() + "\\" + fileName; ApplicationContext.Current.CreateNewFile(templateFilePath, actualFilePath); bool isListItemAndAttachment = ConfigurationManager.GetInstance().GetListItemAndAttachmentOption(); UploadItem uploadItem = new UploadItem(); uploadItem.FilePath = actualFilePath; uploadItem.Folder = selectedTargetFolder; uploadItem.ContentType = contentType; uploadItem.FieldInformations = values; Sobiens.Connectors.Common.ApplicationContext.Current.UploadFile(siteSetting, uploadItem, null, false, isListItemAndAttachment, Upload_Success, Upload_Failed); string documentURL = selectedTargetFolder.GetUrl() + "/" + fileName; object document = ApplicationContext.Current.OpenFile(siteSetting, documentURL); ApplicationContext.Current.RefreshControlsFromConfiguration(); lw.Close(); ApplicationContext.Current.ActivateDocument(document); } }
protected override void OnDeactivate() { base.OnDeactivate(); LoadingWindow.EnableGlobalLoadingWindow(); InformationManager.HideInformations(); }
public HeroAdminScreen(HeroAdminState heroAdminState) { LoadingWindow.EnableGlobalLoadingWindow(); this._heroAdminState = heroAdminState; }
private void TrainNetwork() //when training dataset created we start the training by, again, calling DeepLabCut's function { Console.WriteLine("TRAIN NETWROK"); bool errorDuringTraining = false; string errorMessage = "No Error"; string filePath = EnvDirectory + "\\vdlc_train_network.py"; FileSystemUtils.MurderPython(); FileSystemUtils.RenewScript(filePath, AllScripts.TrainNetwork); FileSystemUtils.ReplaceStringInFile(filePath, "config_path_identifier", CurrentProject.ConfigPath); Process p = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "cmd.exe"; info.RedirectStandardInput = true; info.RedirectStandardOutput = !ReadShowDebugConsole(); //when we want to show debug console, we don't want to redirect output info.UseShellExecute = false; info.Verb = "runas"; info.CreateNoWindow = !ReadShowDebugConsole(); //if show debug console = true, then create no window has to be false this.Dispatcher.Invoke(() => { LoadingWindow = new LoadingWindow(); //show a loading window during training that takes cmd's output (DeepLabCut's train_network function generated output) so the user knows how far along they are LoadingWindow.Title = "Training"; LoadingWindow.Show(); LoadingWindow.Closed += LoadingClosed; LoadingWindow.ProgressBar.Maximum = int.Parse(CurrentProject.EndIters); }); //NONDEBUG ----------------------------------------------------------------------------------------------- if (info.CreateNoWindow) //if not in debug mode { int currentIter = 0; StringBuilder output = new StringBuilder(); p.OutputDataReceived += new DataReceivedEventHandler((sender, e) => { if (!String.IsNullOrEmpty(e.Data)) { string line = e.Data; //Console.WriteLine(line); if (line.Contains("OOM")) { errorMessage = "Training failed due to insufficient GPU memory. Try setting \"Global Scale\" to a lower value, and/or reducing training videos' resolution during import."; errorDuringTraining = true; FileSystemUtils.MurderPython(); } if (line.Contains("iteration:") && line.Contains("loss:")) //extracting the current iterations information from cmd's output { currentIter = currentIter + int.Parse(CurrentProject.DisplayIters); this.Dispatcher.Invoke(() => { string currentIters = line.Substring(line.IndexOf("n:") + 3, line.IndexOf("lo") - line.IndexOf("n:") - 4); string progressInfo = currentIters + " / " + CurrentProject.EndIters + " iterations"; LoadingWindow.ProgressLabel.Content = progressInfo; LoadingWindow.ProgressBar.Value = currentIter; }); } } }); } //NONDEBUG ----------------------------------------------------------------------------------------------- p.EnableRaisingEvents = true; p.Exited += (sender1, e1) => { if (errorDuringTraining) { this.Dispatcher.Invoke(() => { LoadingWindow.Close(); EnableInteraction(); }); UpdateVGLConfig(); //update VDLC's config file MessageBox.Show(errorMessage, "Error Occurred", MessageBoxButton.OK, MessageBoxImage.Error); } else { globalStopWatch.Stop(); TimeSpan ts = globalStopWatch.Elapsed; string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); this.Dispatcher.Invoke(() => { LoadingWindow.Close(); }); CurrentProject.TrainedWith = new List <string>(); foreach (TrainingVideo current in TrainingListBox.ItemsSource) { CurrentProject.TrainedWith.Add(current.Path); } UpdateVGLConfig(); //update VDLC's config file DeleteEvalFiles(); //overwrite eval files EvalNetwork(elapsedTime); } }; p.StartInfo = info; p.Start(); globalStopWatch = new Stopwatch(); globalStopWatch.Start(); //time the training period using ( StreamWriter sw = p.StandardInput) { if (sw.BaseStream.CanWrite) { sw.WriteLine(Drive); sw.WriteLine("cd " + EnvDirectory); sw.WriteLine(FileSystemUtils.CONDA_ACTIVATE_PATH); sw.WriteLine("conda activate " + EnvName); sw.WriteLine("ipython vdlc_train_network.py"); if (info.CreateNoWindow == false) //for debug purposes { sw.WriteLine("ECHO WHEN YOU'RE DONE, CLOSE THIS WINDOW"); p.WaitForExit(); sw.WriteLine("Done, exiting."); } } } if (info.CreateNoWindow) { p.BeginOutputReadLine(); } }
//MARK: Evaluation Methods private void EvalNetwork(string elapsedTime) //evaluate the newly trained network using DeepLabCut's evaluate_network function { BarInteraction(); string filePath = EnvDirectory + "\\vdlc_eval_network.py"; FileSystemUtils.MurderPython(); FileSystemUtils.RenewScript(filePath, AllScripts.EvalNetwork); FileSystemUtils.ReplaceStringInFile(filePath, "config_path_identifier", CurrentProject.ConfigPath); Process p = new Process(); ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "cmd.exe"; info.RedirectStandardInput = true; info.UseShellExecute = false; info.Verb = "runas"; info.CreateNoWindow = !ReadShowDebugConsole(); //if show debug console = true, then create no window has to be false this.Dispatcher.Invoke(() => { LoadingWindow = new LoadingWindow(); LoadingWindow.Title = "Evaluating"; LoadingWindow.Show(); LoadingWindow.Closed += LoadingClosed; LoadingWindow.ProgressBar.Maximum = 100; LoadingWindow.ProgressBar.Value = 100; LoadingWindow.ProgressLabel.Content = "Just a sec..."; }); p.EnableRaisingEvents = true; p.Exited += (sender1, e1) => { CurrentProject.TrainTime = elapsedTime; GetEvalResultsSaveTime(ref CurrentProject); this.Dispatcher.Invoke(() => { LoadingWindow.Close(); EvalWindow evalWindow = new EvalWindow(CurrentProject.TrainTime, CurrentProject.TrainError, CurrentProject.TestError, CurrentProject.PCutoff); //once done evaluating, show a window with evaluation stats evalWindow.Show(); }); SyncUI(); EnableInteraction(); }; p.StartInfo = info; p.Start(); globalStopWatch = new Stopwatch(); globalStopWatch.Start(); using ( StreamWriter sw = p.StandardInput) { //run the evaluation script if (sw.BaseStream.CanWrite) { sw.WriteLine(Drive); sw.WriteLine("cd " + EnvDirectory); sw.WriteLine(FileSystemUtils.CONDA_ACTIVATE_PATH); sw.WriteLine("conda activate " + EnvName); sw.WriteLine("ipython vdlc_eval_network.py"); if (info.CreateNoWindow == false) //for debug purposes { sw.WriteLine("ECHO WHEN YOU'RE DONE, CLOSE THIS WINDOW"); p.WaitForExit(); sw.WriteLine("Done, exiting."); } } } }
/// <summary> /// Keeps the loading window updated while the game is loading. /// </summary> protected void LoadingWindowThread() { // Create a loading window. LoadingWindow loadingWindow = new LoadingWindow(); loadingWindow.Text = "Loading " + _gameTitle; loadingWindow.SetStatus("Loading "+_gameTitle+"..."); loadingWindow.Show(); while (_loading == true) { Application.DoEvents(); Thread.Sleep(50); } loadingWindow.Close(); }
protected override void OnDeactivate() => LoadingWindow.EnableGlobalLoadingWindow();
public static void TickSceneEditorPresentation(float dt) { MBAPI.IMBEditor.TickSceneEditorPresentation(dt); LoadingWindow.DisableGlobalLoadingWindow(); }
private void preview() { this.Hide(); loadingWindow = new LoadingWindow() { Message = "Previewing your work." }; loadingWindow.Show(); previewWorker.RunWorkerAsync(); }
protected override void OnInitialize() { base.OnInitialize(); LoadingWindow.EnableGlobalLoadingWindow(); }
private void submit() { this.Hide(); loadingWindow = new LoadingWindow() { Message = "Submitting your work." }; loadingWindow.Show(); submitWorker.RunWorkerAsync(); }
//实际事件处理接口 void _ProcessEvent(GameEvent _event) { //首先弹出这个Events m_DelayEventQueue.Remove(_event); switch (_event.EventID) { case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_ENTERGAME: { //举个例子,之后处理函数过多的时候可以考虑封装 int nLevel = _event.GetIntParam(0); LoadingWindow.LoadScene((Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE)nLevel); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_MISSION_COLLECTITEM: { //int nMissionID = _event.GetIntParam(0); GameManager.gameManager.MissionManager.MissionCollectItem(); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_CHANGESCENE: { int nLevel = _event.GetIntParam(0); if (Singleton <ObjManager> .Instance.MainPlayer != null) { Singleton <ObjManager> .Instance.MainPlayer.OnPlayerLeaveScene(); } LoadingWindow.LoadScene((Games.GlobeDefine.GameDefine_Globe.SCENE_DEFINE)nLevel); //处理消息包标记位 //NetWorkLogic.GetMe().CanProcessPacket = false; //Application.LoadLevel(nLevel); } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_QINGGONG: { // if (Singleton<ObjManager>.Instance.MainPlayer != null) // { // Singleton<ObjManager>.Instance.MainPlayer.BeginQingGong(_event); // } int nServerID = _event.GetIntParam(2); Obj obj = Singleton <ObjManager> .Instance.FindObjInScene(nServerID); if (obj) { if (obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER || obj.ObjType == Games.GlobeDefine.GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER) { Obj_OtherPlayer OtherPlayer = obj as Obj_OtherPlayer; if (OtherPlayer) { OtherPlayer.BeginQingGong(_event); } } } } break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_COLLECTITEM_RESEED: { int nSceneID = _event.GetIntParam(0); int nSceneIndex = _event.GetIntParam(1); int nItemIndex = _event.GetIntParam(2); if (Singleton <CollectItem> .GetInstance() != null) { Singleton <CollectItem> .GetInstance().ReSeedItems(nSceneID, nSceneIndex, nItemIndex); } } break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_UI: { RequestReviewWindow.OnTouchUI(); } break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_OBJECT: RequestReviewWindow.OnTouchObject(); break; case GameDefine_Globe.EVENT_DEFINE.EVENT_TOUCH_SCENE: RequestReviewWindow.OnTouchScene(); break; case Games.GlobeDefine.GameDefine_Globe.EVENT_DEFINE.EVENT_CALL_NAVIGATOR: Application.OpenURL(PlatformHelper.GetAppDetailUrl()); break; default: break; } }
private void btnOK_Click(object sender, RoutedEventArgs e) { if (cbxUseEncryption.IsChecked == true) { if (tbxEncryptionPassword.Password != tbxEncryptionPasswordRepeat.Password) { MessageBox.Show(Strings.MessagePasswordsDoNotMatch, this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } if (string.IsNullOrEmpty(tbxEncryptionPassword.Password)) { MessageBox.Show(Strings.ExportWindowNoPasswordMessage, this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } } if (cbxStorePassword.IsChecked == true && cbxUseEncryption.IsChecked != true) { MessageBox.Show(Strings.ExportWindowPasswordWithoutEncryptionMessage, this.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } SaveFileDialog dialog = new SaveFileDialog(); dialog.DefaultExt = ".drives"; dialog.Title = this.Title; dialog.Filter = "*.drives|*.drives"; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool storeUsername = (cbxStoreUsername.IsChecked == true); bool storePassword = (cbxStorePassword.IsChecked == true); bool useEncryption = (cbxUseEncryption.IsChecked == true); string password = tbxEncryptionPassword.Password; bool close = false; LoadingWindow.TryShowLoadingWindow(Strings.MainWindowExportProgressMessage, new Action(() => { try { JArray drivesList = new JArray(); foreach (NetworkDrive drive in this.exportDrives) { JObject obj = drive.ExportToJson(); if (!storeUsername) { // remove credentials obj["Username"] = null; obj["Password"] = null; } else if (storePassword) { // write unencrypted password to file obj["Password"] = drive.GetPassword(); } else { obj["Password"] = null; } if (useEncryption) { foreach (KeyValuePair <string, JToken> kvp in obj) { if (kvp.Value.Type == JTokenType.String) { obj[kvp.Key] = Helper.EncryptValue(kvp.Value.Value <string>(), password); } } } drivesList.Add(obj); } JObject exportObj = new JObject(); exportObj.Add("IsEncrypted", useEncryption); if (useEncryption) { // save salted checksum of the password to check for the correct password exportObj.Add("Check", Helper.GeneratePasswordStore(password)); } exportObj.Add("Drives", drivesList); log.Info("Export " + drivesList.Count + " drives to \"" + dialog.FileName + "\""); File.WriteAllText(dialog.FileName, exportObj.ToString(), Encoding.UTF8); close = true; } catch (Exception ex) { log.Error("Unable to export drives: " + ex.Message + " (" + ex.GetType().Name + ")", ex); this.Dispatcher.Invoke(new Action(() => { MessageBox.Show(LoadingWindow.GetStaticLoadingWindow(), string.Format(Strings.MainWindowExportErrorMessage, ex.GetType().Name, ex.Message, ex.StackTrace), Strings.TitleCheckConnection, MessageBoxButton.OK, MessageBoxImage.Exclamation); })); } })); if (close) { this.DialogResult = true; Close(); } } }
IEnumerator LoadingScene(string unloadName, string loadName, int stageNum = 1) { /* * BaseManagerScene에서 게임을 시작할 것이다. * * unloadName에 이름이 없으면 Unload를 하지않는다. * unloadName에 이름이 있으면 Unload를 한다. * _prevSceneState가 Ingame인 경우 Stage도 같이 Unload한다. * Unload를 해야하는 Stage는 _oldStageNumber다. (UnloadAsync 사용) * loadName에 해당하는 Scene을 Load한다. (LoadAsync 사용.옵션 주의) * Load하는 Scene이 Ingame인 경우 Stage도 같이 Load한다. * Load하는 Stage는 stageNum이다. * * 위의 작업을 끝냈다면, Ingame을 실행했을때 3개의 Scene이 Hierarchy에 생성되고, Error가 발생될 것이니 Error까지 처리하라. */ AsyncOperation AO; string str; LoadingWindow wnd = Instantiate(_prefabLoadingWnd, transform).GetComponent <LoadingWindow>(); // LoadingWnd를 Hierarchy에 생성한다. // BaseSceneManager에 자식으로 붙여둔다. // wnd 변수에 생성한 LoadingWnd를 참조하도록 한다. // transform을 빼버리면, Loading 창은 BaseScne에서 만들어지긴 하지만, 메뉴 -> 인게임과 인게임 -> 메뉴 갈때 문제가 발생한다. // 현재 액티브 되어있는 씬을 위주로 만들어지기 때문에, 언로드할때 안 날라가게 하려는 씬을 현재 여기에 붙여놓은 것이다. _currentLoadState = eStateLoading.UNLOADSCENE; if (unloadName != string.Empty) { if (_prevSceneState == eStateScene.INGAME) { _currentLoadState = eStateLoading.UNLOADSTAGE; str = "Stage" + _oldStageNumber.ToString(); AO = SceneManager.UnloadSceneAsync(str); while (!AO.isDone) { wnd.SettingBarValue(AO.progress); // Stage의 Unload 상황을 표시한다. yield return(null); } wnd.SettingBarValue(10); // Stage의 Unload가 마무리 됐음을 표시한다. } AO = SceneManager.UnloadSceneAsync(unloadName); while (!AO.isDone) { wnd.SettingBarValue(AO.progress); // Scene의 Unload 상황을 표시한다. yield return(null); } wnd.SettingBarValue(10); // Scene의 Unload가 마무리 됐음을 표시한다. } _currentLoadState = eStateLoading.LOADSCENE; AO = SceneManager.LoadSceneAsync(loadName, LoadSceneMode.Additive); while (!AO.isDone) { wnd.SettingBarValue(AO.progress); // Scene의 Loading 상황을 표시한다. yield return(null); } wnd.SettingBarValue(10); // Scene의 Loading이 마무리 됐음을 표시한다. //yield return new WaitForSeconds(1); str = loadName; if (_sceneState == eStateScene.INGAME) { _currentLoadState = eStateLoading.LOADSTAGE; str = "Stage" + stageNum.ToString(); AO = SceneManager.LoadSceneAsync(str, LoadSceneMode.Additive); while (!AO.isDone) { wnd.SettingBarValue(AO.progress); // Stage의 Loading 상황을 표시한다. wnd.SettingBarValue(0); yield return(new WaitForSeconds(0.1f)); wnd.SettingBarValue(2); yield return(new WaitForSeconds(0.3f)); wnd.SettingBarValue(5); yield return(new WaitForSeconds(0.1f)); wnd.SettingBarValue(6); yield return(new WaitForSeconds(0.1f)); wnd.SettingBarValue(7.5f); yield return(new WaitForSeconds(0.4f)); wnd.SettingBarValue(10); yield return(new WaitForSeconds(0.2f)); yield return(null); } wnd.SettingBarValue(10); // Stage의 Loading이 마무리 됐음을 표시한다. } //yield return new WaitForSeconds(1); Scene s = SceneManager.GetSceneByName(str); SceneManager.SetActiveScene(s); _currentLoadState = eStateLoading.ENDLOAD; if (_sceneState == eStateScene.INGAME) { IngameManagerObj._instance.CreateBall(); } Destroy(wnd.gameObject); // LoadingWnd를 Hierarchy (메모리)에서 제거한다. }
public void Refresh(int iType, AnalysisView viewType, int zoneId, DateTime dteStartDate, DateTime DteEndDate) { try { _iType = iType; //lblStatus.Visibility = Visibility.Hidden; //progressBar1.Visibility = Visibility.Hidden; lstAnalysisDetails.Visibility = Visibility.Visible; lstCollectionDetails.Visibility = Visibility.Hidden; //GridViewColumn_NoOfMC.Width = (viewType == AnalysisView.Zone) ? 78 : 0; string reportType = string.Empty; switch (iType.ToString()) { case "1": reportType = "DAY"; break; case "2": reportType = "DROP"; break; case "3": reportType = "WEEK"; break; case "4": reportType = "MONTH"; break; } LogManager.WriteLog("UCAnalysisDetails:Refresh ZoneID:" + zoneId + " ReportType:" + reportType, LogManager.enumLogLevel.Info); Action doAnalysis = () => { IAnalysis objCashdesk = AnalysisBusinessObject.CreateInstance(); dtAnalysisDetails = objCashdesk.GetAnalysisDetails(iType, dteStartDate, DteEndDate, viewType, zoneId); }; if (iType == 2) { //Getting Installation No for grabbing current meters IList <int> inst = (new CommonDataAccess()).GetInstallationDetailsForReports(reportType) .AsEnumerable() .Where(r => (zoneId == -1 ? true : (r["Zone_No"] != DBNull.Value ? (r.Field <int>("Zone_No") == zoneId) : false))) .Select(row => row.Field <int>("Installation_No")) .ToList <int>(); //Grabbing current meters from VLT LoadingWindow ld_analysis = new LoadingWindow(this, Audit.Transport.ModuleName.AnalysisDetails, inst, doAnalysis); ld_analysis.ShowDialog(); } else { LoadingWindow ld_analysis = new LoadingWindow(this, Audit.Transport.ModuleName.AnalysisDetails, doAnalysis, true); ld_analysis.ShowDialog(); } dtPrintDetails = null; dtPrintDetails = dtAnalysisDetails.Copy(); if (dtPrintDetails.Rows.Count > 0) { TotalAvgBet = Convert.ToDecimal(dtPrintDetails.Rows[0]["AvgBet"]); dtPrintDetails.Rows[0].Delete(); dtPrintDetails.AcceptChanges(); } lstAnalysisDetails.DataContext = dtAnalysisDetails.DefaultView; foreach (Microsoft.Windows.Controls.DataGridColumn gvCol in lstAnalysisDetails.Columns) { ResizeGridViewColumn(gvCol); lstAnalysisDetails.Columns[0].Width = 0; } //txtHeader.Visibility = Visibility.Visible; //txtHeader1.Visibility = Visibility.Hidden; btnPrint.Visibility = Visibility.Visible; btnExport.Visibility = Visibility.Visible; if (!Settings.IsAFTEnabledForSite) { this.lstAnalysisDetails.Columns.Remove(gvColCashableEFTIn); this.lstAnalysisDetails.Columns.Remove(gvColCashableEFTOut); this.lstAnalysisDetails.Columns.Remove(gvColNonCashableEFTIn); this.lstAnalysisDetails.Columns.Remove(gvColNonCashableEFTOut); this.lstAnalysisDetails.Columns.Remove(gvColWATIn); this.lstAnalysisDetails.Columns.Remove(gvColWATOut); dtPrintDetails.Columns.Add("CashableEFTIn", typeof(decimal), "0.00"); dtPrintDetails.Columns.Add("CashableEFTOut", typeof(decimal), "0.00"); dtPrintDetails.Columns.Add("NonCashableEFTIn", typeof(decimal), "0.00"); dtPrintDetails.Columns.Add("NonCashableEFTOut", typeof(decimal), "0.00"); dtPrintDetails.Columns.Add("WATIn", typeof(decimal), "0.00"); dtPrintDetails.Columns.Add("WATOut", typeof(decimal), "0.00"); } GetRefreshedData(); } catch (Exception ex) { MessageBox.ShowBox(ex.Message, true); ExceptionManager.Publish(ex); } }
private void Application_Startup(object sender, StartupEventArgs e) { int startTime = Environment.TickCount; try { this.applicationPath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]); if (!Branding.IsInitialized) { MessageBox.Show("Fatal error during initialization. Please reinstall the application.", "Network Drive Service", MessageBoxButton.OK, MessageBoxImage.Error); Shutdown(-1); return; } GlobalContext.Properties["AppDataPath"] = Branding.AppDataPath; XmlConfigurator.Configure(); this.log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); this.log.Info("Startup"); #if !DEBUG //TODO workaround for SD-163 => find root cause... AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; Application.Current.Dispatcher.UnhandledException += Dispatcher_UnhandledException; #endif } catch (Exception ex) { MessageBox.Show(ex.GetType().Name + " caught during initialization:\r\n\r\n" + ex.Message, "Network Drive Service", MessageBoxButton.OK, MessageBoxImage.Error); Shutdown(-1); return; } try { this.log.Info("-> " + Branding.ApplicationName + ", Version " + SoftwareVersion); } catch (Exception ex) { this.log.Warn("Could not retrieve version number (" + ex.GetType().Name + "): " + ex.Message, ex); } this.appOptions = new ApplicationOptions(); // override system language if (!string.IsNullOrEmpty(this.appOptions.SelectedLanguage)) { try { /* #### IMPORTANT: needs to be done in STA thread! #### */ Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(this.appOptions.SelectedLanguage); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.appOptions.SelectedLanguage); } catch (Exception ex) { this.log.Error("Could not set language to \"" + this.appOptions.SelectedLanguage + " (" + ex.GetType().Name + "): " + ex.Message, ex); } } string systemLangName = ""; try { systemLangName = Thread.CurrentThread.CurrentUICulture.Name; // load translated error messages to the cache WNetApiException.UpdateErrorCodes(); } catch (Exception ex) { this.log.Warn("Could not retrieve language (" + ex.GetType().Name + "): " + ex.Message, ex); } try { // is this the first instance? IpcChannelName = IpcChannelPrefix + Environment.UserDomainName + "." + Environment.UserName; bool isMutexOwner; this.applicationMutex = new Mutex(true, IpcChannelName, out isMutexOwner); if (e.Args.Length > 0 && e.Args[0] == "-wait") { if (!isMutexOwner) { log.Info("-> Wait for other instances to close..."); do { this.applicationMutex.Close(); Thread.Sleep(200); this.applicationMutex = new Mutex(true, IpcChannelName, out isMutexOwner); } while (!isMutexOwner); } } if (!isMutexOwner) { log.Info("-> Another instance is already running"); if (e.Args.Length >= 1 && e.Args[0] == "-exit") { // send close command to other applications try { NamedPipeClientStream ipcClient = new NamedPipeClientStream(".", IpcChannelName, PipeDirection.Out, PipeOptions.Asynchronous); ipcClient.Connect(); ipcClient.WriteByte((byte)IpcCommands.Exit); } catch (Exception ex) { log.Error("Could not send 'Exit' on Ipc Channel: " + ex.Message + " (" + ex.GetType().Name + ")", ex); } } else { // send show-window command to other application try { NamedPipeClientStream ipcClient = new NamedPipeClientStream(".", IpcChannelName, PipeDirection.Out, PipeOptions.Asynchronous); ipcClient.Connect(); ipcClient.WriteByte((byte)IpcCommands.ShowMainWindow); } catch (Exception ex) { log.Error("Could not send 'ShowMainWindow' on Ipc Channel: " + ex.Message + " (" + ex.GetType().Name + ")", ex); } } // only one instance allowed -> close this instance Shutdown(); return; } bool initSuccess = false; if (e.Args.Length > 0 && e.Args[0] == "-hidden") { initSuccess = InitApplication(systemLangName); } else { // disable shutdown on last window closed. otherwise closing the loading window would shutdown the application App.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; LoadingWindow.TryShowLoadingWindow(Strings.MessageInitialization, new Action(() => { initSuccess = InitApplication(systemLangName); })); // re-enable to return to normal behaviour App.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; } if (!initSuccess) { Shutdown(-1); return; } this.log.Info("Startup took " + (Environment.TickCount - startTime) + " ms"); } catch (Exception ex) { this.log.Error("Unhandled Exception in App.Application_Startup: " + ex.Message + " (" + ex.GetType().Name + ")", ex); MessageBox.Show(string.Format(Strings.MessageFatalError, ex.GetType().Name, ex.Message, ex.StackTrace), Branding.ApplicationName, MessageBoxButton.OK, MessageBoxImage.Error); Shutdown(-1); } }