void deleteApplicationGroupsAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     MessageBoxParameters mbp = new MessageBoxParameters();
     mbp.Buttons = MessageBoxButtons.YesNo;
     mbp.Caption = e.Action.DisplayName;
     mbp.DefaultButton = MessageBoxDefaultButton.Button2;
     mbp.Icon = MessageBoxIcon.Question;
     mbp.Text = String.Format(Globalization.MultilanguageResource.GetString("ApplicationGroupsListView_Msg10"));
     DialogResult dr = this.SnapIn.Console.ShowDialog(mbp);
     if (dr == DialogResult.Yes)
     {
         try
         {
             foreach (ApplicationGroupScopeNode applicationGroupScopeNode in this.SelectedNodes)
             {
                 applicationGroupScopeNode.ApplicationGroup.Delete();
                 this.ScopeNode.Children.Remove(applicationGroupScopeNode);
             }
         }
         catch (Exception ex)
         {
             this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("ApplicationGroupsListView_Msg20"));
         }
     }
 }
Ejemplo n.º 2
0
 protected void internalShowDialog(string text, string caption, MessageBoxIcon icon)
 {
     try
     {
         MessageBoxParameters mbp = new MessageBoxParameters();
         mbp.Buttons = MessageBoxButtons.OK;
         mbp.Caption = caption;
         mbp.Text = text;
         mbp.Icon = icon;
         this.Console.ShowDialog(mbp);
     }
     catch (Exception ex)
     {
         // set up the update authorizationType pane when scope node selected
         MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
         mvd.DisplayName = caption;
         mvd.BodyText = String.Format("{0}\r\n\r\n{1}", text, ex.Message);
         switch (icon)
         {
             case MessageBoxIcon.Warning: mvd.IconId = MMC.MessageViewIcon.Warning; break;
             case MessageBoxIcon.Information: mvd.IconId = MMC.MessageViewIcon.Information; break;
             case MessageBoxIcon.Question: mvd.IconId = MMC.MessageViewIcon.Question; break;
             case MessageBoxIcon.None: mvd.IconId = MMC.MessageViewIcon.None; break;
             default: mvd.IconId = MMC.MessageViewIcon.Error; break;
         }
         // attach the view and set it as the default to show
         this.RootNode.ViewDescriptions.Add(mvd);
     }
 }
Ejemplo n.º 3
0
 public DialogResult ShowDialog(MessageBoxParameters parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException("parameters");
     }
     return this.ShowDialog(null, new ShowDialogCallback(parameters.ShowDialog));
 }
Ejemplo n.º 4
0
 private void internalShowDialog(string text, string caption, MessageBoxIcon icon)
 {
     try
     {
         MessageBoxParameters mbp = new MessageBoxParameters();
         mbp.Buttons = MessageBoxButtons.OK;
         mbp.Caption = caption;
         mbp.Text = text;
         mbp.Icon = icon;
         this.SnapIn.Console.ShowDialog(mbp);
     }
     catch
     { }
 }
        /// <summary>
        /// Check during UserProptertyPage.OnApply to ensure that changes can be Applied
        /// </summary>
        /// <returns>returns true if changes are valid</returns>
        public bool CanApplyChanges()
        {
            bool result = false;

            if (DisplayName.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text = "Display Name cannot be blank";
                scopePropertyPage.ParentSheet.ShowDialog(messageBoxParameters);

                // MessageBox.Show("Display Name cannot be blank");
            }
            else
            {
                result = true;
            }
            return result;
        }
Ejemplo n.º 6
0
 protected void internalShowDialog(string text, string caption, MessageBoxIcon icon)
 {
     try
     {
         this.SnapIn.RegisterCurrentThreadForUI();
         MessageBoxParameters mbp = new MessageBoxParameters();
         mbp.Buttons = MessageBoxButtons.OK;
         mbp.Caption = caption;
         mbp.Text = text;
         mbp.Icon = icon;
         this.SnapIn.Console.ShowDialog(mbp);
     }
     catch
     {
         //
     }
     finally
     {
         this.SnapIn.UnregisterCurrentThreadForUI();
     }
 }
 /// <summary>
 /// OnLoadCustomData method implmentation
 /// </summary>
 protected override void OnLoadCustomData(AsyncStatus status, byte[] persistenceData)
 {
     try
     {
         if (persistenceData != null)
         {
             try
             {
                 MMCPersistenceData data = (MMCPersistenceData)persistenceData;
                 MMCService.Filter = data.Filter;
                 if (data.Language == 0)
                 {
                     if (CultureInfo.DefaultThreadCurrentUICulture != CultureInfo.InstalledUICulture)
                     {
                         CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InstalledUICulture;
                         BuildNodes(false);
                     }
                 }
                 else
                 if (CultureInfo.DefaultThreadCurrentUICulture != new CultureInfo(data.Language))
                 {
                     CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(data.Language);
                     BuildNodes(false);
                 }
             }
             catch (SerializationException)
             {
                 //nothing
             }
         }
     }
     catch (Exception ex)
     {
         MessageBoxParameters msgp = new MessageBoxParameters();
         msgp.Text    = ex.Message;
         msgp.Buttons = MessageBoxButtons.OK;
         msgp.Icon    = MessageBoxIcon.Error;
         this.Console.ShowDialog(msgp);
     }
 }
 /// <summary>
 /// SaveData method implementation
 /// </summary>
 internal void SaveData()
 {
     this.Cursor = Cursors.WaitCursor;
     try
     {
         ManagementService.ADFSManager.WriteConfiguration(null);
     }
     catch (Exception ex)
     {
         this.Cursor = Cursors.Default;
         MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
         messageBoxParameters.Text    = ex.Message;
         messageBoxParameters.Buttons = MessageBoxButtons.OK;
         messageBoxParameters.Icon    = MessageBoxIcon.Error;
         this.SnapIn.Console.ShowDialog(messageBoxParameters);
     }
     finally
     {
         RefreshData();
         this.Cursor = Cursors.Default;
     }
 }
        /// <summary>
        /// Check during UserProptertyPage.OnApply to ensure that changes can be Applied
        /// </summary>
        /// <returns>returns true if changes are valid</returns>
        public bool CanApplyChanges()
        {
            bool result = false;

            if (UserName.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text = "Name cannot be blank";
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            else if (Birthday.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text = "Birthday cannot be blank";
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            else
            {
                result = true;
            }
            return result;
        }
Ejemplo n.º 10
0
 protected override void OnDelete(MMC.SyncStatus status)
 {
     MessageBoxParameters msg = new MessageBoxParameters();
     msg.Caption = Globalization.MultilanguageResource.GetString("Menu_Msg270");
     msg.Text = String.Format(Globalization.MultilanguageResource.GetString("Menu_Msg280")+"\r\n'{0}'", this.application.Name);
     msg.Icon = MessageBoxIcon.Question;
     msg.Buttons = MessageBoxButtons.YesNo;
     msg.DefaultButton = MessageBoxDefaultButton.Button2;
     DialogResult dr = this.SnapIn.Console.ShowDialog(msg);
     if (dr == DialogResult.Yes)
     {
         try
         {
             this.application.Delete();
             this.Parent.Children.Remove(this);
         }
         catch (Exception ex)
         {
             this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("Menu_Msg290"));
         }
     }
 }
        /// <summary>
        /// BTNSendByMail_Click event
        /// </summary>
        private void BTNSendByMail_Click(object sender, EventArgs e)
        {
            Cursor crs = this.Cursor;
            int    cnt = 0;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                MFAUserList lst = userPropertyPage.GetSharedUserData();
                foreach (MFAUser reg in lst)
                {
                    string secret = MMCService.GetEncodedUserKey(reg.UPN);
                    MMCService.SendKeyByEmail(reg.MailAddress, reg.UPN, secret);
                    cnt++;
                }
            }
            catch (Exception ex)
            {
                this.Cursor = crs;
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                {
                    Text    = ex.Message,
                    Buttons = MessageBoxButtons.OK,
                    Icon    = MessageBoxIcon.Error
                };
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            finally
            {
                this.Cursor = crs;
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                {
                    Text    = string.Format(errors_strings.InfosSendingMails, cnt),
                    Buttons = MessageBoxButtons.OK,
                    Icon    = MessageBoxIcon.Information
                };
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
        }
        /// <summary>
        /// Check during UserProptertyPage.OnApply to ensure that changes can be Applied
        /// </summary>
        /// <returns>returns true if changes are valid</returns>
        public bool CanApplyChanges()
        {
            bool result = false;

            if (UserName.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text = "Name cannot be blank";
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            else if (Birthday.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text = "Birthday cannot be blank";
                userPropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            else
            {
                result = true;
            }
            return(result);
        }
        private static DialogResult Show(object owner, string message, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
        {
            DialogResult ret = DialogResult.None;

            lock (MsgBoxUtil.sync)
            {
                MessageBoxParameters parameters = new MessageBoxParameters();
                parameters.Caption       = Properties.Resources.EnterpriseSSO;
                parameters.Text          = message;
                parameters.Buttons       = buttons;
                parameters.Icon          = icon;
                parameters.DefaultButton = defaultButton;
                if (owner is PropertySheet)
                {
                    ret = (owner as PropertySheet).ShowDialog(parameters);
                }
                else if (owner is NamespaceSnapInBase)
                {
                    ret = (owner as NamespaceSnapInBase).Console.ShowDialog(parameters);
                }
            }
            return(ret);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// CancelData method implementation
 /// </summary>
 internal void CancelData()
 {
     try
     {
         MessageBoxParameters     messageBoxParameters = new MessageBoxParameters();
         ComponentResourceManager resources            = new ComponentResourceManager(typeof(ServiceTOTPViewControl));
         messageBoxParameters.Text    = resources.GetString("SECVALIDSAVE");
         messageBoxParameters.Buttons = MessageBoxButtons.YesNo;
         messageBoxParameters.Icon    = MessageBoxIcon.Question;
         if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
         {
             RefreshData();
         }
     }
     catch (Exception ex)
     {
         MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
         messageBoxParameters.Text    = ex.Message;
         messageBoxParameters.Buttons = MessageBoxButtons.OK;
         messageBoxParameters.Icon    = MessageBoxIcon.Error;
         this.SnapIn.Console.ShowDialog(messageBoxParameters);
     }
 }
Ejemplo n.º 15
0
        protected override void OnDelete(MMC.SyncStatus status)
        {
            MessageBoxParameters msg = new MessageBoxParameters();

            msg.Caption       = Globalization.MultilanguageResource.GetString("Menu_Msg270");
            msg.Text          = String.Format(Globalization.MultilanguageResource.GetString("Menu_Msg280") + "\r\n'{0}'", this.application.Name);
            msg.Icon          = MessageBoxIcon.Question;
            msg.Buttons       = MessageBoxButtons.YesNo;
            msg.DefaultButton = MessageBoxDefaultButton.Button2;
            DialogResult dr = this.SnapIn.Console.ShowDialog(msg);

            if (dr == DialogResult.Yes)
            {
                try
                {
                    this.application.Delete();
                    this.Parent.Children.Remove(this);
                }
                catch (Exception ex)
                {
                    this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("Menu_Msg290"));
                }
            }
        }
Ejemplo n.º 16
0
 protected override void OnDelete(MMC.SyncStatus status)
 {
     MessageBoxParameters mbp = new MessageBoxParameters();
     mbp.Buttons = MessageBoxButtons.YesNo;
     mbp.Caption = Globalization.MultilanguageResource.GetString("Menu_Msg420");
     mbp.DefaultButton = MessageBoxDefaultButton.Button2;
     mbp.Icon = MessageBoxIcon.Question;
     mbp.Text = String.Format(Globalization.MultilanguageResource.GetString("Menu_Msg430")+"\r\n'{0}'", this.storeGroup.Name);
     DialogResult dr = this.SnapIn.Console.ShowDialog(mbp);
     /*Application.DoEvents();*/
     if (dr == DialogResult.Yes)
     {
         try
         {
             this.storeGroup.Delete();
             this.Parent.Children.Remove(this);
             /*Application.DoEvents();*/
         }
         catch (Exception ex)
         {
             this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("StoreGroupScopeNode_Msg20"));
         }
     }
 }
Ejemplo n.º 17
0
        public bool CanApplyChanges()
        {
            bool result = false;

            if (this.txtKeyName.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Caption = "Key/Value Pair";
                messageBoxParameters.Text    = "The key cannot be blank";
                this.add_KeyValue_PropertyPage.ParentSheet.ShowDialog(messageBoxParameters);
            }
            else if (this.txtKeyValue.Text.Trim().Length == 0)
            {
                MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters();
                messageBoxParameters2.Caption = "Key/Value Pair";
                messageBoxParameters2.Text    = "The value cannot be blank";
                this.add_KeyValue_PropertyPage.ParentSheet.ShowDialog(messageBoxParameters2);
            }
            else
            {
                result = true;
            }
            return(result);
        }
Ejemplo n.º 18
0
 public DialogResult ShowDialog(MessageBoxParameters parameters)
 {
     return this._dialogHost.ShowDialog(parameters);
 }
Ejemplo n.º 19
0
        protected override void OnAction(Microsoft.ManagementConsole.Action action, AsyncStatus status)
        {
            string a;

            if ((a = (string)action.Tag) != null)
            {
                if (a == "Delete")
                {
                    ScopeNode scopeNode = new ScopeNode();
                    scopeNode.DisplayName = base.DisplayName;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    sSO.GetApplications();
                    int index = 0;
                    for (int i = 0; i < base.Parent.Children.Count; i++)
                    {
                        if (Parent.Children[i].DisplayName.ToUpper() == DisplayName.ToUpper())
                        {
                            index = i;
                        }
                    }
                    sSO.DeleteApplication(base.DisplayName);
                    Parent.Children.RemoveAt(index);
                    return;
                }
                if (a == "Add_KeyValue")
                {
                    if (DisplayName.ToUpper() == "_NewApplication".ToUpper())
                    {
                        EnabledStandardVerbs = StandardVerbs.None;
                    }
                    _hasKeyValuePropertyPage = true;
                    ShowPropertySheet("Add Key/Value Pair");
                    OnRefresh(status);
                    base.OnRefresh(status);
                    return;
                }
                if (a == "Add_Application")
                {
                    string[] array  = new string[1];
                    string[] array2 = new string[1];
                    array[0]  = "";
                    array2[0] = "";
                    string text = "_NewApplication";
                    bool   flag = false;
                    bizilante.SSO.Helper.SSO sSO = new bizilante.SSO.Helper.SSO();
                    string[] applications        = sSO.GetApplications();
                    for (int j = 0; j < applications.Length; j++)
                    {
                        if (applications[j].ToUpper() == text.ToUpper())
                        {
                            flag = true;
                        }
                    }
                    if (flag)
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                        messageBoxParameters.Text    = "This application already exists";
                        messageBoxParameters.Caption = "Add New Application";
                        messageBoxParameters.Icon    = MessageBoxIcon.Exclamation;
                        SnapIn.Console.ShowDialog(messageBoxParameters);
                    }
                    else
                    {
                        ScopeNode scopeNode2 = new ScopeNode();
                        scopeNode2.DisplayName = "_NewApplication";
                        ScopeNode scopeNode3 = new ScopeNode();
                        Children.Add(scopeNode2);
                        int count = Children.Count;
                        sSO.CreateApplicationFieldsValues("_NewApplication", array, array2);
                        Children[count - 1] = new ApplicationScopeNode("_NewApplication");
                    }
                    base.OnRefresh(status);
                    return;
                }
                if (!(a == "Export"))
                {
                    if (!(a == "Import"))
                    {
                        return;
                    }
                    DialogResult dialogResult = SSOHelper.OpenSSOImportFile(
                        out _applicationFileName,
                        out _encryptedText,
                        this);
                    if (dialogResult != DialogResult.Cancel)
                    {
                        EncryptionKey_PropertyPage encryptionKey_PropertyPage =
                            new EncryptionKey_PropertyPage("Import", _applicationFileName, _encryptedText);
                        encryptionKey_PropertyPage.EncryptionKeyEnteredForImport +=
                            new EventHandler <EventArgs <bool, string> >(propertyPage_EncryptionKeyEnteredForImport);
                        AcceptKeyForImportForm form =
                            new AcceptKeyForImportForm(encryptionKey_PropertyPage);
                        base.SnapIn.Console.ShowDialog(form);
                    }
                    base.OnRefresh(status);
                }
                else
                {
                    EncryptionKey_PropertyPage encryptionKey_PropertyPage2 =
                        new EncryptionKey_PropertyPage("Export", base.DisplayName);
                    AcceptKeyForImportForm form2 = new AcceptKeyForImportForm(encryptionKey_PropertyPage2);
                    base.SnapIn.Console.ShowDialog(form2);
                    if (encryptionKey_PropertyPage2.EncryptionKey != null && encryptionKey_PropertyPage2.EncryptionKey.Length != 0)
                    {
                        if (!SSOHelper.ExportSSOApplication(base.DisplayName, encryptionKey_PropertyPage2.EncryptionKey, this))
                        {
                            MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters();
                            messageBoxParameters2.Text    = "Error exporting the application.  Please check the event log for further information";
                            messageBoxParameters2.Caption = "Export Application Error";
                            messageBoxParameters2.Icon    = MessageBoxIcon.Hand;
                            base.SnapIn.Console.ShowDialog(messageBoxParameters2);
                            return;
                        }
                    }
                }
            }
        }
        /// <summary>
        /// CanApplyDataChanges method implementation
        /// </summary>
        private bool CanApplyDataChanges(MMCRegistration registration)
        {
            bool result = false;

            if (registration.IsApplied)
            {
                return(true);
            }
            if (string.IsNullOrEmpty(registration.UPN))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "le nom de l'utilsateur ne peux être vide !";
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else if (string.IsNullOrEmpty(KeysManager.ReadKey(registration.UPN)))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Une clé numérique valide est requise pour générer des codes TOTP permettant de valider votre identité !";
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(1);
            }
            else if (string.IsNullOrEmpty(registration.MailAddress))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Une adresse de messagerie secondaire est requis pour recevoir les codes par e-mails !\rSouhaitez-vous continuer ?";
                messageBoxParameters.Buttons = MessageBoxButtons.YesNo;
                messageBoxParameters.Icon    = MessageBoxIcon.Warning;
                if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                {
                    result = true;
                }
                else
                {
                    ParentSheet.SetActivePage(0);
                }
            }
            else if (!ManagementAdminService.IsValidEmail(registration.MailAddress))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Adresse de messagerie secondaire invalide !";
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else if (string.IsNullOrEmpty(registration.PhoneNumber))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Un N° de téléphone est requis pour recevoir les codes par SMS !\r\rSouhaitez-vous continuer ?";
                messageBoxParameters.Buttons = MessageBoxButtons.YesNo;
                messageBoxParameters.Icon    = MessageBoxIcon.Warning;
                if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                {
                    result = true;
                }
                else
                {
                    ParentSheet.SetActivePage(0);
                }
            }
            else if (!ManagementAdminService.IsValidPhone(registration.PhoneNumber))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = "Un N° de téléphone valide est requis pour recevoir les codes par SMS !";
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else
            {
                result = true;
            }
            return(result);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// 创建一个消息框参数。
 /// </summary>
 /// <param name="content">消息内容。</param>
 /// <returns>返回消息框参数的实例。</returns>
 public static MessageBoxParameters CreateParameters(string content)
 {
     var parameters = new MessageBoxParameters();
     parameters.Content.Text = content;
     return parameters;
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Handle triggered action
        /// </summary>
        /// <param name="action">triggered action</param>
        /// <param name="status">synchronous status to update console</param>
        protected override void  OnSyncAction(SyncAction action, SyncStatus status)
        {
            switch ((string)action.Tag)
            {
            case "ConnectTo":
            {
                ConnectDialog connectDialog = new ConnectDialog();
                connectDialog.ConnectToServerName.Text = String.Empty;

                if (this.SnapIn.Console.ShowDialog(connectDialog) == DialogResult.OK)
                {
                    this.DisplayName = "Connected (" + connectDialog.ConnectToServerName.Text + ")";
                }
                break;
            }

            case "CommonDialog":
            {
                ColorDialog colorDialog = new ColorDialog();
                colorDialog.AllowFullOpen = false;

                if (this.SnapIn.Console.ShowDialog(colorDialog) == DialogResult.OK)
                {
                    this.DisplayName = "CommonDialog - Selected a Color";
                }
                break;
            }

            case "MessageBox":
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();

                messageBoxParameters.Caption = "Sample MessageBox...";
                messageBoxParameters.Buttons = MessageBoxButtons.OKCancel;
                messageBoxParameters.Text    = "Select Ok or Cancel";

                if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.OK)
                {
                    this.DisplayName = "MessageBox - Selected Ok";
                }
                break;
            }

            case "UserDefinedForm":
            {
                UserDefinedForm userDefinedForm = new UserDefinedForm();

                if (this.SnapIn.Console.ShowDialog(userDefinedForm) == DialogResult.OK)
                {
                    this.DisplayName = "User Defined Form - Ok";
                }
                break;
            }

            case "UserDefinedFormWithWaitCursor":
            {
                WaitCursor waitCursor = new WaitCursor();
                waitCursor.Timeout = new System.TimeSpan(0, 0, 5);

                UserDefinedFormForWaiting userDefinedFormForWaiting = new UserDefinedFormForWaiting();

                if (this.SnapIn.Console.ShowDialog(userDefinedFormForWaiting, waitCursor) == DialogResult.OK)
                {
                    this.DisplayName = "User Defined Form with Wait Cursor - Ok";
                }
                break;
            }
            }
        }
 void deleteAuthorizationsAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     MessageBoxParameters mbp = new MessageBoxParameters();
     mbp.Buttons = MessageBoxButtons.YesNo;
     mbp.Caption = e.Action.DisplayName;
     mbp.DefaultButton = MessageBoxDefaultButton.Button2;
     mbp.Icon = MessageBoxIcon.Question;
     mbp.Text = String.Format(Globalization.MultilanguageResource.GetString("Menu_Msg50"));
     DialogResult dr = this.SnapIn.Console.ShowDialog(mbp);
     if (dr == DialogResult.Yes)
     {
         try
         {
             foreach (MMC.ResultNode resultNode in this.SelectedNodes)
             {
                 IAzManAuthorization auth = (IAzManAuthorization)resultNode.Tag;
                 auth.Delete();
                 this.ResultNodes.Remove(resultNode);
             }
         }
         catch (Exception ex)
         {
             this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("AuthorizationsListView_Tit20"));
         }
     }
 }
        /// <summary>
        /// CanApplyDataChanges method implementation
        /// </summary>
        private bool CanApplyDataChanges(Registration registration)
        {
            bool result = false;

            if (registration.IsApplied)
            {
                return(true);
            }
            if (string.IsNullOrEmpty(registration.UPN))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEVALIDUSER;
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else if (string.IsNullOrEmpty(MMCService.GetEncodedUserKey(registration.UPN)))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEVALIDKEY;
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(1);
            }
            else if (string.IsNullOrEmpty(registration.MailAddress))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEVALIDMAIL;
                messageBoxParameters.Buttons = MessageBoxButtons.YesNo;
                messageBoxParameters.Icon    = MessageBoxIcon.Warning;
                if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                {
                    result = true;
                }
                else
                {
                    ParentSheet.SetActivePage(0);
                }
            }
            else if (!MMCService.IsValidEmail(registration.MailAddress))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEINVALIDMAIL;
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else if (string.IsNullOrEmpty(registration.PhoneNumber))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEVALIDPHONE;
                messageBoxParameters.Buttons = MessageBoxButtons.YesNo;
                messageBoxParameters.Icon    = MessageBoxIcon.Warning;
                if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                {
                    result = true;
                }
                else
                {
                    ParentSheet.SetActivePage(0);
                }
            }
            else if (!MMCService.IsValidPhone(registration.PhoneNumber))
            {
                MessageBoxParameters messageBoxParameters = new MessageBoxParameters();
                messageBoxParameters.Text    = res.PPAGEINVALIDPHONE;
                messageBoxParameters.Buttons = MessageBoxButtons.OK;
                messageBoxParameters.Icon    = MessageBoxIcon.Error;
                ParentSheet.ShowDialog(messageBoxParameters);
                ParentSheet.SetActivePage(0);
            }
            else
            {
                result = true;
            }
            return(result);
        }
        /// <summary>
        /// Handle triggered action
        /// </summary>
        /// <param name="action">triggered action</param>
        /// <param name="status">synchronous status to update console</param>
        protected override void OnSyncAction(SyncAction action, SyncStatus status)
        {
            switch ((string)action.Tag)
            {
                case "ConnectTo":
                    {
                        ConnectDialog connectDialog = new ConnectDialog();
                        connectDialog.ConnectToServerName.Text = String.Empty;

                        if (this.SnapIn.Console.ShowDialog(connectDialog) == DialogResult.OK)
                        {
                            this.DisplayName = "Connected (" + connectDialog.ConnectToServerName.Text + ")";
                        }
                        break;
                    }
                case "CommonDialog":
                    {
                        ColorDialog colorDialog = new ColorDialog();
                        colorDialog.AllowFullOpen = false;

                        if (this.SnapIn.Console.ShowDialog(colorDialog) == DialogResult.OK)
                        {
                            this.DisplayName = "CommonDialog - Selected a Color";
                        }
                        break;
                    }
                case "MessageBox":
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters();

                        messageBoxParameters.Caption = "Sample MessageBox...";
                        messageBoxParameters.Buttons = MessageBoxButtons.OKCancel;
                        messageBoxParameters.Text = "Select Ok or Cancel";

                        if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.OK)
                        {
                            this.DisplayName = "MessageBox - Selected Ok";
                        }
                        break;
                    }
                case "UserDefinedForm":
                    {
                        UserDefinedForm userDefinedForm = new UserDefinedForm();

                        if (this.SnapIn.Console.ShowDialog(userDefinedForm) == DialogResult.OK)
                        {
                            this.DisplayName = "User Defined Form - Ok";
                        }
                        break;
                    }
                case "UserDefinedFormWithWaitCursor":
                    {
                        WaitCursor waitCursor = new WaitCursor();
                        waitCursor.Timeout = new System.TimeSpan(0,0,5);

                        UserDefinedFormForWaiting userDefinedFormForWaiting = new UserDefinedFormForWaiting();

                        if (this.SnapIn.Console.ShowDialog(userDefinedFormForWaiting, waitCursor) == DialogResult.OK)
                        {
                            this.DisplayName = "User Defined Form with Wait Cursor - Ok";
                        }
                        break;
                    }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 创建一个包含“继续”和“取消”的请求消息框参数。
        /// </summary>
        /// <param name="content">消息内容。</param>
        /// <param name="caption">消息标题。</param>
        /// <returns>返回消息框参数的实例。</returns>
        public static MessageBoxParameters CreateWarnParameters(string content, string caption)
        {
            var parameters = new MessageBoxParameters();
            parameters.Content.Text = content;
            parameters.Caption.Text = caption;
            parameters.Icon.MessageBoxIcon = MessageBoxIconEx.Warning;
            parameters.Buttons = MessageBoxButtons.OKCancel;
            parameters.Button1.Text = "继续(&G)";
            parameters.DefaultButton = MessageBoxDefaultButton.Button2;

            return parameters;
        }
Ejemplo n.º 27
0
        private void OnUpgrade(SyncStatus status)
        {
            IConfigurator configurator = GetCompanyConfigurator();

            // Check New Updates
            int codeVersion = this.CompanyInfo.CodeVersion;
            int[] availableUpdates = configurator.ListUpdates();

            bool bDetectNewUpdate = false;

            foreach (int availableUpdate in availableUpdates)
            {
                if (codeVersion < availableUpdate)
                {
                    bDetectNewUpdate = true;
                    break;
                }
            }

            if (bDetectNewUpdate)
            {
                // Show Select New Update
                UpdateCompanyForm form = new UpdateCompanyForm(configurator, this.CompanyInfo);

                if (DialogResult.Retry == this.SnapIn.Console.ShowDialog(form))
                {
                    Process currentProcess = Process.GetCurrentProcess();

                    // Start a new Process
                    ProcessStartInfo start = configurator.BuildUpdateCommandForCommonComponents(form.GetUpdateId(), currentProcess.Id);

                    // Run Update Common Components
                    Process.Start(start);

                    // Close current process
                    currentProcess.CloseMainWindow();
                }
            }
            else
            {
                MessageBoxParameters msgBox = new MessageBoxParameters();
                msgBox.Icon = MessageBoxIcon.Information;
                msgBox.Caption = SnapInResources.SoftwareUpdate_Caption;
                msgBox.Buttons = MessageBoxButtons.OK;
                msgBox.Text = SnapInResources.SoftwareUpdateMsg_UnableFind;

                this.SnapIn.Console.ShowDialog(msgBox);
            }

            // TODO: Check Common Components Update
            //Process.GetCurrentProcess().CloseMainWindow();
        }
Ejemplo n.º 28
0
 public DialogResult ShowDialog(MessageBoxParameters parameters)
 {
     this.InitializeConsoleDialogHost();
     return this._dialogHost.ShowDialog(parameters);
 }
Ejemplo n.º 29
0
        private void OnUpdateCommonComponentsAction(SyncStatus status)
        {
            // Check New Updates
            int codeVersion = this.GetConfigurator().CommonVersion;

            int[] availableUpdates = this.GetConfigurator().ListUpdates();

            bool bDetectNewUpdate = false;

            foreach (int availableUpdate in availableUpdates)
            {
                if (codeVersion < availableUpdate)
                {
                    bDetectNewUpdate = true;
                    break;
                }
            }

            if (bDetectNewUpdate)
            {
                UpdateCommonComponentsForm form = new UpdateCommonComponentsForm(GetConfigurator());

                if (this.SnapIn.Console.ShowDialog(form) == DialogResult.OK)
                {
                    Process currentProcess = Process.GetCurrentProcess();
                    ProcessStartInfo processStart = GetConfigurator().BuildUpdateCommandForCommonComponents(form.GetUpdateId(), currentProcess.Id);
                    Process.Start(processStart);
                    currentProcess.CloseMainWindow();
                }
            }
            else
            {
                MessageBoxParameters msgBox = new MessageBoxParameters();
                msgBox.Icon = MessageBoxIcon.Information;
                msgBox.Caption = SnapInResources.SoftwareUpdate_Caption;
                msgBox.Buttons = MessageBoxButtons.OK;
                msgBox.Text = SnapInResources.SoftwareUpdateMsg_UnableFind;

                this.SnapIn.Console.ShowDialog(msgBox);
            }
        }
        protected override void OnDelete(MMC.SyncStatus status)
        {
            MessageBoxParameters msg = new MessageBoxParameters();
            switch (this.item.ItemType)
            {
                case ItemType.Role:
                    msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg90");
                    msg.Text = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg100"), this.item.Name);
                    break;
                case ItemType.Task:
                    msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg110");
                    msg.Text = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg120"), this.item.Name);
                    break;
                case ItemType.Operation:
                    msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg130");
                    msg.Text = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg140"), this.item.Name);
                    break;
            }
            msg.Icon = MessageBoxIcon.Question;
            msg.Buttons = MessageBoxButtons.YesNo;
            msg.DefaultButton = MessageBoxDefaultButton.Button2;
            DialogResult dr = this.SnapIn.Console.ShowDialog(msg);
            if (dr == DialogResult.Yes)
            {
                try
                {
                    this.item.Delete();
                    try
                    {
                        //Remove relative child and all its children in Item Authorizations
                        MMC.ScopeNode itemDefinitionsScopeNode = this.Parent.Parent;
                        MMC.ScopeNode itemAuthorizationsScopeNode = itemDefinitionsScopeNode.Parent.Children[2];
                        switch (this.item.ItemType)
                        {
                            case ItemType.Role:
                                if (itemAuthorizationsScopeNode.Children.Count >= 1)
                                    itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[0];
                                else
                                    return;
                                break;
                            case ItemType.Task:
                                if (itemAuthorizationsScopeNode.Children.Count >= 2)
                                    itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[1];
                                else
                                    return;
                                break;
                            case ItemType.Operation:
                                if (itemAuthorizationsScopeNode.Children.Count >= 3)
                                    itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[2];
                                else
                                    return;
                                break;
                        }
                        this.RemoveItemAuthorizationScopeNode(itemAuthorizationsScopeNode, this);
                    }
                    catch { }
                }
                catch (Exception ex)
                {
                    this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("DeleteError_Msg10"));
                }
                finally
                {
                    this.Parent.Children.Remove(this);
                }

            }
        }
Ejemplo n.º 31
0
        /// <summary>
        /// Called when an action is triggered for the node. Derived classes should override this method to provide application-specific handling of the action.
        /// </summary>
        /// <param name="action">The action that has been triggered.</param>
        /// <param name="status">The status object.</param>
        protected override void OnSyncAction(SyncAction action, SyncStatus status)
        {
            if (action == this.CreateNewCompany)
            {
                try
                {
                    OnCreateNewCompany(status);
                }
                catch (LicenseExpiredException)
                {
                    MessageBoxParameters msgBox = new MessageBoxParameters();
                    msgBox.Icon = MessageBoxIcon.Error;
                    msgBox.Caption = SnapInResources.License_Expired;
                    msgBox.Text = string.Format(SnapInResources.License_Expired_Text, Mediachase.Ibn.IbnConst.FullProductName);
                    msgBox.Buttons = MessageBoxButtons.OK;

                    this.SnapIn.Console.ShowDialog(msgBox);
                }
                catch (Exception ex)
                {
                    ThreadExceptionDialog exForm = new ThreadExceptionDialog(ex);
                    this.SnapIn.Console.ShowDialog(exForm);
                }
            }
            else if (action == this.CreateNewCompanyForDatabase)
            {
                try
                {
                    OnCreateNewCompanyForDatabase(status);
                }
                catch (LicenseExpiredException)
                {
                    MessageBoxParameters msgBox = new MessageBoxParameters();
                    msgBox.Icon = MessageBoxIcon.Error;
                    msgBox.Caption = SnapInResources.License_Expired;
                    msgBox.Text = string.Format(SnapInResources.License_Expired_Text, Mediachase.Ibn.IbnConst.FullProductName);
                    msgBox.Buttons = MessageBoxButtons.OK;

                    this.SnapIn.Console.ShowDialog(msgBox);
                }
                catch (Exception ex)
                {
                    ThreadExceptionDialog exForm = new ThreadExceptionDialog(ex);
                    this.SnapIn.Console.ShowDialog(exForm);
                }
            }
        }
Ejemplo n.º 32
0
 /// <summary>
 /// 创建一个消息框参数。
 /// </summary>
 /// <param name="content">消息内容。</param>
 /// <param name="caption">消息标题。</param>
 /// <param name="buttons">消息按钮。</param>
 /// <param name="messageBoxIcon">消息图标。</param>
 /// <param name="defaultButton">默认按钮。</param>
 /// <returns>返回消息框参数的实例。</returns>
 public static MessageBoxParameters CreateParameters(string content, string caption, MessageBoxButtons buttons, MessageBoxIconEx messageBoxIcon, MessageBoxDefaultButton defaultButton)
 {
     var parameters = new MessageBoxParameters();
     parameters.Content.Text = content;
     parameters.Caption.Text = caption;
     parameters.Buttons = buttons;
     parameters.Icon.MessageBoxIcon = messageBoxIcon;
     parameters.DefaultButton = defaultButton;
     return parameters;
 }
        /// <summary>
        /// CanApplyDataChanges method implementation
        /// </summary>
        private bool CanApplyDataChanges(MFAUser registration)
        {
            bool result = true;

            if (registration.IsApplied)
            {
                return(result);
            }
            IExternalProvider prov1 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Code);

            if (prov1 != null)
            {
                if ((prov1.Enabled) && (prov1.IsRequired))
                {
                    if (string.IsNullOrEmpty(registration.UPN))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEVALIDUSER,
                            Buttons = MessageBoxButtons.OK,
                            Icon    = MessageBoxIcon.Error
                        };
                        ParentSheet.ShowDialog(messageBoxParameters);
                        ParentSheet.SetActivePage(0);
                        result = false;
                    }
                    else if (string.IsNullOrEmpty(MMCService.GetEncodedUserKey(registration.UPN)))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEVALIDKEY,
                            Buttons = MessageBoxButtons.OK,
                            Icon    = MessageBoxIcon.Error
                        };
                        ParentSheet.ShowDialog(messageBoxParameters);
                        ParentSheet.SetActivePage(1);
                        result = false;
                    }
                }
            }
            IExternalProvider prov2 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.Email);

            if (prov2 != null)
            {
                if ((prov2.Enabled) && (prov2.IsRequired))
                {
                    if (string.IsNullOrEmpty(registration.MailAddress))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEVALIDMAIL,
                            Buttons = MessageBoxButtons.YesNo,
                            Icon    = MessageBoxIcon.Warning
                        };
                        if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                        {
                            result = true;
                        }
                        else
                        {
                            result = false;
                            ParentSheet.SetActivePage(0);
                        }
                    }
                    else if (!MMCService.IsValidEmail(registration.MailAddress))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEINVALIDMAIL,
                            Buttons = MessageBoxButtons.OK,
                            Icon    = MessageBoxIcon.Error
                        };
                        ParentSheet.ShowDialog(messageBoxParameters);
                        ParentSheet.SetActivePage(0);
                        result = false;
                    }
                }
            }
            IExternalProvider prov3 = RuntimeAuthProvider.GetProviderInstance(PreferredMethod.External);

            if (prov3 != null)
            {
                if ((prov3.Enabled) && (prov3.IsRequired))
                {
                    if (string.IsNullOrEmpty(registration.PhoneNumber))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEVALIDPHONE,
                            Buttons = MessageBoxButtons.YesNo,
                            Icon    = MessageBoxIcon.Warning
                        };
                        if (ParentSheet.ShowDialog(messageBoxParameters) == DialogResult.Yes)
                        {
                            result = true;
                        }
                        else
                        {
                            result = false;
                            ParentSheet.SetActivePage(0);
                        }
                    }
                    else if (!MMCService.IsValidPhone(registration.PhoneNumber))
                    {
                        MessageBoxParameters messageBoxParameters = new MessageBoxParameters
                        {
                            Text    = res.PPAGEINVALIDPHONE,
                            Buttons = MessageBoxButtons.OK,
                            Icon    = MessageBoxIcon.Error
                        };
                        ParentSheet.ShowDialog(messageBoxParameters);
                        ParentSheet.SetActivePage(0);
                        result = false;
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 34
0
 /// <summary>
 /// 创建一个消息框参数。
 /// </summary>
 /// <param name="content">消息内容。</param>
 /// <param name="caption">消息标题。</param>
 /// <param name="buttons">消息按钮。</param>
 /// <returns>返回消息框参数的实例。</returns>
 public static MessageBoxParameters CreateParameters(string content, string caption, MessageBoxButtons buttons)
 {
     var parameters = new MessageBoxParameters();
     parameters.Content.Text = content;
     parameters.Caption.Text = caption;
     parameters.Buttons = buttons;
     return parameters;
 }
        protected override void OnDelete(MMC.SyncStatus status)
        {
            MessageBoxParameters msg = new MessageBoxParameters();

            switch (this.item.ItemType)
            {
            case ItemType.Role:
                msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg90");
                msg.Text    = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg100"), this.item.Name);
                break;

            case ItemType.Task:
                msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg110");
                msg.Text    = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg120"), this.item.Name);
                break;

            case ItemType.Operation:
                msg.Caption = Globalization.MultilanguageResource.GetString("ListView_Msg130");
                msg.Text    = String.Format("{0}\r\n{1}", Globalization.MultilanguageResource.GetString("ListView_Msg140"), this.item.Name);
                break;
            }
            msg.Icon          = MessageBoxIcon.Question;
            msg.Buttons       = MessageBoxButtons.YesNo;
            msg.DefaultButton = MessageBoxDefaultButton.Button2;
            DialogResult dr = this.SnapIn.Console.ShowDialog(msg);

            if (dr == DialogResult.Yes)
            {
                try
                {
                    this.item.Delete();
                    try
                    {
                        //Remove relative child and all its children in Item Authorizations
                        MMC.ScopeNode itemDefinitionsScopeNode    = this.Parent.Parent;
                        MMC.ScopeNode itemAuthorizationsScopeNode = itemDefinitionsScopeNode.Parent.Children[2];
                        switch (this.item.ItemType)
                        {
                        case ItemType.Role:
                            if (itemAuthorizationsScopeNode.Children.Count >= 1)
                            {
                                itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[0];
                            }
                            else
                            {
                                return;
                            }
                            break;

                        case ItemType.Task:
                            if (itemAuthorizationsScopeNode.Children.Count >= 2)
                            {
                                itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[1];
                            }
                            else
                            {
                                return;
                            }
                            break;

                        case ItemType.Operation:
                            if (itemAuthorizationsScopeNode.Children.Count >= 3)
                            {
                                itemAuthorizationsScopeNode = itemAuthorizationsScopeNode.Children[2];
                            }
                            else
                            {
                                return;
                            }
                            break;
                        }
                        this.RemoveItemAuthorizationScopeNode(itemAuthorizationsScopeNode, this);
                    }
                    catch { }
                }
                catch (Exception ex)
                {
                    this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("DeleteError_Msg10"));
                }
                finally
                {
                    this.Parent.Children.Remove(this);
                }
            }
        }
Ejemplo n.º 36
0
        /// <summary>
        /// ManageCerts method implmentation
        /// </summary>
        internal void ManageCerts()
        {
            MessageBoxParameters messageBoxParameters = new MessageBoxParameters
            {
                Caption       = "Multi-Factor Authentication",
                Buttons       = MessageBoxButtons.YesNo,
                DefaultButton = MessageBoxDefaultButton.Button1,
                Icon          = MessageBoxIcon.Question,
                Text          = res.CERTIFICATESSECURITYMSG
            };

            if (this.SnapIn.Console.ShowDialog(messageBoxParameters) == DialogResult.Yes)
            {
                try
                {
                    if (ManagementService.UpdateCertificatesACL())
                    {
                        MessageBoxParameters messageBoxParametersResult = new MessageBoxParameters
                        {
                            Caption       = "Multi-Factor Authentication",
                            Buttons       = MessageBoxButtons.OK,
                            DefaultButton = MessageBoxDefaultButton.Button1,
                            Icon          = MessageBoxIcon.Information,
                            Text          = res.CERTIFICATESSECURITYMSGRESULT
                        };
                        this.SnapIn.Console.ShowDialog(messageBoxParametersResult);
                    }
                }
                catch (Exception ex)
                {
                    MessageBoxParameters messageBoxParametersError = new MessageBoxParameters
                    {
                        Caption       = "Multi-Factor Authentication Error",
                        Buttons       = MessageBoxButtons.OK,
                        DefaultButton = MessageBoxDefaultButton.Button1,
                        Icon          = MessageBoxIcon.Error,
                        Text          = ex.Message
                    };
                    this.SnapIn.Console.ShowDialog(messageBoxParametersError);
                }
            }

            /*
             * MessageBoxParameters messageBoxParameters2 = new MessageBoxParameters
             * {
             *  Caption = "Multi-Factor Authentication",
             *  Buttons = MessageBoxButtons.YesNo,
             *  DefaultButton = MessageBoxDefaultButton.Button1,
             *  Icon = MessageBoxIcon.Question,
             *  Text = res.CERTIFICATESCLEANMSG
             * };
             * if (this.SnapIn.Console.ShowDialog(messageBoxParameters2)==DialogResult.Yes)
             * {
             *  try
             *  {
             *      int nb = ManagementService.CleanOrphanedPrivateKeys(0x00, 0);
             *      MessageBoxParameters messageBoxParametersResult = new MessageBoxParameters
             *      {
             *          Caption = "Multi-Factor Authentication",
             *          Buttons = MessageBoxButtons.OK,
             *          DefaultButton = MessageBoxDefaultButton.Button1,
             *          Icon = MessageBoxIcon.Information,
             *          Text = string.Format(res.CERTIFICATESCLEANMSGCOUNT + " : {0}", nb)
             *      };
             *      this.SnapIn.Console.ShowDialog(messageBoxParametersResult);
             *  }
             *  catch (Exception ex)
             *  {
             *      MessageBoxParameters messageBoxParametersError = new MessageBoxParameters
             *      {
             *          Caption = "Multi-Factor Authentication Error",
             *          Buttons = MessageBoxButtons.OK,
             *          DefaultButton = MessageBoxDefaultButton.Button1,
             *          Icon = MessageBoxIcon.Error,
             *          Text = ex.Message
             *      };
             *      this.SnapIn.Console.ShowDialog(messageBoxParametersError);
             *  }
             * }*/
        }
 void deleteItemDefinitionsAction_Triggered(object sender, MMC.SyncActionEventArgs e)
 {
     MessageBoxParameters mbp = new MessageBoxParameters();
     mbp.Buttons = MessageBoxButtons.YesNo;
     mbp.Caption = e.Action.DisplayName;
     mbp.DefaultButton = MessageBoxDefaultButton.Button2;
     mbp.Icon = MessageBoxIcon.Question;
     mbp.Text = Globalization.MultilanguageResource.GetString("ItemDefinitionsListView_Msg10");
     DialogResult dr = this.SnapIn.Console.ShowDialog(mbp);
     if (dr == DialogResult.Yes)
     {
         try
         {
             foreach (ItemDefinitionScopeNode itemDefinitionScopeNode in this.SelectedNodes)
             {
                 itemDefinitionScopeNode.Item.Delete();
                 //Remove relative child in Item Authorizations
                 MMC.ScopeNode itemDefinitionsScopeNode = itemDefinitionScopeNode.Parent;
                 while (itemDefinitionsScopeNode as ItemDefinitionsScopeNode == null)
                 {
                     itemDefinitionsScopeNode = itemDefinitionsScopeNode.Parent; //go up one level
                 }
                 ItemAuthorizationsScopeNode itemAuthorizationsScopeNode = (ItemAuthorizationsScopeNode)itemDefinitionsScopeNode.Parent.Children[2];
                 foreach (MMC.ScopeNode itemAuthorizationsScopeNodeChild in itemAuthorizationsScopeNode.Children)
                 {
                     bool founded = false;
                     foreach (ItemAuthorizationScopeNode itemAuthorizationScopeNode in itemAuthorizationsScopeNodeChild.Children)
                     {
                         if (itemDefinitionScopeNode.Item.Name == itemAuthorizationScopeNode.Item.Name)
                         {
                             itemAuthorizationScopeNode.Parent.Children.Remove(itemAuthorizationScopeNode);
                             founded = true;
                             break;
                         }
                     }
                     if (founded) break;
                 }
                 this.ScopeNode.Children.Remove(itemDefinitionScopeNode);
             }
         }
         catch (Exception ex)
         {
             this.ShowError(ex.Message, Globalization.MultilanguageResource.GetString("ItemDefinitionsListView_Tit20"));
         }
     }
 }
Ejemplo n.º 38
0
 public static DialogResult Show(MessageBoxParameters p)
 {
     return(MessageBox.Show(p.Text, p.Caption, p.Buttons, p.Icon));
 }