예제 #1
0
 public AcceptKeyForImportForm(EncryptionKey_PropertyPage propertyPage) : this()
 {
     this._propertyPage = propertyPage;
     if (this._propertyPage != null)
     {
         this.Text = string.Format("Enter Key For {0}", this._propertyPage.ScopeNodeAction);
         this.panel1.Controls.Add(this._propertyPage.Control);
         return;
     }
     throw new InvalidOperationException("EncryptionKey PropertyPage Cannot be null.");
 }
예제 #2
0
 public EncryptionKey_PropertiesControl(EncryptionKey_PropertyPage parentPropertyPage)
 {
     this.InitializeComponent();
     this.encryptionKey_PropertyPage = parentPropertyPage;
 }
예제 #3
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;
                        }
                    }
                }
            }
        }