protected override bool OnExpandFromLoad(MMC.SyncStatus status)
 {
     status.ReportProgress(50, 100, Globalization.MultilanguageResource.GetString("Expanding_Msg10"));
     this.Render();
     status.Complete(Globalization.MultilanguageResource.GetString("Done_Msg10"), true);
     return(base.OnExpandFromLoad(status));
 }
示例#2
0
 internal void RaiseTriggeredEvent(object sender, SyncStatus status)
 {
     if (this.Triggered != null)
     {
         this.Triggered(sender, new SyncActionEventArgs(this, status));
     }
 }
 internal override void ProcessRequest(Request request)
 {
     if (request.RequestInfo is ExtensionPagesRequestInfo)
     {
         ExtensionPagesRequestInfo requestInfo = request.RequestInfo as ExtensionPagesRequestInfo;
         PropertyPageCollection propertyPageCollection = new PropertyPageCollection();
         IRequestStatus requestStatus = request.RequestStatus;
         SyncStatus status2 = new SyncStatus(requestStatus);
         try
         {
             this.OnAddPropertyPages(propertyPageCollection);
             PropertyPagesResponse response = new PropertyPagesResponse();
             response.SetPropertyPages(propertyPageCollection.ToPropertyPageInfoArray());
             requestStatus.ProcessResponse(response);
         }
         finally
         {
             status2.Close();
         }
         this._extensionPropertySheet = SnapInBase.SnapInInstance.SheetManager.CreatePropertySheet(requestInfo.SheetId, propertyPageCollection, null);
     }
     else
     {
         base.ProcessRequest(request);
     }
 }
示例#4
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"));
                }
            }
        }
示例#5
0
        /// <summary>
        /// Called when a selection changes. The snap-in should override this method to read the updated <see cref="P:Microsoft.ManagementConsole.MmcListView.SelectedNodes"></see> property and update <see cref="T:Microsoft.ManagementConsole.SelectionData"></see> class accordingly.
        /// </summary>
        /// <param name="status">The object that holds the status information.</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                // No items are selected; clear selection data and associated actions.
                SelectionData.Clear();
                SelectionData.ActionsPaneItems.Clear();
            }
            else
            {
                StringBuilder selectedItems = new StringBuilder();

                foreach (ResultNode node in this.SelectedNodes)
                {
                    selectedItems.Append(node.DisplayName);
                    selectedItems.Append(" ");
                    selectedItems.Append(string.Join(" ", node.SubItemDisplayNames.ToArray()));
                    selectedItems.AppendLine();
                }

                SelectionData.Update(selectedItems.ToString(), this.SelectedNodes.Count > 1, null, null);

                SelectionData.ActionsPaneItems.Clear();
                SelectionData.ActionsPaneItems.Add(this.CopyToClipboardAction);
            }
        }
示例#6
0
 protected override void OnSelectionChanged(MMC.SyncStatus status)
 {
     base.OnSelectionChanged(status);
     //Multiple delete
     if (this.SelectedNodes.Count > 1)
     {
         //Prepare actions
         this.SelectionData.ActionsPaneItems.Clear();
         this.SelectionData.Update(this.SelectedNodes, true, null, null);
         //Export - MMC.SyncAction
         MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg130"), Globalization.MultilanguageResource.GetString("Menu_Tit130"));
         exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
         this.SelectionData.ActionsPaneItems.Add(exportAction);
         //MMC.SyncAction - Delete Stores
         MMC.SyncAction deleteStoresAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg140"), Globalization.MultilanguageResource.GetString("Menu_Tit140"));
         bool           canDelete          = true;
         foreach (StoreScopeNode ssn in this.SelectedNodes)
         {
             if (!ssn.Store.IAmAdmin)
             {
                 canDelete = false;
                 break;
             }
         }
         deleteStoresAction.Enabled    = canDelete;
         deleteStoresAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteStoresAction_Triggered);
         this.SelectionData.ActionsPaneItems.Add(deleteStoresAction);
     }
 }
示例#7
0
 internal override void ProcessRequest(Request request)
 {
     if (request == null)
     {
         throw new ArgumentNullException("request");
     }
     if (request.RequestInfo is PersistenceKeyRequestInfo)
     {
         PersistenceKeyRetrievalCompletedResponse response = new PersistenceKeyRetrievalCompletedResponse();
         IRequestStatus requestStatus = request.RequestStatus;
         SyncStatus status2 = new SyncStatus(requestStatus);
         try
         {
             string str = this.OnRetrievePersistenceKey();
             response.PersistenceKey = str;
             requestStatus.ProcessResponse(response);
         }
         finally
         {
             status2.Close();
         }
     }
     else
     {
         base.ProcessRequest(request);
     }
 }
示例#8
0
 /// <summary>
 /// If snapIn 'IsModified', then save data
 /// </summary>
 /// <param name="status">status for updating the console</param>
 /// <returns>binary data to be stored in the console file</returns>
 protected override byte[] OnSaveCustomData(MMC.SyncStatus status)
 {
     return(Encoding.Unicode.GetBytes(
                String.Join("\n", new string[]
     {
         this.dataSource, this.initialCatalog, this.security, this.otherSettings, this.userId, this.password, Globalization.MultilanguageResource.GetCurrentCulture()
     })));
 }
示例#9
0
        /// <summary>
        /// This method is called when the node has to be expanded synchronously with respect to MMC.  MMC expands nodes to select the last node that was selected when the console file was saved.
        /// </summary>
        /// <param name="status">The object that holds the status information.</param>
        /// <returns>
        /// True indicates that the node was expanded completely; otherwise, false.
        /// </returns>
        protected override bool OnExpandFromLoad(SyncStatus status)
        {
            if (!IsLoaded)
            {
                Refresh();
                this.IsLoaded = true;
            }

            return base.OnExpandFromLoad(status);
        }
示例#10
0
        protected override bool OnPaste(SharedData data, DragAndDropVerb pasteType, SyncStatus status)
        {
            //data.Add(new SharedDataItem(DataFormats.UnicodeText));
            //data.Add(new SharedDataItem(DataFormats.Text));
            //data.Add(new SharedDataItem(DataFormats.Html));

            ////string displayName1 = Encoding.Unicode.GetString(data.GetItem(DataFormats.UnicodeText).GetData());
            ////string displayName2 = Encoding.ASCII.GetString(data.GetItem(DataFormats.Text).GetData());
            //string displayName3 = Encoding.ASCII.GetString(data.GetItem(DataFormats.Html).GetData());

            return base.OnPaste(data, pasteType, status);
        }
示例#11
0
 internal void ProcessRequestMessage(PropertyPageMessageRequestInfo requestInfo, IRequestStatus requestStatus)
 {
     PropertySheet propertySheet = this.GetPropertySheet(requestInfo.SheetId);
     SyncStatus status = new SyncStatus(requestStatus);
     try
     {
         requestStatus.ProcessResponse(propertySheet.ProcessRequestMessage(requestInfo));
     }
     finally
     {
         status.Close();
     }
 }
示例#12
0
 protected override void OnSyncAction(SyncAction action, SyncStatus status)
 {
     if (action == this.UpdateCheckAction)
     {
         try
         {
             OnCheckForUpdate(status);
         }
         catch (Exception ex)
         {
             ThreadExceptionDialog exForm = new ThreadExceptionDialog(ex);
             this.SnapIn.Console.ShowDialog(exForm);
         }
     }
 }
示例#13
0
文件: View.cs 项目: SiteView/ECC8.13
 private void ComparePropertySheetSelectionObjects(int currentSelectionId, int selectionIdToCompare, IRequestStatus requestStatus)
 {
     CompareSelectionObjectsResponse response = new CompareSelectionObjectsResponse();
     response.Result = false;
     if (requestStatus == null)
     {
         throw new ArgumentNullException("requestStatus");
     }
     SyncStatus status = new SyncStatus(requestStatus);
     try
     {
         if (((this.SelectionData.SelectionCardinality != SelectionCardinality.None) && (currentSelectionId == this.SelectionData.Id)) && (this.SelectionData.SelectionObject != null))
         {
             response.Result = SnapInBase.SnapInInstance.SheetManager.ComparePropertySheetSelectionObjects(this.SelectionData.SelectionObject, selectionIdToCompare);
         }
         requestStatus.ProcessResponse(response);
     }
     finally
     {
         status.Close();
     }
 }
示例#14
0
 internal override void ProcessRequest(Request request)
 {
     if (request.RequestInfo is ShowInitializationWizardRequestInfo)
     {
         ShowInitializationWizardResponse response = new ShowInitializationWizardResponse();
         IRequestStatus requestStatus = request.RequestStatus;
         SyncStatus status2 = new SyncStatus(requestStatus);
         try
         {
             response.AddSnapInToConsole = this.OnShowInitializationWizard();
             requestStatus.ProcessResponse(response);
         }
         finally
         {
             status2.Close();
         }
     }
     else
     {
         base.ProcessRequest(request);
     }
 }
示例#15
0
 protected override void OnSelectionChanged(MMC.SyncStatus status)
 {
     base.OnSelectionChanged(status);
     //Multiple delete
     if (this.SelectedNodes.Count > 1)
     {
         //Prepare actions
         this.SelectionData.ActionsPaneItems.Clear();
         this.SelectionData.Update(this.SelectedNodes, true, null, null);
         //Export - MMC.SyncAction
         MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg10"), Globalization.MultilanguageResource.GetString("Menu_Tit10"));
         exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
         this.SelectionData.ActionsPaneItems.Add(exportAction);
         //MMC.SyncAction - Delete Stores
         MMC.SyncAction deleteApplicationGroupsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg20"), Globalization.MultilanguageResource.GetString("Menu_Tit20"));
         if (!(((ApplicationGroupScopeNode)this.SelectedNodes[0]).ApplicationGroup.Application.IAmManager))
         {
             deleteApplicationGroupsAction.Enabled = false;
         }
         deleteApplicationGroupsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteApplicationGroupsAction_Triggered);
         this.SelectionData.ActionsPaneItems.Add(deleteApplicationGroupsAction);
     }
 }
        protected override void OnSelectionChanged(MMC.SyncStatus status)
        {
            base.OnSelectionChanged(status);
            //Multiple delete
            if (this.SelectedNodes.Count > 1)
            {
                //Prepare actions
                this.SelectionData.ActionsPaneItems.Clear();
                this.SelectionData.Update(this.SelectedNodes, true, null, null);
                if (this.SelectedNodes[0] as RoleDefinitionsScopeNode != null ||
                    this.SelectedNodes[0] as TaskDefinitionsScopeNode != null ||
                    this.SelectedNodes[0] as OperationDefinitionsScopeNode != null ||
                    this.SelectedNodes[0] as RoleAuthorizationsScopeNode != null ||
                    this.SelectedNodes[0] as TaskAuthorizationsScopeNode != null ||
                    this.SelectedNodes[0] as OperationAuthorizationsScopeNode != null)
                {
                    return;
                }
                else
                {
                    //Export - MMC.SyncAction
                    MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg60"), Globalization.MultilanguageResource.GetString("Menu_Tit60"));
                    exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
                    this.SelectionData.ActionsPaneItems.Add(exportAction);
                    //MMC.SyncAction - Delete Stores
                    MMC.SyncAction deleteItemDefinitionsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg70"), Globalization.MultilanguageResource.GetString("Menu_Tit70"));

                    if (this.SelectedNodes[0] as ItemDefinitionScopeNode != null && !(((ItemDefinitionScopeNode)this.SelectedNodes[0]).Item.Application.IAmManager) ||
                        this.SelectedNodes[0] as ItemAuthorizationScopeNode != null && !(((ItemAuthorizationScopeNode)this.SelectedNodes[0]).Item.Application.IAmManager))
                    {
                        deleteItemDefinitionsAction.Enabled = false;
                    }
                    deleteItemDefinitionsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteItemDefinitionsAction_Triggered);
                    this.SelectionData.ActionsPaneItems.Add(deleteItemDefinitionsAction);
                }
            }
        }
        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"));
                }
            }
        }
示例#18
0
        /// <summary>
        /// Handles the execution of a selection-dependent action that runs synchronous to MMC.
        /// </summary>
        /// <param name="action">The executed action.</param>
        /// <param name="status">The object that holds the status information.</param>
        protected override void OnSyncSelectionAction(SyncAction action, SyncStatus status)
        {
            if (action == this.CopyToClipboardAction)
            {
                OnCopyToClipboard(status);
            }

            base.OnSyncAction(action, status);
        }
示例#19
0
        /// <summary>
        /// Called when [copy to clipboard].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCopyToClipboard(SyncStatus status)
        {
            string seletectedElements = (string)SelectionData.SelectionObject;

            Clipboard.SetText(seletectedElements);
        }
        protected override void OnSelectionChanged(MMC.SyncStatus status)
        {
            base.OnSelectionChanged(status);
            //Multiple delete
            if (this.SelectedNodes.Count >= 1)
            {
                //Prepare actions
                this.SelectionData.ActionsPaneItems.Clear();
                this.SelectionData.Update(this.SelectedNodes, this.SelectedNodes.Count > 1, null, null);

                //Authorizations - MMC.SyncAction
                MMC.ActionGroup authorizationsActionGroup = new MMC.ActionGroup(Globalization.MultilanguageResource.GetString("Menu_Msg30"), Globalization.MultilanguageResource.GetString("Menu_Tit30"));
                this.SelectionData.ActionsPaneItems.Add(authorizationsActionGroup);
                //Allow with delegation
                MMC.SyncAction allowWithDelegationAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegation"), Globalization.MultilanguageResource.GetString("Domain_AllowWithDelegationDescription"));
                if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
                    this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
                {
                    allowWithDelegationAction.Enabled = false;
                }
                allowWithDelegationAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(allowWithDelegationAction_Triggered);
                authorizationsActionGroup.Items.Add(allowWithDelegationAction);
                //Allow
                MMC.SyncAction allowAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Allow"), Globalization.MultilanguageResource.GetString("Domain_AllowDescription"));
                if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
                    this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
                {
                    allowAction.Enabled = false;
                }
                allowAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(allowAction_Triggered);
                authorizationsActionGroup.Items.Add(allowAction);
                //Deny
                MMC.SyncAction denyAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Deny"), Globalization.MultilanguageResource.GetString("Domain_DenyDescription"));
                if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
                    this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
                {
                    denyAction.Enabled = false;
                }
                denyAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(denyAction_Triggered);
                authorizationsActionGroup.Items.Add(denyAction);
                //Neutral
                MMC.SyncAction neutralAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Domain_Neutral"), Globalization.MultilanguageResource.GetString("Domain_NeutralDescription"));
                if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
                    this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
                {
                    neutralAction.Enabled = false;
                }
                neutralAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(neutralAction_Triggered);
                authorizationsActionGroup.Items.Add(neutralAction);
                //Line separator
                MMC.ActionSeparator lineAction = new MMC.ActionSeparator();
                this.SelectionData.ActionsPaneItems.Add(lineAction);
                //MMC.SyncAction - Delete Authorizations
                MMC.SyncAction deleteAuthorizationsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg40"), Globalization.MultilanguageResource.GetString("Menu_Tit40"));
                if (this.ScopeNode as ItemAuthorizationScopeNode != null && !((ItemAuthorizationScopeNode)this.ScopeNode).Item.Application.IAmManager ||
                    this.ScopeNode as ItemDefinitionScopeNode != null && !((ItemDefinitionScopeNode)this.ScopeNode).Item.Application.IAmManager)
                {
                    deleteAuthorizationsAction.Enabled = false;
                }
                deleteAuthorizationsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteAuthorizationsAction_Triggered);
                this.SelectionData.ActionsPaneItems.Add(deleteAuthorizationsAction);
            }
        }
示例#21
0
 public SyncActionEventArgs(SyncAction action, SyncStatus status)
 {
     this._action = action;
     this._status = status;
 }
示例#22
0
 internal bool ExpandFromLoad(IRequestStatus requestStatus)
 {
     SyncStatus status = new SyncStatus(requestStatus);
     return this.OnExpandFromLoad(status);
 }
        /// <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;
                    }
            }
        }
示例#24
0
        /// <summary>
        /// Called when [create new company for database].
        /// </summary>
        /// <param name="status">The status.</param>
        private void OnCreateNewCompanyForDatabase(SyncStatus status)
        {
            // Check Sql Settings
            ISqlServerSettings sqlSettings = this.Configurator.SqlSettings;

            if (string.IsNullOrEmpty(sqlSettings.Server))
            {
                // TODO: Show Warning
                EditSqlServerSettingsForm editSqlSettinnsForm = new EditSqlServerSettingsForm(this.Configurator);

                if (this.SnapIn.Console.ShowDialog(editSqlSettinnsForm) == DialogResult.OK)
                {
                    this.Configurator.ChangeSqlServerSettings(
                    editSqlSettinnsForm.SqlServerName,
                    editSqlSettinnsForm.UseWindowsAuth ? AuthenticationType.Windows : AuthenticationType.SqlServer,
                    editSqlSettinnsForm.SqlServerUser,
                    editSqlSettinnsForm.SqlServerPassword,
                    editSqlSettinnsForm.IbnUserName,
                    editSqlSettinnsForm.IbnUserPassword);
                }
                else
                    return;
            }

            CreateCompanyForDatabaseForm createCompanyForDatabaseForm = new CreateCompanyForDatabaseForm(this.Configurator);

            if (this.SnapIn.Console.ShowDialog(createCompanyForDatabaseForm) == DialogResult.OK)
            {
                status.ReportProgress(0, 0, string.Format(SnapInResources.CompanyScopeNode_Action_CreateForDatabase_Progress, createCompanyForDatabaseForm.textBoxHost.Text));

                string newCompanyId = string.Empty;

                //Thread.Sleep(10000);

                newCompanyId = this.Configurator.CreateCompanyForDatabase(
                    createCompanyForDatabaseForm.comboBoxSqlDatabase.Text,
                    DateTime.UtcNow,
                    createCompanyForDatabaseForm.checkBoxIsActive.Checked,
                    createCompanyForDatabaseForm.textBoxHost.Text,
                    createCompanyForDatabaseForm.IisIPAddress,
                    int.Parse(createCompanyForDatabaseForm.textBoxIisPort.Text),
                    createCompanyForDatabaseForm.IisPool,
                    true);

                // Refresh Company List
                Refresh();

                // TODO: Navigate browser to form.NewCompanyId Url
            }
        }
示例#25
0
 protected virtual void OnDelete(SyncStatus status)
 {
 }
示例#26
0
 protected virtual void OnPrint(SyncStatus status)
 {
 }
 /// <summary>
 /// If snapIn 'IsModified', then save data
 /// </summary>
 /// <param name="status">status for updating the console</param>
 /// <returns>binary data to be stored in the console file</returns>
 protected override byte[] OnSaveCustomData(SyncStatus status)
 {
     return Encoding.Unicode.GetBytes(this.RootNode.DisplayName);
 }
示例#28
0
 protected override void OnShutdown(MMC.SyncStatus status)
 {
     this.isALive = false;
     base.OnShutdown(status);
 }
 protected override void OnSelectionChanged(MMC.SyncStatus status)
 {
     base.OnSelectionChanged(status);
     if (this.SelectedNodes.Count > 1)
     {
         //Prepare actions
         this.SelectionData.ActionsPaneItems.Clear();
         bool allApplications = true;
         foreach (MMC.ScopeNode scopeNode in this.SelectedNodes)
         {
             if (scopeNode as ApplicationScopeNode == null)
             {
                 allApplications = false;
             }
         }
         if (allApplications)
         {
             this.SelectionData.Update(this.SelectedNodes, true, null, null);
             //Items Hierarchy View - MMC.SyncAction
             MMC.SyncAction ItemsHVAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_ItemsHierarchicalView"), Globalization.MultilanguageResource.GetString("Menu_ItemsHierarchicalViewDescription"));
             ItemsHVAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(ItemsHVAction_Triggered);
             this.SelectionData.ActionsPaneItems.Add(ItemsHVAction);
             //Line MMC.SyncAction
             MMC.ActionSeparator lineAction1 = new MMC.ActionSeparator();
             this.SelectionData.ActionsPaneItems.Add(lineAction1);
             //Report Group
             MMC.ActionGroup reportAction = new MMC.ActionGroup(Globalization.MultilanguageResource.GetString("rptTitle"), Globalization.MultilanguageResource.GetString("rptDescription"));
             this.SelectionData.ActionsPaneItems.Add(reportAction);
             //Items Hierarchy Report - MMC.SyncAction
             MMC.SyncAction ItemsHReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg10"), Globalization.MultilanguageResource.GetString("rptTit10"));
             ItemsHReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(ItemsHReportAction_Triggered);
             reportAction.Items.Add(ItemsHReportAction);
             //Authorizations Report - MMC.SyncAction
             MMC.SyncAction AuthorizationsReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg20"), Globalization.MultilanguageResource.GetString("rptTit20"));
             AuthorizationsReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(AuthorizationsReportAction_Triggered);
             reportAction.Items.Add(AuthorizationsReportAction);
             //Effective Permissions Report Report - MMC.SyncAction
             MMC.SyncAction EffectivePermissionsReportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("rptMsg30"), Globalization.MultilanguageResource.GetString("rptTit30"));
             EffectivePermissionsReportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(EffectivePermissionsReportAction_Triggered);
             reportAction.Items.Add(EffectivePermissionsReportAction);
             //Line MMC.SyncAction
             MMC.ActionSeparator lineAction5 = new MMC.ActionSeparator();
             this.SelectionData.ActionsPaneItems.Add(lineAction5);
             //Export - MMC.SyncAction
             MMC.SyncAction exportAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg80"), Globalization.MultilanguageResource.GetString("Menu_Tit80"));
             exportAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(exportAction_Triggered);
             this.SelectionData.ActionsPaneItems.Add(exportAction);
             //Line MMC.SyncAction
             MMC.ActionSeparator lineAction2 = new MMC.ActionSeparator();
             this.SelectionData.ActionsPaneItems.Add(lineAction2);
             //MMC.SyncAction - Delete Applications
             MMC.SyncAction deleteApplicationsAction = new MMC.SyncAction(Globalization.MultilanguageResource.GetString("Menu_Msg90"), Globalization.MultilanguageResource.GetString("Menu_Tit90"));
             if (!(((ApplicationScopeNode)this.SelectedNodes[0]).Application.Store.IAmManager))
             {
                 deleteApplicationsAction.Enabled = false;
             }
             deleteApplicationsAction.Triggered += new MMC.SyncAction.SyncActionEventHandler(deleteApplicationsAction_Triggered);
             this.SelectionData.ActionsPaneItems.Add(deleteApplicationsAction);
         }
     }
 }
示例#30
0
 private void OnCheckForUpdate(SyncStatus status)
 {
     UpdateCheckForm form = new UpdateCheckForm(this.Configurator);
     this.SnapIn.Console.ShowDialog(form);
 }
示例#31
0
 protected override void OnSelectionChanged(MMC.SyncStatus status)
 {
     base.OnSelectionChanged(status);
 }
示例#32
0
 internal void GetPropertyPages(int sheetId, IRequestStatus requestStatus)
 {
     if (requestStatus == null)
     {
         throw new ArgumentNullException("requestStatus", Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.ScopeNodeRequestInterfaceNull));
     }
     PropertyPageCollection propertyPageCollection = new PropertyPageCollection();
     SyncStatus status = new SyncStatus(requestStatus);
     try
     {
         this.OnAddPropertyPages(propertyPageCollection);
         PropertyPagesResponse response = new PropertyPagesResponse();
         response.SetPropertyPages(propertyPageCollection.ToPropertyPageInfoArray());
         requestStatus.ProcessResponse(response);
     }
     finally
     {
         status.Close();
     }
     SnapInBase.SnapInInstance.SheetManager.CreatePropertySheet(sheetId, propertyPageCollection, null);
 }
示例#33
0
 protected virtual void OnRename(string newText, SyncStatus status)
 {
 }
示例#34
0
 internal void GetSharedData(ReadSharedDataNodeRequestInfo requestInfo, IRequestStatus requestStatus)
 {
     WritableSharedDataItem item = this.SharedData.GetItem(requestInfo.RequestedClipboardFormatId);
     if (item != null)
     {
         SyncStatus status = new SyncStatus(requestStatus);
         byte[] buffer = this.OnGetSharedData(item, status);
         ClipboardData data = new ClipboardData();
         data.ClipboardFormatId = item.ClipboardFormatId;
         data.SetValue(buffer);
         ReadSharedDataResponse response = new ReadSharedDataResponse();
         response.RequestedClipboardData = data;
         requestStatus.ProcessResponse(response);
     }
 }
示例#35
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);
                }
            }
        }
示例#36
0
 protected virtual void OnSyncAction(SyncAction action, SyncStatus status)
 {
 }
示例#37
0
 protected virtual bool OnExpandFromLoad(SyncStatus status)
 {
     return false;
 }
示例#38
0
 internal void Activate(IRequestStatus requestStatus)
 {
     if (this._actionsActivated != null)
     {
         SyncStatus status = new SyncStatus(requestStatus);
         try
         {
             this._actionsActivated(this, _eventArgs);
         }
         finally
         {
             status.Close();
         }
     }
 }
示例#39
0
 protected virtual byte[] OnGetSharedData(WritableSharedDataItem item, SyncStatus status)
 {
     return null;
 }
示例#40
0
 protected virtual bool OnPaste(Microsoft.ManagementConsole.SharedData data, Microsoft.ManagementConsole.DragAndDropVerb pasteType, SyncStatus status)
 {
     return false;
 }
示例#41
0
        /// <summary>
        /// Handles changes in ListView selection. Only acts on first selected row.
        /// </summary>
        /// <param name="status">synchronous status to update the console</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            int count = SelectedNodes.Count;

            // update selection context
            if (count == 0)
            {
                this.SelectionData.Clear();
                this.SelectionData.ActionsPaneItems.Clear();
            }
            else
            {
                // update MMC with the selection information.
                // MMC will find an already open property sheet based on the SelectionObject (first parameter below)
                this.SelectionData.Update((ResultNode)this.SelectedNodes[0], count > 1, null, null);
                this.SelectionData.ActionsPaneItems.Clear();
                this.SelectionData.ActionsPaneItems.Add(new Action("Properties", "Properties", -1, "Properties"));
            }
        }
        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);
                }
            }
        }