Exemplo n.º 1
0
 public static string ChooseWithGrid(string prompt, string caption, Form owner, string btYes, string btNo, string btCancel, string list)
 {
     using (var frm = new ChooseWithGridForm(prompt, caption, list))
     {
         frm.btnYes.Text    = btYes;
         frm.btnNo.Text     = btNo;
         frm.btnCancel.Text = btCancel;
         frm.StartPosition  = FormStartPosition.CenterParent;
         frm.TopMost        = true;
         if (UnitTestMode)
         {
             //frm.Show(owner);
             //System.Threading.Thread.Sleep(2000);
             return(btYes);
         }
         else
         {
             DialogResult res = frm.ShowDialog(owner);
             if (res == DialogResult.Yes)
             {
                 return(btYes);
             }
             if (res == DialogResult.No)
             {
                 return(btNo);
             }
         }
         return(btCancel);
     }
 }
Exemplo n.º 2
0
        private static ResourceAction display(List <FormDescription> forms, string resourceKey, string text)
        {
            if (forms == null || forms.Count <= 0)
            {
                return(ResourceAction.Accept);
            }

            // construct string with list of forms: 1-st string - column captions
            string formDescription = "Key`Caption`FormID`Apptype`Views`Paths`Comment";

            foreach (FormDescription form in forms)
            {
                formDescription += "^";
                formDescription += form.Key + "`";
                formDescription += form.Caption + "`";
                formDescription += form.FormID + "`";
                formDescription += form.Apptype + "`";
                formDescription += form.ViewsString + "`";
                formDescription += form.PathsString + "`";
                formDescription += form.Comment;
            }
            string ret = ChooseWithGridForm.ChooseWithGrid(String.Format("Term {0} is used in other forms. Do you want to save term translation?", text), "",
                                                           null, "Split", "Save", "Cancel", formDescription);

            if (ret == "Split")
            {
                return(ResourceAction.Split);
            }
            if (ret == "Save")
            {
                return(ResourceAction.Accept);
            }
            return(ResourceAction.Cancel);
        }