/// <summary>
        /// Constructor
        /// </summary>
        public NotifyingScopeNode()
        {
            // define views that can be used
            normalMessageViewDescription = new MessageViewDescription();
            normalMessageViewDescription.DisplayName = "Normal Message View";
            normalMessageViewDescription.ViewType = typeof(NormalMessageView);

            errorMessageViewDescription = new MessageViewDescription();
            errorMessageViewDescription.DisplayName = "Simulated Error Message View";
            errorMessageViewDescription.ViewType = typeof(ErrorMessageView);

            // define actions that can be used
            changeToNormalAction = new Action("Show Normal", "Switches the view to the normal view", -1, "ShowNormal");
            changeToErrorAction = new Action("Simulate an Error", "Switches the view to an error handling view", -1, "ShowError");

            // set the node name
            this.DisplayName = "On Scope Node Change Sample";

            // set starting view description
            this.ViewDescriptions.Add(normalMessageViewDescription);
            this.ViewDescriptions.DefaultIndex = 0;

            // add starting action to show an 'error'
            this.ActionsPaneItems.Clear();
            this.ActionsPaneItems.Add(changeToErrorAction);
        }
Example #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);
            }
        }
 /// <summary>
 /// Adds a view description and set it as the default
 /// </summary>
 /// <param name="displayName"></param>
 /// <param name="viewType"></param>
 public void AddViewDescription(string displayName, Type viewType)
 {
     // add the view description (display name is required)
     MessageViewDescription mvd = new MessageViewDescription();
     mvd.DisplayName = displayName;
     mvd.ViewType = viewType;
     this.ViewDescriptions.Add(mvd);
 }
        private void RenderInitialMessageViewDescription()
        {
            // set up the update authorizationType pane when scope node selected
            MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
            mvd.DisplayName = Globalization.MultilanguageResource.GetString("MMC_Msg10");
            mvd.BodyText    = Globalization.MultilanguageResource.GetString("MMC_Tit10");
            mvd.IconId      = MMC.MessageViewIcon.Information;

            // attach the view and set it as the default to show
            this.ViewDescriptions.Add(mvd);
            this.ViewDescriptions.DefaultIndex = 0;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public MessageViewSnapIn()
        {
            // update scope pane with a node in the tree
            this.RootNode = new ScopeNode();
            this.RootNode.DisplayName = "MessageView Sample";

            // set up the update result pane when scope node selected
            MessageViewDescription mvd = new MessageViewDescription();
            mvd.DisplayName = "Hello World";
            mvd.BodyText = "This is a MessageView. You can attach it to any scope node.";
            mvd.IconId = MessageViewIcon.Information;

            // attach the view and set it as the default to show
            this.RootNode.ViewDescriptions.Add(mvd);
            this.RootNode.ViewDescriptions.DefaultIndex = 0;
        }
        public StorageScopeNode(
            string dataSource,
            string initialCatalog,
            string security,
            string userId,
            string password,
            string otherSettings,
            IAzManStorage storage)
        {
            try
            {
                this.dataSource     = dataSource;
                this.initialCatalog = initialCatalog;
                this.security       = security;
                this.userId         = userId;
                this.password       = password;
                this.otherSettings  = otherSettings;
                this.storage        = storage;

                //Async check for Tdo update
                if (!NetSqlAzMan.SnapIn.Utilities.ConsoleUtilities.commandLineArgumentOn("NoCheckForUpdate"))
                {
                    System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.CheckForUpdateSync));
                }
                //System.Threading.Thread asyncCheckForUpdate = new System.Threading.Thread(new System.Threading.ThreadStart(this.CheckForUpdateSync));
                //asyncCheckForUpdate.Start();
                this.RenderStorageScopeNode();
            }
            catch (Exception ex)
            {
                // set up the update authorizationType pane when scope node selected
                MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
                mvd.DisplayName = Globalization.MultilanguageResource.GetString("MMC_Msg20");
                mvd.BodyText    = ex.Message;
                mvd.IconId      = MMC.MessageViewIcon.Error;

                // attach the view and set it as the default to show
                this.ViewDescriptions.Clear();
                this.ViewDescriptions.Add(mvd);
                this.ViewDescriptions.DefaultIndex = 0;
                new NetSqlAzMan.Logging.LoggingUtility().WriteError(this.storage, ex.Message);
            }
        }
        public StorageScopeNode(
            string dataSource,
            string initialCatalog,
            string security,
            string userId,
            string password,
            string otherSettings,
            IAzManStorage storage)
        {
            try
            {
                this.dataSource = dataSource;
                this.initialCatalog = initialCatalog;
                this.security = security;
                this.userId = userId;
                this.password = password;
                this.otherSettings = otherSettings;
                this.storage = storage;

                //Async check for Tdo update
                if (!NetSqlAzMan.SnapIn.Utilities.ConsoleUtilities.commandLineArgumentOn("NoCheckForUpdate"))
                    System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(this.CheckForUpdateSync));
                //System.Threading.Thread asyncCheckForUpdate = new System.Threading.Thread(new System.Threading.ThreadStart(this.CheckForUpdateSync));
                //asyncCheckForUpdate.Start();
                this.RenderStorageScopeNode();
            }
            catch (Exception ex)
            {
                // set up the update authorizationType pane when scope node selected
                MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
                mvd.DisplayName = Globalization.MultilanguageResource.GetString("MMC_Msg20");
                mvd.BodyText = ex.Message;
                mvd.IconId = MMC.MessageViewIcon.Error;

                // attach the view and set it as the default to show
                this.ViewDescriptions.Clear();
                this.ViewDescriptions.Add(mvd);
                this.ViewDescriptions.DefaultIndex = 0;
                new NetSqlAzMan.Logging.LoggingUtility().WriteError(this.storage, ex.Message);
            }
        }
        private void RenderInitialMessageViewDescription()
        {
            // set up the update authorizationType pane when scope node selected
            MMC.MessageViewDescription mvd = new MMC.MessageViewDescription();
            mvd.DisplayName = Globalization.MultilanguageResource.GetString("MMC_Msg10");
            mvd.BodyText = Globalization.MultilanguageResource.GetString("MMC_Tit10");
            mvd.IconId = MMC.MessageViewIcon.Information;

            // attach the view and set it as the default to show
            this.ViewDescriptions.Add(mvd);
            this.ViewDescriptions.DefaultIndex = 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);
     }
 }