Пример #1
0
        public override string ToString()
        {
            string globalId          = "";
            string start             = "";
            string _title            = "";
            string _processing_state = "";

            if (GlobalId != null)
            {
                globalId = GlobalId;
            }

            if (StartAt != null)
            {
                start = StartAt.ToString();
            }

            if (Title != null)
            {
                _title = Title;
            }

            if (ProcessingState != null)
            {
                _processing_state = ProcessingState;
            }

            return("GlobalId:" + globalId + " / Start:" + start + " / Title:" + _title + " / Processing state:" + _processing_state);
        }
        public async void OnSaveClick(object sender, RoutedEventArgs e)
        {
            if (SaveBtn_IsEnabled)
            {
                DealPostModel model = new DealPostModel
                {
                    start_at    = StartAt.ToString("o"),
                    end_at      = EndAt.ToString("o"),
                    label       = Label,
                    description = Description
                };

                try
                {
                    var customer = await _api.PostDealWithRetryAsync(model);

                    if (customer != null)
                    {
                        Views.ShellPage.ShellFrame.Navigate(typeof(Views.DealsPage), customer);
                    }
                    else
                    {
                        var unknowErrordialog = new Windows.UI.Popups.MessageDialog(
                            "Une erreur est survenue",
                            "Erreur");
                        unknowErrordialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer")
                        {
                            Id = 0
                        });

                        unknowErrordialog.DefaultCommandIndex = 0;

                        var resultUnknow = await unknowErrordialog.ShowAsync();
                    }
                }
                catch (Exception ex)
                {
                    var dialog = new Windows.UI.Popups.MessageDialog(
                        ex.Message,
                        "Erreur"
                        );
                    dialog.Commands.Add(new Windows.UI.Popups.UICommand("Fermer")
                    {
                        Id = 0
                    });

                    dialog.DefaultCommandIndex = 0;

                    var result = await dialog.ShowAsync();
                }
            }
        }