Example #1
0
        public IssuesPage()
        {
            this.InitializeComponent();


            SettingsContext.GetSettingsInformation();

            LoadCustomersAsync().GetAwaiter();
            LoadIssuesAsync().GetAwaiter();
            LoadStatusAsync();
        }
        private async void btnWriteJsonFile_Click(object sender, RoutedEventArgs e)
        {
            await SettingsContext.CreateJsonFileAsync();


            if (string.IsNullOrWhiteSpace(tbxStatus1.Text) && string.IsNullOrWhiteSpace(tbxStatus2.Text) &&
                string.IsNullOrWhiteSpace(tbxStatus3.Text) && !string.IsNullOrWhiteSpace(tbxMaxNumber.Text))
            {
                if (Int32.TryParse(tbxMaxNumber.Text, out int max))
                {
                    await SettingsContext.WriteToJsonFileAsync(new Settings("new", "active", "closed", max));

                    txbStatusSaved.Text = "Saved";
                    var dialog = new MessageDialog($"The Maximum number changed to {max}.");
                    await dialog.ShowAsync();
                }
                else
                {
                    var dialog = new MessageDialog("Please write a number in the field!");
                    await dialog.ShowAsync();
                }
            }
            else
            {
                var dialog = new MessageDialog("Please fill in all fields to change the settings (even the max number). Otherwise settings does not change.");
                await dialog.ShowAsync();
            }

            if (!string.IsNullOrWhiteSpace(tbxStatus1.Text) && !string.IsNullOrWhiteSpace(tbxStatus2.Text) &&
                !string.IsNullOrWhiteSpace(tbxStatus3.Text) && !string.IsNullOrWhiteSpace(tbxMaxNumber.Text))
            {
                if (Int32.TryParse(tbxMaxNumber.Text, out int max))
                {
                    await SettingsContext.WriteToJsonFileAsync(new Settings(tbxStatus1.Text, tbxStatus2.Text, tbxStatus3.Text, max));

                    txbStatusSaved.Text = "Saved";
                    var dialog = new MessageDialog($"The Maximum number changed to {max}. \n The statuses changed to: {tbxStatus1.Text}  {tbxStatus2.Text}  {tbxStatus3.Text}");
                    await dialog.ShowAsync();
                }
                else
                {
                    var dialog = new MessageDialog("Please write a number in the field!");
                    await dialog.ShowAsync();
                }
            }

            SettingsContext.GetSettingsInformation();
        }