private void OnComponentChanged(RadialMenuItem parent, IComponentChangeService cc)
 {
     if (parent == null)
     {
         if (_RadialMenu != null)
             cc.OnComponentChanged(_RadialMenu, TypeDescriptor.GetProperties(_RadialMenu)["Items"], null, null);
         else if (_RadialMenuContainer != null)
             cc.OnComponentChanged(_RadialMenuContainer, TypeDescriptor.GetProperties(_RadialMenuContainer)["SubItems"], null, null);
     }
     else
         cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["SubItems"], null, null);
 }
示例#2
0
        protected void ForceDesignerChange()
        {
            IComponentChangeService componentChangeService = (IComponentChangeService)this.GetService(typeof(IComponentChangeService));

            componentChangeService?.OnComponentChanged(this, null, null, null);
            base.Invalidate();
        }
示例#3
0
        /// <summary>
        /// This adds the delegate value as a listener to when this event is fired
        /// by the component, invoking the addOnXXX method.
        /// </summary>
        public override void AddEventHandler(object component, Delegate value)
        {
            FillMethods();

            if (component != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;

                // Announce that we are about to change this component
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                }

                if (changeService != null)
                {
                    try
                    {
                        changeService.OnComponentChanging(component, this);
                    }
                    catch (CheckoutException coEx)
                    {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw;
                    }
                    changeService.OnComponentChanging(component, this);
                }

                bool shadowed = false;

                if (site != null && site.DesignMode)
                {
                    // Events are final, so just check the class
                    if (EventType != value.GetType())
                    {
                        throw new ArgumentException(SR.Format(SR.ErrorInvalidEventHandler, Name));
                    }
                    IDictionaryService dict = (IDictionaryService)site.GetService(typeof(IDictionaryService));
                    if (dict != null)
                    {
                        Delegate eventdesc = (Delegate)dict.GetValue(this);
                        eventdesc = Delegate.Combine(eventdesc, value);
                        dict.SetValue(this, eventdesc);
                        shadowed = true;
                    }
                }

                if (!shadowed)
                {
                    _addMethod.Invoke(component, new[] { value });
                }

                // Now notify the change service that the change was successful.
                changeService?.OnComponentChanged(component, this, null, value);
            }
        }
示例#4
0
        /// <include file='doc\ComponentEditorForm.uex' path='docs/doc[@for="ComponentEditorForm.ApplyChanges"]/*' />
        /// <devdoc>
        ///     Applies any changes in the set of ComponentPageControl to the actual component.
        /// </devdoc>
        /// <internalonly/>
        internal virtual void ApplyChanges(bool lastApply)
        {
            if (dirty)
            {
                IComponentChangeService changeService = null;

                if (component.Site != null)
                {
                    changeService = (IComponentChangeService)component.Site.GetService(typeof(IComponentChangeService));
                    if (changeService != null)
                    {
                        try {
                            changeService.OnComponentChanging(component, null);
                        }
                        catch (CheckoutException e) {
                            if (e == CheckoutException.Canceled)
                            {
                                return;
                            }
                            throw e;
                        }
                    }
                }

                for (int n = 0; n < pageSites.Length; n++)
                {
                    if (pageSites[n].Dirty)
                    {
                        pageSites[n].GetPageControl().ApplyChanges();
                        pageSites[n].Dirty = false;
                    }
                }

                if (changeService != null)
                {
                    changeService.OnComponentChanged(component, null, null, null);
                }

                applyButton.Enabled = false;
                cancelButton.Text   = SR.CloseCaption;
                dirty = false;

                if (lastApply == false)
                {
                    for (int n = 0; n < pageSites.Length; n++)
                    {
                        pageSites[n].GetPageControl().OnApplyComplete();
                    }
                }

                /*
                 * if (transaction != null) {
                 *  transaction.Commit();
                 *  CreateNewTransaction();
                 * }
                 */
            }
        }
示例#5
0
        /// <summary>Indicates that a comonents value has changed.</summary>
        public static void Change_End(DesignerActionList designer)
        {
            IComponentChangeService service = UIDesigner_Service.IComponentChangeService_FromActionList(designer);

            if (service != null)
            {
                service.OnComponentChanged(designer, null, null, null);
            }
        }
示例#6
0
        protected void RaiseComponentChanged(MemberDescriptor member, object oldValue, object newValue)
        {
            IComponentChangeService service = GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (service != null)
            {
                service.OnComponentChanged(_component, member, oldValue, newValue);
            }
        }
示例#7
0
            /// <summary>
            /// Attempts to notify the <see cref="IComponentChangeService"/> via
            /// <see cref="IComponentChangeService.OnComponentChanged"/>.
            /// </summary>
            void ITypeDescriptorContext.OnComponentChanged()
            {
                IComponentChangeService componentChangeService = this.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

                if (componentChangeService != null)
                {
                    componentChangeService.OnComponentChanged(this.myInstance, this.myPropertyDescriptor, null, null);
                }
            }
示例#8
0
        /// <summary>
        /// Add a new tab and set selection.
        /// </summary>
        /// <param name="sender">Ignored.</param>
        /// <param name="e">Ignored.</param>
        private void OnAddTab(object sender, EventArgs e)
        {
            // Begin transaction
            IDesignerHost       host        = this.GetService(typeof(IDesignerHost)) as IDesignerHost;
            DesignerTransaction transaction = host.CreateTransaction("Add tab");

            // Create new tab
            WhidbeyTabPage tab = host.CreateComponent(typeof(WhidbeyTabPage)) as WhidbeyTabPage;

            m_oChangeSvc.OnComponentChanging(m_oControl, null);
            m_oControl.TabPages.Add(tab);
            m_oChangeSvc.OnComponentChanged(m_oControl, null, null, null);

            // End transaction
            transaction.Commit();

            m_oControl.SelectedTab = tab;
        }
        public void Commit()
        {
            changeService.OnComponentChanged(ctrl, null, null, null);
            this.transaction.Commit();
            DesignerActionUIService designerActionUISvc =
                (DesignerActionUIService)this.actionList.GetService(typeof(DesignerActionUIService));

            designerActionUISvc.Refresh(this.actionList.Component);
        }
示例#10
0
        /// <summary>
        /// Raises the <see cref="E:System.ComponentModel.Design.IComponentChangeService.ComponentChanged"></see> event.
        /// </summary>
        public void OnComponentChanged()
        {
            IComponentChangeService cc = _serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (cc != null)
            {
                cc.OnComponentChanged(_instance, _propertyDescriptor, null, null);
            }
        }
示例#11
0
        protected void RaiseComponentChanged(MemberDescriptor member, object oldValue, object newValue)
        {
            IComponentChangeService changeSvc = (IComponentChangeService)GetService(typeof(IComponentChangeService));

            if (changeSvc != null)
            {
                changeSvc.OnComponentChanged(Component, member, oldValue, newValue);
            }
        }
示例#12
0
        private void ReportExplorer_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            LoggingService.Info("ReportExplorer_PropertyChanged");
            this.MakeDirty();
            ReportExplorerPad       explorerPad = CheckReportExplorer();
            IComponentChangeService change      = Host.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            change.OnComponentChanged(explorerPad, null, null, null);
        }
示例#13
0
        public void Dispose()
        {
            IComponentChangeService changeService = this.serviceProvider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (changeService != null)
            {
                changeService.OnComponentChanged(this.component, this.property, this.oldValue, this.newValue);
            }
        }
        public void OnComponentChanged()
        {
            IComponentChangeService service = (IComponentChangeService)this.serviceProvider.GetService(typeof(IComponentChangeService));

            if (service != null)
            {
                service.OnComponentChanged(this.instance, this.propDesc, null, null);
            }
        }
        /// <summary>
        /// Will reset the default value for this property on the component. If
        /// there was a default value passed in as a DefaultValueAttribute, that
        /// value will be set as the value of the property on the component. If
        /// there was no default value passed in, a ResetXXX method will be looked
        /// for. If one is found, it will be invoked. If one is not found, this
        /// is a nop.
        /// </summary>
        public override void ResetValue(object component)
        {
            object invokee = GetInvocationTarget(_componentClass, component);

            if (DefaultValue != s_noValue)
            {
                SetValue(component, DefaultValue);
            }
            else if (AmbientValue != s_noValue)
            {
                SetValue(component, AmbientValue);
            }
            else if (ResetMethodValue != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;
                object oldValue = null;
                object newValue;

                // Announce that we are about to change this component
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                }

                // Make sure that it is ok to send the onchange events
                if (changeService != null)
                {
                    // invokee might be a type from mscorlib or system, GetMethodValue might return a NonPublic method
                    oldValue = GetMethodValue.Invoke(invokee, null);
                    try
                    {
                        changeService.OnComponentChanging(component, this);
                    }
                    catch (CheckoutException coEx)
                    {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw;
                    }
                }

                if (ResetMethodValue != null)
                {
                    ResetMethodValue.Invoke(invokee, null);

                    // Now notify the change service that the change was successful.
                    if (changeService != null)
                    {
                        newValue = GetMethodValue.Invoke(invokee, null);
                        changeService.OnComponentChanged(component, this, oldValue, newValue);
                    }
                }
            }
        }
        internal void ExtenderResetValue(IExtenderProvider provider, object component, PropertyDescriptor notifyDesc)
        {
            if (DefaultValue != noValue)
            {
                ExtenderSetValue(provider, component, DefaultValue, notifyDesc);
            }
            else if (AmbientValue != noValue)
            {
                ExtenderSetValue(provider, component, AmbientValue, notifyDesc);
            }
            else if (ResetMethodValue != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;
                object oldValue = null;
                object newValue;

                // Announce that we are about to change this component
                //
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    Debug.Assert(!CompModSwitches.CommonDesignerServices.Enabled || changeService != null, "IComponentChangeService not found");
                }

                // Make sure that it is ok to send the onchange events
                //
                if (changeService != null)
                {
                    oldValue = ExtenderGetValue(provider, component);
                    try {
                        changeService.OnComponentChanging(component, notifyDesc);
                    }
                    catch (CheckoutException coEx) {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw coEx;
                    }
                }

                provider = (IExtenderProvider)GetInvokee(componentClass, provider);
                if (ResetMethodValue != null)
                {
                    ResetMethodValue.Invoke(provider, new object[] { component });

                    // Now notify the change service that the change was successful.
                    //
                    if (changeService != null)
                    {
                        newValue = ExtenderGetValue(provider, component);
                        changeService.OnComponentChanged(component, notifyDesc, oldValue, newValue);
                    }
                }
            }
        }
        private void FireChanged()
        {
            IComponentChangeService service = GetComponentChangeService();

            if (service != null)
            {
                service.OnComponentChanged(this, null, null, null);
            }
        }
 public static void OnComponentChanged(
     this IComponentChangeService changeService,
     object component,
     MemberDescriptor?member = null,
     object?oldValue         = null,
     object?newValue         = null)
 {
     changeService.OnComponentChanged(component, member, oldValue, newValue);
 }
        /// <include file='doc\BaseDataListDesigner.uex' path='docs/doc[@for="BaseDataListDesigner.OnAutoFormat"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Represents the method that will handle the AutoFormat event.
        ///    </para>
        /// </devdoc>
        protected void OnAutoFormat(object sender, EventArgs e)
        {
            IServiceProvider        site          = bdl.Site;
            IComponentChangeService changeService = null;

            DesignerTransaction transaction = null;
            DialogResult        result      = DialogResult.Cancel;

            try {
                if (site != null)
                {
                    IDesignerHost designerHost = (IDesignerHost)site.GetService(typeof(IDesignerHost));
                    Debug.Assert(designerHost != null);

                    transaction = designerHost.CreateTransaction(SR.GetString(SR.BDL_AutoFormatVerb));

                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (changeService != null)
                    {
                        try {
                            changeService.OnComponentChanging(bdl, null);
                        }
                        catch (CheckoutException ex) {
                            if (ex == CheckoutException.Canceled)
                            {
                                return;
                            }
                            throw ex;
                        }
                    }
                }

                try {
                    AutoFormatDialog dlg = new AutoFormatDialog();

                    dlg.SetComponent(bdl);
                    result = dlg.ShowDialog();
                }
                finally {
                    if ((result == DialogResult.OK) && (changeService != null))
                    {
                        changeService.OnComponentChanged(bdl, null, null, null);
                        OnStylesChanged();
                    }
                }
            }
            finally {
                if (result == DialogResult.OK)
                {
                    transaction.Commit();
                }
                else
                {
                    transaction.Cancel();
                }
            }
        }
示例#20
0
        /// <include file='doc\CalendarDesigner.uex' path='docs/doc[@for="CalendarDesigner.OnAutoFormat"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Delegate to handle the the AutoFormat verb by calling the AutoFormat dialog.
        ///    </para>
        /// </devdoc>
        protected void OnAutoFormat(Object sender, EventArgs e)
        {
            IServiceProvider        site          = calendar.Site;
            IComponentChangeService changeService = null;

            DesignerTransaction transaction = null;
            DialogResult        result      = DialogResult.Cancel;

            try {
                if (site != null)
                {
                    IDesignerHost designerHost = (IDesignerHost)site.GetService(typeof(IDesignerHost));
                    Debug.Assert(designerHost != null);

                    transaction = designerHost.CreateTransaction(SR.GetString(SR.CalAFmt_Verb));

                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    if (changeService != null)
                    {
                        try {
                            changeService.OnComponentChanging(calendar, null);
                        }
                        catch (CheckoutException ex) {
                            if (ex == CheckoutException.Canceled)
                            {
                                return;
                            }
                            throw ex;
                        }
                    }
                }

                try {
                    CalendarAutoFormatDialog af = new CalendarAutoFormatDialog(calendar);
                    result = af.ShowDialog(null);
                }
                finally {
                    if (result == DialogResult.OK && changeService != null)
                    {
                        changeService.OnComponentChanged(calendar, null, null, null);
                    }
                }
            }
            finally {
                if (transaction != null)
                {
                    if (result == DialogResult.OK)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        transaction.Cancel();
                    }
                }
            }
        }
        /// <summary>
        /// Called when [name reference changed].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="NameReferenceChangedEventArgs"/> instance containing the event data.</param>
        private void OnNameReferenceChanged(object sender, NameReferenceChangedEventArgs e)
        {
            IComponentChangeService svc = _context.GetService(typeof(IComponentChangeService)) as IComponentChangeService;

            if (svc != null)
            {
                svc.OnComponentChanged(this._chart, null, null, null);
            }
        }
 protected override void NotifyParentChange(GridEntry ge)
 {
     while (((ge != null) && (ge is PropertyDescriptorGridEntry)) && ((PropertyDescriptorGridEntry)ge).propertyInfo.Attributes.Contains(NotifyParentPropertyAttribute.Yes))
     {
         object valueOwner = ge.GetValueOwner();
         while (!(ge is PropertyDescriptorGridEntry) || this.OwnersEqual(valueOwner, ge.GetValueOwner()))
         {
             ge = ge.ParentGridEntry;
             if (ge == null)
             {
                 break;
             }
         }
         if (ge != null)
         {
             valueOwner = ge.GetValueOwner();
             IComponentChangeService componentChangeService = this.ComponentChangeService;
             if (componentChangeService == null)
             {
                 continue;
             }
             Array array = valueOwner as Array;
             if (array != null)
             {
                 for (int i = 0; i < array.Length; i++)
                 {
                     PropertyDescriptor propertyInfo = ((PropertyDescriptorGridEntry)ge).propertyInfo;
                     if (propertyInfo is MergePropertyDescriptor)
                     {
                         propertyInfo = ((MergePropertyDescriptor)propertyInfo)[i];
                     }
                     if (propertyInfo != null)
                     {
                         componentChangeService.OnComponentChanging(array.GetValue(i), propertyInfo);
                         componentChangeService.OnComponentChanged(array.GetValue(i), propertyInfo, null, null);
                     }
                 }
                 continue;
             }
             componentChangeService.OnComponentChanging(valueOwner, ((PropertyDescriptorGridEntry)ge).propertyInfo);
             componentChangeService.OnComponentChanged(valueOwner, ((PropertyDescriptorGridEntry)ge).propertyInfo, null, null);
         }
     }
 }
示例#23
0
 private void OnEnabled(object sender, EventArgs e)
 {
     if ((_ribbonGallery != null) && (_ribbonGallery.Ribbon != null))
     {
         PropertyDescriptor propertyEnabled = TypeDescriptor.GetProperties(_ribbonGallery)["Enabled"];
         bool oldValue = (bool)propertyEnabled.GetValue(_ribbonGallery);
         bool newValue = !oldValue;
         _changeService.OnComponentChanged(_ribbonGallery, null, oldValue, newValue);
         propertyEnabled.SetValue(_ribbonGallery, newValue);
     }
 }
示例#24
0
 private void OnVisible(object sender, EventArgs e)
 {
     if (_ribbonButton?.Ribbon != null)
     {
         _changeService.OnComponentChanged(_ribbonButton, null, _ribbonButton.Visible, !_ribbonButton.Visible);
         _ribbonButton.Visible = !_ribbonButton.Visible;
     }
 }
示例#25
0
 void componentChangeService_ComponentRemoving(object sender, ComponentEventArgs e)
 {
     // If the user is removing the control itself
     if (e.Component == DBForm)
     {
         IComponentChangeService componentChangeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
         DBForm.DestroyVisibleComponents();
         componentChangeService.OnComponentChanged(DBForm, null, null, null);
     }
 }
        void DesignPanel_Activated(object sender, EventArgs e)
        {
            XtraReport report = ((XRDesignPanel)sender).Report;

            if (report is XpoBaseReport)
            {
                IComponentChangeService svc = ((XRDesignPanel)sender).GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                svc.OnComponentChanged(report, null, null, null);
            }
        }
示例#27
0
 private void OnVisible(object sender, EventArgs e)
 {
     if ((_ribbonTab != null) &&
         (_ribbonTab.Ribbon != null) &&
         _ribbonTab.Ribbon.RibbonTabs.Contains(_ribbonTab))
     {
         _changeService.OnComponentChanged(_ribbonTab, null, _ribbonTab.Visible, !_ribbonTab.Visible);
         _ribbonTab.Visible = !_ribbonTab.Visible;
     }
 }
示例#28
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoadGridInfos(object sender, System.EventArgs e)
        {
            XceedUtility.SetXceedLicense();

            Form form = new Form();

            form.AutoSize        = true;
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.Controls.Add(new FlowLayoutPanel());
            form.Controls[0].Controls.Add(new TextBox());
            form.Text = "Please input gridName";
            form.Controls[0].Controls.Add(new Button());
            (form.Controls[0].Controls[1] as Button).Text         = "Ok";
            (form.Controls[0].Controls[1] as Button).DialogResult = DialogResult.OK;
            if (form.ShowDialog() == DialogResult.OK)
            {
                string gridName = (form.Controls[0].Controls[0] as TextBox).Text;
                if (string.IsNullOrEmpty(gridName))
                {
                    MessageForm.ShowError("GridName should not be null!");
                    return;
                }

                IList <GridColumnInfo> gridColumnInfos = ADInfoBll.Instance.GetGridColumnInfos(gridName);
                int x = 0, y = 0;
                foreach (GridColumnInfo columnInfo in gridColumnInfos)
                {
                    try
                    {
                        IDesignerHost           h  = (IDesignerHost)GetService(typeof(IDesignerHost));
                        DesignerTransaction     dt = h.CreateTransaction("Add IDataControl");
                        IComponentChangeService c  = (IComponentChangeService)GetService(typeof(IComponentChangeService));

                        c.OnComponentChanging(m_parentForm, null);
                        Control control = AddDataControl(h, columnInfo);
                        control.Location = new System.Drawing.Point(x, y);
                        c.OnComponentChanged(m_parentForm, null, null, null);

                        dt.Commit();

                        x += 200;
                        if (x >= 800)
                        {
                            x  = 0;
                            y += 25;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageForm.ShowError(ex.Message);
                    }
                }
            }
            form.Dispose();
        }
示例#29
0
        /// <summary>
        /// This will remove the delegate value from the event chain so that
        /// it no longer gets events from this component.
        /// </summary>
        public override void RemoveEventHandler(object component, Delegate value)
        {
            FillMethods();

            if (component != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;

                // Announce that we are about to change this component
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                }

                if (changeService != null)
                {
                    try
                    {
                        changeService.OnComponentChanging(component, this);
                    }
                    catch (CheckoutException coEx)
                    {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw;
                    }
                    changeService.OnComponentChanging(component, this);
                }

                bool shadowed = false;

                if (site != null && site.DesignMode)
                {
                    IDictionaryService dict = (IDictionaryService)site.GetService(typeof(IDictionaryService));
                    if (dict != null)
                    {
                        Delegate del = (Delegate)dict.GetValue(this);
                        del = Delegate.Remove(del, value);
                        dict.SetValue(this, del);
                        shadowed = true;
                    }
                }

                if (!shadowed)
                {
                    _removeMethod.Invoke(component, new[] { value });
                }

                // Now notify the change service that the change was successful.
                changeService?.OnComponentChanged(component, this, null, value);
            }
        }
示例#30
0
 public override void SetValue(object component, object value)
 {
     if (component != null)
     {
         ISite site = MemberDescriptor.GetSite(component);
         IComponentChangeService service = null;
         object oldValue         = null;
         object invocationTarget = this.GetInvocationTarget(this.componentClass, component);
         if (!this.IsReadOnly)
         {
             if (site != null)
             {
                 service = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
             }
             if (service != null)
             {
                 oldValue = SecurityUtils.MethodInfoInvoke(this.GetMethodValue, invocationTarget, null);
                 try
                 {
                     service.OnComponentChanging(component, this);
                 }
                 catch (CheckoutException exception)
                 {
                     if (exception != CheckoutException.Canceled)
                     {
                         throw exception;
                     }
                     return;
                 }
             }
             try
             {
                 SecurityUtils.MethodInfoInvoke(this.SetMethodValue, invocationTarget, new object[] { value });
                 this.OnValueChanged(invocationTarget, EventArgs.Empty);
             }
             catch (Exception exception2)
             {
                 value = oldValue;
                 if ((exception2 is TargetInvocationException) && (exception2.InnerException != null))
                 {
                     throw exception2.InnerException;
                 }
                 throw exception2;
             }
             finally
             {
                 if (service != null)
                 {
                     service.OnComponentChanged(component, this, oldValue, value);
                 }
             }
         }
     }
 }
示例#31
0
 /// <summary>
 /// 设计时使用,该方法用于提示编辑器内容有更改,
 /// 任何内容的变化均需调用这个方法才可以进行保存
 /// </summary>
 public void NotifyDesignSurfaceChange()
 {
     if (null != Site)
     {
         IComponentChangeService cs = Site.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
         if (null != cs)
         {
             cs.OnComponentChanged(this, null, null, null);
         }
     }
 }
示例#32
0
        internal static void GotoPage(Wizard w, IComponentChangeService cc, ISelectionService ss)
        {
            if (w == null)
                return;

            WizardPageOrderDialog d = new WizardPageOrderDialog();
            d.SetWizard(w);
            d.StartPosition = FormStartPosition.CenterScreen;
            if (d.ShowDialog() == DialogResult.OK)
            {
                string pageName = d.SelectedPageName;
                
                if (d.OrderChanged)
                {
                    if (cc != null)
                        cc.OnComponentChanging(w, TypeDescriptor.GetProperties(w)["WizardPages"]);

                    string[] newOrder = d.OrderedPageNames;
                    w.WizardPages.IgnoreEvents = true;
                    try
                    {
                        WizardPageCollection col = new WizardPageCollection();
                        w.WizardPages.CopyTo(col);
                        w.WizardPages.Clear();
                        foreach (string pn in newOrder)
                            w.WizardPages.Add(col[pn]);
                    }
                    finally
                    {
                        w.WizardPages.IgnoreEvents = false;
                    }

                    if (cc != null)
                        cc.OnComponentChanged(w, TypeDescriptor.GetProperties(w)["WizardPages"], null, null);
                }

                if (pageName != "")
                    w.SelectedPage = w.WizardPages[pageName];
                else if (d.OrderChanged)
                    w.SelectedPageIndex = 0;

                if (ss != null && (pageName!="" || d.OrderChanged))
                    ss.SetSelectedComponents(new WizardPage[] { w.SelectedPage }, SelectionTypes.Replace);
            }
            d.Dispose();
        }
示例#33
0
        internal static PageSliderPage CreatePage(PageSlider parent, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss)
        {
            DesignerTransaction dt = dh.CreateTransaction();
            PageSliderPage page = null;
            try
            {
                page = dh.CreateComponent(typeof(PageSliderPage)) as PageSliderPage;

                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["Controls"]);
                parent.Controls.Add(page);
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["Controls"], null, null);

                if (ss != null)
                    ss.SetSelectedComponents(new PageSliderPage[] { page }, SelectionTypes.Replace);

                TypeDescriptor.GetProperties(parent)["SelectedPage"].SetValue(parent, page);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }

            return page;
        }
示例#34
0
        internal static void DeletePage(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            if (page == null || !(page.Parent is PageSlider))
                return;

            PageSlider slider = (PageSlider)page.Parent;

            DesignerTransaction dt = dh.CreateTransaction("Deleting page");

            try
            {
                if (cc != null)
                    cc.OnComponentChanging(slider, TypeDescriptor.GetProperties(slider)["Controls"]);

                slider.Controls.Remove(page);

                if (cc != null)
                    cc.OnComponentChanged(slider, TypeDescriptor.GetProperties(slider)["Controls"], null, null);

                dh.DestroyComponent(page);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
示例#35
0
        internal static WizardPage CreatePage(Wizard parent, bool innerPage, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle wizardStyle)
        {
            DesignerTransaction dt = dh.CreateTransaction();
            WizardPage page=null;
            try
            {
                page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;
				
				page.AntiAlias=false;
                page.InteriorPage = innerPage;
                if (innerPage)
                {
                    page.PageTitle = "< Wizard step title >";
                    page.PageDescription = "< Wizard step description >";
                }
                if (wizardStyle == eWizardStyle.Default)
                    ApplyDefaultInnerPageStyle(page, dh, cc);
                else if (wizardStyle == eWizardStyle.Office2007)
                    ApplyOffice2007InnerPageStyle(page, dh, cc);
                //else
                //{
                //    TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
                //}

                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
                parent.WizardPages.Add(page);
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);

                if (ss != null)
                    ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);

                TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }

            return page;
        }
示例#36
0
 internal static void SaveGridState(DesignerTransaction dt, Grid grid, IComponentChangeService service)
 {
     service.OnComponentChanging(grid, null);
     service.OnComponentChanged(grid, null, null, null);
     dt.Commit();
 }
示例#37
0
        internal static void DeletePage(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            if (page == null || !(page.Parent is Wizard))
                return;

            Wizard w = page.Parent as Wizard;

            DesignerTransaction dt = dh.CreateTransaction();

            try
            {
                if (cc != null)
                    cc.OnComponentChanging(w, TypeDescriptor.GetProperties(w)["WizardPages"]);

                w.WizardPages.Remove(page);

                if (cc != null)
                    cc.OnComponentChanged(w, TypeDescriptor.GetProperties(w)["WizardPages"], null, null);

                dh.DestroyComponent(page);
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }
        }
示例#38
0
        internal static void ApplyOffice2007WelcomePageStyle(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            DesignerTransaction dt = null;
            if (dh != null) dt = dh.CreateTransaction();
            
            try
            {
                if (cc != null) cc.OnComponentChanging(page, null);
                page.BackColor = Color.Transparent;
                page.Style.Reset();
                //page.BackColor = ColorScheme.GetColor(0xBBDBF7);
                //page.CanvasColor = page.BackColor;
                //page.Style.BackColor = Color.Empty;
                //page.Style.BackColor2 = Color.Empty;
                //page.Style.BackColorBlend.Clear();
                //page.Style.BackColorBlend.AddRange(new BackgroundColorBlend[] {
                //new BackgroundColorBlend(ColorScheme.GetColor(0xBBDBF7), 0f),
                //new BackgroundColorBlend(ColorScheme.GetColor(0xBBDBF7), .3f),
                //new BackgroundColorBlend(ColorScheme.GetColor(0xF3F9FE), .9f),
                //new BackgroundColorBlend(ColorScheme.GetColor(0xFEFFFF), 1f)});
                //page.Style.BackColorGradientAngle = 90;
                //page.Style.BackgroundImage = GetWelcomeImage(eWizardImages.BackgroundOffice2007);
                //page.Style.BackgroundImagePosition = eStyleBackgroundImage.TopLeft;

                if (cc != null) cc.OnComponentChanged(page, null, null, null);
            }
            catch
            {
                dt.Cancel();
                throw;
            }
            finally
            {
                if (dt != null && !dt.Canceled)
                    dt.Commit();
            }
        }
示例#39
0
 internal static void ApplyOffice2007InnerPageStyle(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
 {
     if (cc != null) cc.OnComponentChanging(page, null);
     
     page.BackColor = Color.Transparent;
     page.Style.Reset();
     
     if (cc != null) cc.OnComponentChanged(page, null, null, null);
 }
示例#40
0
        internal static void ApplyDefaultInnerPageStyle(WizardPage page, IDesignerHost dh, IComponentChangeService cc)
        {
            if (cc != null) cc.OnComponentChanging(page, null);

            page.BackColor = SystemColors.Control;
            if (!page.InteriorPage)
            {
                TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
            }
            
            if (cc != null) cc.OnComponentChanged(page, null, null, null);
        }
示例#41
0
        internal static WizardPage CreateWelcomePage(Wizard parent, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle style)
        {
            DesignerTransaction dt = dh.CreateTransaction();
            WizardPage page = null;
            try
            {
                page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;

                if(style == eWizardStyle.Default)
                    ApplyDefaultWelcomePageStyle(page, null, null);
                else
                    ApplyOffice2007WelcomePageStyle(page, null, null);
                //TypeDescriptor.GetProperties(page)["InteriorPage"].SetValue(page, false);
                //TypeDescriptor.GetProperties(page)["BackColor"].SetValue(page, Color.White);
                //TypeDescriptor.GetProperties(page)["CanvasColor"].SetValue(page, Color.White);
                //TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
                //TypeDescriptor.GetProperties(page.Style)["BackgroundImage"].SetValue(page.Style, GetWelcomeImage(false));
                //TypeDescriptor.GetProperties(page.Style)["BackgroundImagePosition"].SetValue(page.Style, eStyleBackgroundImage.TopLeft);
                page.Size = new Size(534, 289);

                // Load labels onto the page, first Welcome to the Wizard...
                System.Windows.Forms.Label label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 18);
                label.Text = "Welcome to the <Wizard Name> Wizard";
                label.BackColor = Color.Transparent;
                try
                {
                    label.Font = new Font("Tahoma", 16);
                    TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
                }
                catch { }
                label.Size = new Size(310, 66);
                label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

                // Wizard description label...
                label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 100);
                label.Text = "This wizard will guide you through the <Enter Process Name>.\r\n\r\n<Enter brief description of the process wizard is covering.>";
                label.BackColor = Color.Transparent;
                try
                {
                    TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
                }
                catch { }
                label.Size = new Size(309, 157);
                label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

                // Click Next to Continue label...
                label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 266);
                label.Text = "To continue, click Next.";
                label.Size = new Size(120, 13);
                label.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                label.BackColor = Color.Transparent;
                
                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
                parent.WizardPages.Add(page);
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);


                if (ss != null)
                    ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);

                TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }

            return page;
        }