Пример #1
0
        private void OnSave(object sender, EventArgs args)
        {
            try
            {
                if (string.IsNullOrEmpty(Username.Text))
                {
                    Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox("Enter username to proceed", MessageType.Regular, promptPageState), true));
                    return;
                }

                if (user.UserName.Equals(Username.Text))
                {
                    Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox("The username you've entered is the same as the current one", MessageType.Regular, promptPageState), true));
                    return;
                }

                //Save configuration
                configuration.Users.Find(x => x.UserName == user.UserName).UserName = Username.Text;
                AiDataStore.SaveConfiguration(configuration);

                //Save user
                user.UserName = Username.Text;
                AiDataStore.SaveUser(user);

                //Close Popup
                promptPageState.OnResumePage(null);
                Task.Run(async() => await PopupNavigation.Instance.RemovePageAsync(this));
            }
            catch (Exception ex)
            {
                Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox(ex.Message, MessageType.Regular, promptPageState), true));
            }
        }
Пример #2
0
        private void OnTrainerAdded(object sender, EventArgs args)
        {
            try
            {
                if (string.IsNullOrEmpty(Name.Text))
                {
                    Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox("Name cannot be empty", MessageType.Regular, promptPageState)));
                }
                else
                {
                    configuration.Trainings.Find(x => x.Name == training.Name).Trainers.Add(new Trainer
                    {
                        Key  = Guid.NewGuid().ToString(),
                        Name = Name.Text
                    });

                    AiDataStore.SaveConfiguration(configuration);
                    promptPageState.OnResumePage(null);
                }
            }
            catch (Exception ex)
            {
                //DisplayAlert("Error", ex.Message);
                Debug.WriteLine($"Exception after Selection Complete:  {ex}");
            }
        }
Пример #3
0
        private void OnProceed(object sender, EventArgs args)
        {
            try
            {
                Task.Run(async() => await PopupNavigation.Instance.RemovePageAsync(this));

                promptPageState.OnResumePage(null);
            }
            catch (Exception ex)
            {
                //DisplayAlert("Error", ex.Message);
                Debug.WriteLine($"Exception after Selection Complete:  {ex}");
            }
        }
 private void OnProceed(object sender, EventArgs args)
 {
     try
     {
         if (filedata != null)
         {
             promptPageState.OnResumePage(filedata);
             Task.Run(async() => await PopupNavigation.Instance.RemovePageAsync(this));
         }
         else
         {
             DisplayAlert(null, "Please select a configuration file to proceed", "Ok");
         }
     }
     catch (Exception ex)
     {
         //DisplayAlert("Error", ex.Message);
         Debug.WriteLine($"Exception after Selection Complete:  {ex}");
     }
 }
Пример #5
0
        private void OnProceed(object sender, EventArgs args)
        {
            try
            {
                Task.Run(async() => await PopupNavigation.Instance.RemovePageAsync(this));

                switch (type)
                {
                case MessageType.Configuration:
                    promptPageState.OnRebound();
                    break;

                case MessageType.Exit:
                case MessageType.Logout:
                    promptPageState.OnExit();
                    break;

                case MessageType.Gps:
                    locationPageState.OnEnableLocation();
                    break;

                case MessageType.Regular:
                    promptPageState.OnResumePage(null);
                    break;

                case MessageType.Warning:
                    promptPageState.OnConfirm();
                    break;

                case MessageType.Discard:
                    promptPageState.OnSaveDraft();
                    break;
                }
            }
            catch (Exception ex)
            {
                //DisplayAlert("Error", ex.Message);
                Debug.WriteLine($"Exception after Selection Complete:  {ex}");
            }
        }
        private void OnTrainerAdded(object sender, EventArgs args)
        {
            try
            {
                if (string.IsNullOrEmpty(Loc.Text))
                {
                    Task.Run(async() => await PopupNavigation.Instance.PushAsync(new MessageBox("Location cannot be empty", MessageType.Regular, promptPageState)));
                }
                else
                {
                    Task.Run(async() => await PopupNavigation.Instance.RemovePageAsync(this));
                    training.Location = Loc.Text;

                    promptPageState.OnResumePage(null);
                }
            }
            catch (Exception ex)
            {
                //DisplayAlert("Error", ex.Message);
                Debug.WriteLine($"Exception after Selection Complete:  {ex}");
            }
        }