private async Task LoginUser() { if (ValidateInputs()) { Close(); ls.LblLoading.Text = "Logging in"; ls.Show(); switch (user) { case User.Admin: await LoginAdmin(); break; case User.Owner: await LoginOwner(); break; case User.Worker: await LoginWorker(); break; } ls.Close(); return; } MessageBox.Show("All input fields are required!"); }
public static void CloseLoadingScreen() { //if the operation is too short, the _ls is not correctly initialized and it throws //a null error if (_ls != null && _ls.InvokeRequired) { _ls.Invoke(new MethodInvoker(CloseLoadingScreen)); } else { if (_shown) { //if the operation is too short and the thread is not started //this would close the main thread _shown = false; Application.ExitThread(); } if (_LoadingScreenThread != null) { _LoadingScreenThread.Interrupt(); } if (_ls != null) { _ls.Close(); _ls.Dispose(); } _LoadingScreenThread = null; } }
private async Task InsertAdmin() { if (ValidateInputs()) { AdminInsertVM adminInsertVM = new AdminInsertVM() { Username = TbUsername.Text, Password = TbPassword.Password, FirstName = TbFirstName.Text, LastName = TbLastName.Text }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await adminApi.InsertAdmin(adminInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required and Password must match Confirm password!"); } }
public static void CloseLoadingScreen() { //if the operation is too short, the _ls is not correctly initialized and it throws //a null error if (_ls != null && _ls.InvokeRequired) { _ls.Invoke(new MethodInvoker(CloseLoadingScreen)); } else { if (_shown) { //if the operation is too short and the thread is not started //this would close the main thread _shown = false; Application.ExitThread(); } if (_LoadingScreenThread != null) { _LoadingScreenThread.Interrupt(); } //this check prevents the appearance of the loader //or its closing/disposing if shown //have not found the answer //if (_ls !=null) //{ _ls.Close(); _ls.Dispose(); //} _LoadingScreenThread = null; } }
private async Task UpdateWorkingHour() { if (ValidateInputs()) { WorkingHourEditVM workingHourEditVM = new WorkingHourEditVM() { Id = workingHour.Id, DayInWeek = TbDayInWeek.Text, TimeStart = TpTimeStart.Value.Value.TimeOfDay, TimeEnd = TpTimeEnd.Value.Value.TimeOfDay }; ls.LblLoading.Text = "Editing"; ls.Show(); bool success = await workingHourApi.UpdateWorkingHour(workingHourEditVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required!"); } }
private async Task UpdateService() { if (ValidateInputs()) { ServiceEditVM serviceEditVM = new ServiceEditVM() { Id = service.Id, Name = TbName.Text, Price = decimal.Parse(TbPrice.Text) }; ls.LblLoading.Text = "Editing"; ls.Show(); bool success = await serviceApi.UpdateService(serviceEditVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required and price must be a number!"); } }
public async Task UpdateDatabase() { await DoWork(); ldScreen.Close(); CleanTemp(); }
private async Task InsertOwner() { if (ValidateInputs()) { OwnerInsertVM ownerInsertVM = new OwnerInsertVM() { Username = TbUsername.Text, Password = TbPassword.Password, Email = TbEmail.Text, FirstName = TbFirstName.Text, LastName = TbLastName.Text, Pin = TbPin.Text, Subscription = (Subscription)CbSubscriptions.SelectedItem }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await ownerApi.InsertOwner(ownerInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required and Password must match Confirm password!"); } }
private async Task InsertHairSalon() { if (ValidateInputs()) { HairSalonInsertVM hairSalonInsertVM = new HairSalonInsertVM() { Name = TbName.Text, Description = TbDescription.Text, Address = TbAddress.Text, City = TbCity.Text, Country = (Country)CbCountries.SelectedItem, OwnerId = owner.Id }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await hairSalonApi.InsertHairSalon(hairSalonInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required!"); } }
private async Task InsertWorker() { if (ValidateInputs()) { WorkerInsertVM workerInsertVM = new WorkerInsertVM() { Username = TbUsername.Text, Password = TbPassword.Password, FirstName = TbFirstName.Text, LastName = TbLastName.Text, PhoneNumber = TbPhoneNumber.Text, OwnerId = owner.Id }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await workerApi.InsertWorker(workerInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required and Password must match Confirm password!"); } }
private async Task InsertSubscription() { if (ValidateInputs()) { SubscriptionInsertVM subscriptionInsertVM = new SubscriptionInsertVM() { Type = TbType.Text, Price = decimal.Parse(TbPrice.Text) }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await subscriptionApi.InsertSubscription(subscriptionInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required and price must be a number!"); } }
private async Task InsertMethodOfPayment() { if (ValidateInputs()) { MethodOfPaymentInsertVM methodOfPaymentInsertVM = new MethodOfPaymentInsertVM() { Method = TbMethod.Text }; ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await methodOfPaymentApi.InsertMethodOfPayment(methodOfPaymentInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show("All input fields are required!"); } }
void BackgroundWorkerMainRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (ls != null) { ls.Close(); } }
private async Task InsertAppointment() { if (ValidateInputs()) { List <Service> services = new List <Service>(); foreach (Service service in LbServices.Items) { services.Add(service); } AppointmentInsertVM appointmentInsertVM = new AppointmentInsertVM() { Date = DpDate.SelectedDate.Value, Time = TpTime.Value.Value.TimeOfDay, RegisteredUser = (RegisteredUser)CbCustomers.SelectedItem, Services = services, HairSalonId = worker.HairSalonId, Worker = worker, MethodOfPayment = (MethodOfPayment)CbMethodsOfPayment.SelectedItem }; bool appointmentIsNotAvailable = await appointmentApi.CheckAppointmentAvailability(new CheckAvailabilityVM() { Date = appointmentInsertVM.Date, Time = appointmentInsertVM.Time, WorkerId = appointmentInsertVM.Worker.Id }); if (appointmentIsNotAvailable) { MessageBox.Show("Appointment is not available!"); return; } ls.LblLoading.Text = "Adding"; ls.Show(); bool success = await appointmentApi.InsertAppointment(appointmentInsertVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail!"); } } else { MessageBox.Show( "All input fields are required!\n" + "You must select atleast one service!"); } }
public static void CloseLoadingScreen() { try { loadingScreen.DialogResult = DialogResult.OK; loadingScreen.Close(); loadingScreen.Dispose(); loadingScreen = null; } catch { } }
private async Task DeleteOwner() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await ownerApi.DeleteOwner(owner.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail!"); } }
private async Task DeleteSubscription() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await subscriptionApi.DeleteSubscription(subscription.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail!"); } }
private async Task DeleteService() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await serviceApi.DeleteService(service.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail!"); } }
// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D>(); initialGun.onGunShot += OnGunShot; onHeartReset(); for (int i = 0; i < hearts; ++i) { onHeartGained(); } LoadingScreen.Close(); }
private async Task DeleteHairSalon() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await hairSalonApi.DeleteHairSalon(hairSalon.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail"); } }
private async Task DeleteAdmin() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await adminApi.DeleteAdmin(admin.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail!"); } }
private async Task DeleteMethodOfPayment() { ls.LblLoading.Text = "Deleting"; ls.Show(); bool success = await methodOfPaymentApi.DeleteMethodOfPayment(methodOfPayment.Id); ls.Close(); if (success == false) { MessageBox.Show("Fail!"); } }
private IEnumerator StartGame(LoadingScreen loadScreen) { Debug.Log("[START GAME] GameState Restart..."); GameState.Restart(); started = true; Debug.Log("[START GAME] Game Resuming..."); if (GameState.Data.isRestoreAfterOpen()) { GameState.OnGameResume(); } Debug.Log("[START GAME] After Game Load..."); foreach (var g in PriorityAttribute.OrderExtensionsByMethod("OnAfterGameLoad", gameExtensions)) { yield return(StartCoroutine(g.OnAfterGameLoad())); } uAdventureRaycaster = FindObjectOfType <uAdventureRaycaster>(); if (!uAdventureRaycaster) { Debug.LogError("No uAdventureRaycaster was found in the scene!"); } else { // When clicks are out, i capture them uAdventureRaycaster.Base = this.gameObject; } if (!TransitionManager) { Debug.LogError("No TransitionManager was found in the scene!"); } Debug.Log("[START GAME] Running Target..."); RunTarget(forceScene ? scene_name : GameState.CurrentTarget); yield return(new WaitUntil(() => !waitingRunTarget)); Debug.Log("[START GAME] Game Ready..."); foreach (var g in PriorityAttribute.OrderExtensionsByMethod("OnGameReady", gameExtensions)) { yield return(StartCoroutine(g.OnGameReady())); } uAdventureInputModule.LookingForTarget = null; TimerController.Instance.Timers = GameState.GetTimers(); TimerController.Instance.Run(); Debug.Log("[START GAME] Done! (Waiting for target to be ready)"); loadScreen.Close(); }
private void StartExport(string path) { ReferenceHandler.Instance.GetRightPointerRenderer().enabled = false; LoadingScreen.Show(); FileAttributes attr = File.GetAttributes(path); if (!attr.HasFlag(FileAttributes.Directory)) { return; } if (Util.DataLoadInfo._dataType == Util.Datatype.pcd) { Export.ExportPcd(path); } else if (Util.DataLoadInfo._dataType == Util.Datatype.hdf5_DaimlerLidar) { Export.ExportHdf5_DaimlerLidar(path); } LoadingScreen.Close(); ReferenceHandler.Instance.GetRightPointerRenderer().enabled = true; }
private async Task UpdateRegisteredUser() { if (ValidateInputs()) { RegisteredUserEditVM registeredUserEditVM = new RegisteredUserEditVM() { Id = registeredUser.Id, Username = TbUsername.Text, Password = TbPassword.Password, Email = TbEmail.Text, FirstName = TbFirstName.Text, LastName = TbLastName.Text, Address = TbAddress.Text, City = TbCity.Text, Country = (Country)CbCountries.SelectedItem }; ls.LblLoading.Text = "Editing"; ls.Show(); bool success = await registeredUserApi.UpdateRegisteredUser(registeredUserEditVM); ls.Close(); if (success) { Close(); } else { MessageBox.Show("Fail"); } } else { MessageBox.Show("All input fields are required and Password must match Confirm password!"); } }
public void GetGames() { Games = null; LoadingScreen loadingScreen = new LoadingScreen("Detecting installed games..."); loadingScreen.Show(); loadingScreen.Activate(); Dispatcher myThread = Dispatcher.CurrentDispatcher; Task task = new Task(async() => { Games = new ObservableCollection <Game>(GamesUtil.GetInstalledGames()); await myThread.BeginInvoke(DispatcherPriority.Normal, new Action(() => { loadingScreen.Close(); })); }); task.Start(); }
public void GetEntries() { Entries = null; LoadingScreen loadingScreen = new LoadingScreen("Parsing & reading configuration files..."); loadingScreen.Show(); Dispatcher myThread = Dispatcher.CurrentDispatcher; Task task = new Task(async() => { Entries = new ObservableCollection <ConfigEntry>(ConfigUtil.ParseConfigEntries(Game)); await myThread.BeginInvoke(DispatcherPriority.Normal, new Action(() => { loadingScreen.Close(); })); }); task.Start(); }
private static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; DateTime startTime = DateTime.Now; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Update settings from previous version if (Settings.Default.UpgradeRequired) { Settings.Default.Upgrade(); Settings.Default.UpgradeRequired = false; Settings.Default.Save(); } Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(Settings.Default.SelectedCulture); log.Debug("Set culture to " + Thread.CurrentThread.CurrentUICulture); // code to ensure that only one copy of the software is running. Mutex mutex; string strLoc = Assembly.GetExecutingAssembly().Location; FileSystemInfo fileInfo = new FileInfo(strLoc); string sExeName = fileInfo.Name; string mutexName = "Global\\" + sExeName; try { mutex = Mutex.OpenExisting(mutexName); //since it hasn’t thrown an exception, then we already have one copy of the app open. object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); String appTitle = ((AssemblyProductAttribute)attributes[0]).Product; MessageBox.Show(StringResources.ProgramInstanceAlreadyRunning, appTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); Environment.Exit(0); } catch { //since we didn’t find a mutex with that name, create one mutex = new Mutex(true, mutexName); } // Check Data directory if (SettingsUtil.SetDefaultDataDirIfEmpty(Settings.Default)) { Settings.Default.Save(); } SongManager songManager = new SongManager(SettingsUtil.GetSongDirPath(Settings.Default)); ImageManager imgManager = new ImageManager(SettingsUtil.GetImageDirPath(Settings.Default), SettingsUtil.GetThumbDirPath(Settings.Default)) { DefaultThumbSize = Settings.Default.ThumbSize, DefaultEmptyColor = Settings.Default.ProjectionBackColor }; BibleManager bibleManager = new BibleManager(SettingsUtil.GetBibleDirPath(Settings.Default)); if (Settings.Default.ShowLoadingScreen) { LoadingScreen ldg = new LoadingScreen(songManager, imgManager); ldg.SetLabel("PraiseBase Presenter wird gestartet..."); ldg.Show(); ldg.SetLabel("Prüfe Miniaturbilder..."); imgManager.CheckThumbs(false); ldg.SetLabel("Lade Liederdatenbank..."); songManager.Reload(); GC.Collect(); ldg.Close(); ldg.Dispose(); } else { imgManager.CheckThumbs(false); songManager.Reload(); GC.Collect(); } log.Debug(@"Loading took " + (DateTime.Now - startTime).TotalSeconds + @" seconds!"); string setlistFile = null; string songFile = null; // Detect if program is called with a setlist file as argument if (args.Length == 1) { if (File.Exists((args[0]))) { string ext = Path.GetExtension(args[0]); if (ext == "." + SetlistWriter.FileExtension) { setlistFile = args[0]; } else { songFile = args[0]; } } } Form mw; if (songFile != null) { mw = new SongEditor(Settings.Default, imgManager, songFile); } else { mw = new MainWindow(songManager, imgManager, bibleManager, setlistFile); } Application.Run(mw); GC.KeepAlive(mutex); }
void BW_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { LS.Close(); }