Ejemplo n.º 1
0
        public override Task<IMarkpadDocument> Publish()
        {
            var save = new ButtonExtras(ButtonType.Yes, "Save", "Saves this modified post to your blog");
            var saveAs = new ButtonExtras(ButtonType.No, "Save As", "Saves this blog post as a local markdown file");
            var publish = new ButtonExtras(ButtonType.Retry, "Publish As", "Publishes this post to another blog, or as another post");

            var service = new DialogMessageService(null)
            {
                Icon = DialogMessageIcon.Question,
                Buttons = DialogMessageButtons.Yes | DialogMessageButtons.No | DialogMessageButtons.Retry | DialogMessageButtons.Cancel,
                Title = "Markpad",
                Text = string.Format("{0} has already been published, what do you want to do?", Title),
                ButtonExtras = new[] { save, saveAs, publish }
            };

            var result = service.Show();
            switch (result)
            {
                case DialogMessageResult.Yes:
                    return Save();
                case DialogMessageResult.No:
                    return SaveAs();
                case DialogMessageResult.Retry:
                    return DocumentFactory.PublishDocument(null, this);
            }

            return TaskEx.FromResult<IMarkpadDocument>(this);
        }
 public void ShowError(string title, string text, string extra, params ButtonExtras[] buttonExtras)
 {
     var service = new DialogMessageService(null)
                   {
                       Icon = DialogMessageIcon.Error,
                       Buttons = DialogMessageButtons.Ok,
                       Title = title,
                       Text = text,
                       Extra = extra,
                       ButtonExtras = buttonExtras
                   };
     service.Show();
 }
 public bool ShowConfirmation(string title, string text, string extra, params ButtonExtras[] buttonExtras)
 {
     var service = new DialogMessageService(null)
                   {
                       Icon = DialogMessageIcon.Question,
                       Buttons = DialogMessageButtons.Yes | DialogMessageButtons.No,
                       Title = title,
                       Text = text,
                       Extra = extra,
                       ButtonExtras = buttonExtras
                   };
     var result = service.Show();
     return result == DialogMessageResult.Yes;
 }
Ejemplo n.º 4
0
        public void ShowError(string title, string text, string extra, params ButtonExtras[] buttonExtras)
        {
            var service = new DialogMessageService(null)
            {
                Icon         = DialogMessageIcon.Error,
                Buttons      = DialogMessageButtons.Ok,
                Title        = title,
                Text         = text,
                Extra        = extra,
                ButtonExtras = buttonExtras
            };

            service.Show();
        }
Ejemplo n.º 5
0
        public bool ShowConfirmation(string title, string text, string extra, params ButtonExtras[] buttonExtras)
        {
            var service = new DialogMessageService(null)
            {
                Icon         = DialogMessageIcon.Question,
                Buttons      = DialogMessageButtons.Yes | DialogMessageButtons.No,
                Title        = title,
                Text         = text,
                Extra        = extra,
                ButtonExtras = buttonExtras
            };
            var result = service.Show();

            return(result == DialogMessageResult.Yes);
        }
 public bool? ShowConfirmationWithCancel(string title, string text, string extra, params ButtonExtras[] buttonExtras)
 {
     var service = new DialogMessageService(null)
                   {
                       Icon = DialogMessageIcon.Question,
                       Buttons = DialogMessageButtons.Yes | DialogMessageButtons.No | DialogMessageButtons.Cancel,
                       Title = title,
                       Text = text,
                       Extra = extra,
                       ButtonExtras = buttonExtras
                   };
     var result = service.Show();
     switch (result)
     {
         case DialogMessageResult.Yes:
             return true;
         case DialogMessageResult.No:
             return false;
     }
     return null;
 }
Ejemplo n.º 7
0
        public bool?ShowConfirmationWithCancel(string title, string text, string extra, params ButtonExtras[] buttonExtras)
        {
            var service = new DialogMessageService(null)
            {
                Icon         = DialogMessageIcon.Question,
                Buttons      = DialogMessageButtons.Yes | DialogMessageButtons.No | DialogMessageButtons.Cancel,
                Title        = title,
                Text         = text,
                Extra        = extra,
                ButtonExtras = buttonExtras
            };
            var result = service.Show();

            switch (result)
            {
            case DialogMessageResult.Yes:
                return(true);

            case DialogMessageResult.No:
                return(false);
            }
            return(null);
        }