Exemplo n.º 1
0
 public void OkDialog()
 {
     if (string.IsNullOrEmpty(LayoutName))
     {
         ViewContext.ShowMessageBox(this, Resources.NameLayoutForm_OkDialog_Name_cannot_be_empty, MessageBoxButtons.OK);
         return;
     }
     if (_existingNames.Contains(LayoutName))
     {
         if (DialogResult.Yes != ViewContext.ShowMessageBox(this, string.Format(Resources.NameLayoutForm_OkDialog_You_already_have_a_layout_named___0____Do_you_want_to_replace_it_, LayoutName), MessageBoxButtons.YesNo))
         {
             return;
         }
     }
     DialogResult = DialogResult.OK;
 }
Exemplo n.º 2
0
        public void Remove(bool prompt)
        {
            var selectedViewNames = new HashSet <ViewName>(chooseViewsControl1.SelectedViews);

            if (selectedViewNames.Count == 0)
            {
                return;
            }
            string message;

            if (selectedViewNames.Count == 1)
            {
                message = string.Format(Resources.ManageViewsForm_BtnRemoveOnClick_Are_you_sure_you_want_to_delete_the_view___0___, selectedViewNames.First().Name);
            }
            else
            {
                message = string.Format(Resources.ManageViewsForm_BtnRemoveOnClick_Are_you_sure_you_want_to_delete_these__0__views_, selectedViewNames.Count);
            }
            if (prompt && ViewContext.ShowMessageBox(this, message, MessageBoxButtons.OKCancel) == DialogResult.Cancel)
            {
                return;
            }
            var namesByGroup = selectedViewNames.ToLookup(name => name.GroupId, name => name.Name);

            foreach (var grouping in namesByGroup)
            {
                ViewContext.DeleteViews(grouping.Key, grouping);
            }
        }