Exemple #1
0
        private bool EditMenuItemsChangeCallback(object context)
        {
            IServiceProvider site = this._menu.Site;
            MenuItemCollectionEditorDialog form = new MenuItemCollectionEditorDialog(this._menu, this);

            return(UIServiceHelper.ShowDialog(site, form) == DialogResult.OK);
        }
Exemple #2
0
 internal void RefreshSchema(System.Type objectType, string methodName, System.Type schemaType, bool preferSilent)
 {
     if (((objectType != null) && !string.IsNullOrEmpty(methodName)) && (schemaType != null))
     {
         try
         {
             TypeSchema schema = new TypeSchema(schemaType);
             this._forceSchemaRetrieval = true;
             DataTable[] tables = this.LoadSchema();
             this._forceSchemaRetrieval = false;
             IDataSourceSchema schema2 = (tables == null) ? null : new DataTableArraySchema(tables);
             this.SaveSchema(objectType, methodName, ConvertSchemaToDataTables(schema), schemaType);
             DataTable[]       tableArray2 = this.LoadSchema();
             IDataSourceSchema schema3     = (tableArray2 == null) ? null : new DataTableArraySchema(tableArray2);
             if (!DataSourceDesigner.SchemasEquivalent(schema2, schema3))
             {
                 this.OnSchemaRefreshed(EventArgs.Empty);
             }
         }
         catch (Exception exception)
         {
             if (!preferSilent)
             {
                 UIServiceHelper.ShowError(base.Component.Site, exception, System.Design.SR.GetString("ObjectDataSourceDesigner_CannotGetSchema", new object[] { schemaType.FullName }));
             }
         }
     }
 }
        public override bool OnNext()
        {
            TypeItem selectedTypeItem = this.SelectedTypeItem;

            System.Type type = selectedTypeItem.Type;
            if (type == null)
            {
                ITypeResolutionService service = (ITypeResolutionService)base.ServiceProvider.GetService(typeof(ITypeResolutionService));
                if (service == null)
                {
                    return(false);
                }
                try
                {
                    type = service.GetType(selectedTypeItem.TypeName, true, true);
                }
                catch (Exception exception)
                {
                    UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("ObjectDataSourceDesigner_CannotGetType", new object[] { selectedTypeItem.TypeName }));
                    return(false);
                }
            }
            if (type == null)
            {
                return(false);
            }
            if (type != this._previousSelectedType)
            {
                (base.NextPanel as ObjectDataSourceChooseMethodsPanel).SetType(type);
                this._previousSelectedType = type;
            }
            return(true);
        }
Exemple #4
0
        private void EditBindings()
        {
            IServiceProvider       site = this._menu.Site;
            MenuBindingsEditorForm form = new MenuBindingsEditorForm(site, this._menu, this);

            UIServiceHelper.ShowDialog(site, form);
        }
        private void OnOkButtonClick(object sender, EventArgs e)
        {
            ParameterCollection parameters = new ParameterCollection();

            foreach (ParameterItem item in this._parameterItems)
            {
                if (item.Parameter.DbType == DbType.Object)
                {
                    parameters.Add(new Parameter(item.Parameter.Name, item.Parameter.Type, item.Parameter.DefaultValue));
                }
                else
                {
                    parameters.Add(new Parameter(item.Parameter.Name, item.Parameter.DbType, item.Parameter.DefaultValue));
                }
            }
            try
            {
                parameters.GetValues(null, null);
            }
            catch (Exception exception)
            {
                UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceParameterValueEditorForm_InvalidParameter"));
                return;
            }
            base.DialogResult = DialogResult.OK;
            base.Close();
        }
        public override bool OnNext()
        {
            if (this._saveCheckBox.Checked)
            {
                ICollection      connections = this._dataEnvironment.Connections;
                StringDictionary dictionary  = new StringDictionary();
                foreach (DesignerDataConnection connection in connections)
                {
                    if (connection.IsConfigured)
                    {
                        dictionary.Add(connection.Name, null);
                    }
                }
                if (dictionary.ContainsKey(this._nameTextBox.Text))
                {
                    UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("SqlDataSourceSaveConfiguredConnectionPanel_DuplicateName", new object[] { this._nameTextBox.Text }));
                    this._nameTextBox.Focus();
                    return(false);
                }
            }
            WizardPanel panel = SqlDataSourceConnectionPanel.CreateCommandPanel((SqlDataSourceWizardForm)base.ParentWizard, this._dataConnection, base.NextPanel);

            if (panel == null)
            {
                return(false);
            }
            base.NextPanel = panel;
            return(true);
        }
Exemple #7
0
        private void MemoScope_Load(object sender, System.EventArgs e)
        {
            InitModuleFactory();
            UIServiceHelper.InitServices(msgBus);
            AddToolBar("Dump", 1, Properties.Resources.database_green);
            AddToolBar("Memory", 2, Properties.Resources.ddr_memory_small);
            AddToolBar("Bookmarks", 3, Properties.Resources.award_star_gold_blue);
            AddToolBar("Threads", 4, Properties.Resources.processor_small);
            AddToolBar("Analysis", 5, Properties.Resources.perfomance_analysis);
            InitToolBars();

            var workContent = InitWorkplace(new MemoScopeWorkplace(), DockState.DockLeft);

            InitLog();
            RegisterSkinAction(typeof(Scintilla), ApplyColorsScintilla);
            var       mod       = DockModule(new ExplorerModule(), workContent, DockAlignment.Bottom);
            DockState dockState = MemoScopeSettings.Instance.InitialPosition == DockPanelPosition.Left
                ? MemoScopeSettings.Instance.Visible ? DockState.DockLeft : DockState.DockLeftAutoHide
                : MemoScopeSettings.Instance.Visible ? DockState.DockRight : DockState.DockRightAutoHide;

            workContent.DockState = mod.DockState = dockState;

            WindowState = FormWindowState.Maximized;
            if (AutoLoadFiles != null)
            {
                msgBus.SendMessage(new OpenDumpRequest(AutoLoadFiles));
            }
        }
Exemple #8
0
        private bool SchemaRefreshedCallback(object context)
        {
            IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema();

            if ((base.DataSourceID.Length > 0) && (dataSourceSchema != null))
            {
                if (((((FormView)base.Component).DataKeyNames.Length > 0) || (((FormView)base.Component).ItemTemplate != null)) || (((FormView)base.Component).EditItemTemplate != null))
                {
                    if (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("FormView_SchemaRefreshedWarning"), System.Design.SR.GetString("FormView_SchemaRefreshedCaption", new object[] { ((FormView)base.Component).ID }), MessageBoxButtons.YesNo))
                    {
                        ((FormView)base.Component).DataKeyNames = new string[0];
                        this.AddTemplatesAndKeys(dataSourceSchema);
                    }
                }
                else
                {
                    this.AddTemplatesAndKeys(dataSourceSchema);
                }
            }
            else if ((((((FormView)base.Component).DataKeyNames.Length > 0) || (((FormView)base.Component).ItemTemplate != null)) || (((FormView)base.Component).EditItemTemplate != null)) && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("FormView_SchemaRefreshedWarningNoDataSource"), System.Design.SR.GetString("FormView_SchemaRefreshedCaption", new object[] { ((FormView)base.Component).ID }), MessageBoxButtons.YesNo)))
            {
                ((FormView)base.Component).DataKeyNames       = new string[0];
                ((FormView)base.Component).ItemTemplate       = null;
                ((FormView)base.Component).InsertItemTemplate = null;
                ((FormView)base.Component).EditItemTemplate   = null;
            }
            this.UpdateDesignTimeHtml();
            return(true);
        }
        private bool RefreshSchemaCallback(object context)
        {
            DataList component = (DataList)base.Component;
            bool     flag      = (((component.ItemTemplate == null) && (component.EditItemTemplate == null)) && (component.AlternatingItemTemplate == null)) && (component.SelectedItemTemplate == null);
            IDataSourceViewSchema dataSourceSchema = this.GetDataSourceSchema();

            if ((base.DataSourceID.Length > 0) && (dataSourceSchema != null))
            {
                if (flag || (!flag && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("DataList_RegenerateTemplates"), System.Design.SR.GetString("DataList_ClearTemplatesCaption"), MessageBoxButtons.YesNo))))
                {
                    component.ItemTemplate            = null;
                    component.EditItemTemplate        = null;
                    component.AlternatingItemTemplate = null;
                    component.SelectedItemTemplate    = null;
                    component.DataKeyField            = string.Empty;
                    this.CreateDefaultTemplate();
                    this.UpdateDesignTimeHtml();
                }
            }
            else if (flag || (!flag && (DialogResult.Yes == UIServiceHelper.ShowMessage(base.Component.Site, System.Design.SR.GetString("DataList_ClearTemplates"), System.Design.SR.GetString("DataList_ClearTemplatesCaption"), MessageBoxButtons.YesNo))))
            {
                component.ItemTemplate            = null;
                component.EditItemTemplate        = null;
                component.AlternatingItemTemplate = null;
                component.SelectedItemTemplate    = null;
                component.DataKeyField            = string.Empty;
                this.UpdateDesignTimeHtml();
            }
            return(true);
        }
Exemple #10
0
        internal static System.Type GetType(IServiceProvider serviceProvider, string typeName, bool silent)
        {
            ITypeResolutionService service = null;

            if (serviceProvider != null)
            {
                service = (ITypeResolutionService)serviceProvider.GetService(typeof(ITypeResolutionService));
            }
            if (service == null)
            {
                return(null);
            }
            try
            {
                return(service.GetType(typeName, true, true));
            }
            catch (Exception exception)
            {
                if (!silent)
                {
                    UIServiceHelper.ShowError(serviceProvider, exception, System.Design.SR.GetString("ObjectDataSourceDesigner_CannotGetType", new object[] { typeName }));
                }
                return(null);
            }
        }
Exemple #11
0
        public static DialogResult ShowCreateDataSourceDialog(ControlDesigner controlDesigner, System.Type dataSourceType, bool configure, out string dataSourceID)
        {
            CreateDataSourceDialog form   = new CreateDataSourceDialog(controlDesigner, dataSourceType, configure);
            DialogResult           result = UIServiceHelper.ShowDialog(controlDesigner.Component.Site, form);

            dataSourceID = form.DataSourceID;
            return(result);
        }
        internal static WizardPanel CreateCommandPanel(SqlDataSourceWizardForm wizard, DesignerDataConnection dataConnection, WizardPanel nextPanel)
        {
            IDataEnvironment service = null;
            IServiceProvider site    = wizard.SqlDataSourceDesigner.Component.Site;

            if (site != null)
            {
                service = (IDataEnvironment)site.GetService(typeof(IDataEnvironment));
            }
            bool flag = false;

            if (service != null)
            {
                try
                {
                    IDesignerDataSchema connectionSchema = service.GetConnectionSchema(dataConnection);
                    if (connectionSchema != null)
                    {
                        flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Tables);
                        if (flag)
                        {
                            connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Tables);
                        }
                        else
                        {
                            flag = connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.Views);
                            connectionSchema.GetSchemaItems(DesignerDataSchemaClass.Views);
                        }
                    }
                }
                catch (Exception exception)
                {
                    UIServiceHelper.ShowError(site, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_CouldNotGetConnectionSchema"));
                    return(null);
                }
            }
            if (nextPanel == null)
            {
                if (flag)
                {
                    return(wizard.GetConfigureSelectPanel());
                }
                return(CreateCustomCommandPanel(wizard, dataConnection));
            }
            if (flag)
            {
                if (nextPanel is SqlDataSourceConfigureSelectPanel)
                {
                    return(nextPanel);
                }
                return(wizard.GetConfigureSelectPanel());
            }
            if (nextPanel is SqlDataSourceCustomCommandPanel)
            {
                return(nextPanel);
            }
            return(CreateCustomCommandPanel(wizard, dataConnection));
        }
 public override bool OnNext()
 {
     if (!File.Exists(UrlPath.MapPath(base.ServiceProvider, this.DataFile)))
     {
         UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("AccessDataSourceConnectionChooserPanel_FileNotFound", new object[] { this.DataFile }));
         return(false);
     }
     return(base.OnNext());
 }
        public void SetQueries(DesignerDataConnection dataConnection, SqlDataSourceQuery selectQuery, SqlDataSourceQuery insertQuery, SqlDataSourceQuery updateQuery, SqlDataSourceQuery deleteQuery)
        {
            DesignerDataConnection connection = dataConnection;

            if (!SqlDataSourceDesigner.ConnectionsEqual(this._dataConnection, connection))
            {
                this._dataConnection = connection;
                Cursor    current          = Cursor.Current;
                ArrayList storedProcedures = null;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    IDataEnvironment service = (IDataEnvironment)this._sqlDataSourceDesigner.Component.Site.GetService(typeof(IDataEnvironment));
                    if (service != null)
                    {
                        IDesignerDataSchema connectionSchema = service.GetConnectionSchema(this._dataConnection);
                        if ((connectionSchema != null) && connectionSchema.SupportsSchemaClass(DesignerDataSchemaClass.StoredProcedures))
                        {
                            ICollection schemaItems = connectionSchema.GetSchemaItems(DesignerDataSchemaClass.StoredProcedures);
                            if ((schemaItems != null) && (schemaItems.Count > 0))
                            {
                                storedProcedures = new ArrayList();
                                foreach (DesignerDataStoredProcedure procedure in schemaItems)
                                {
                                    if (!procedure.Name.ToLowerInvariant().StartsWith("AspNet_".ToLowerInvariant(), StringComparison.Ordinal))
                                    {
                                        storedProcedures.Add(procedure);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception exception)
                {
                    UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_CouldNotGetConnectionSchema"));
                }
                finally
                {
                    Cursor.Current = current;
                }
                this._selectCommandEditor.SetConnection(this._dataConnection);
                this._selectCommandEditor.SetStoredProcedures(storedProcedures);
                this._insertCommandEditor.SetConnection(this._dataConnection);
                this._insertCommandEditor.SetStoredProcedures(storedProcedures);
                this._updateCommandEditor.SetConnection(this._dataConnection);
                this._updateCommandEditor.SetStoredProcedures(storedProcedures);
                this._deleteCommandEditor.SetConnection(this._dataConnection);
                this._deleteCommandEditor.SetStoredProcedures(storedProcedures);
                this._selectCommandEditor.SetQuery(selectQuery);
                this._insertCommandEditor.SetQuery(insertQuery);
                this._updateCommandEditor.SetQuery(updateQuery);
                this._deleteCommandEditor.SetQuery(deleteQuery);
            }
        }
Exemple #15
0
        private bool CreateDataSourceCallback(object context)
        {
            CreateDataSourceDialog form   = new CreateDataSourceDialog(this, typeof(IDataSource), true);
            DialogResult           result = UIServiceHelper.ShowDialog(base.Component.Site, form);
            string dataSourceID           = form.DataSourceID;

            if (dataSourceID.Length > 0)
            {
                this.DataSourceID = dataSourceID;
            }
            return(result == DialogResult.OK);
        }
        public override bool OnNext()
        {
            List <System.Type> list = new List <System.Type>();

            System.Type deleteMethodDataObjectType = this.DeleteMethodDataObjectType;
            if (deleteMethodDataObjectType != null)
            {
                list.Add(deleteMethodDataObjectType);
            }
            System.Type insertMethodDataObjectType = this.InsertMethodDataObjectType;
            if (insertMethodDataObjectType != null)
            {
                list.Add(insertMethodDataObjectType);
            }
            System.Type updateMethodDataObjectType = this.UpdateMethodDataObjectType;
            if (updateMethodDataObjectType != null)
            {
                list.Add(updateMethodDataObjectType);
            }
            if (list.Count > 1)
            {
                System.Type type4 = list[0];
                for (int i = 1; i < list.Count; i++)
                {
                    if (type4 != list[i])
                    {
                        UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("ObjectDataSourceChooseMethodsPanel_IncompatibleDataObjectTypes"));
                        return(false);
                    }
                }
            }
            MethodInfo selectMethodInfo = this.SelectMethodInfo;

            if (selectMethodInfo == null)
            {
                return(false);
            }
            if (selectMethodInfo.GetParameters().Length > 0)
            {
                ObjectDataSourceConfigureParametersPanel nextPanel = base.NextPanel as ObjectDataSourceConfigureParametersPanel;
                if (nextPanel == null)
                {
                    nextPanel      = ((ObjectDataSourceWizardForm)base.ParentWizard).GetParametersPanel();
                    base.NextPanel = nextPanel;
                    nextPanel.InitializeParameters(this._objectDataSource.SelectParameters);
                }
                nextPanel.SetMethod(this.SelectMethodInfo);
            }
            return(true);
        }
        internal bool RefreshSchema(DesignerDataConnection connection, string commandText, SqlDataSourceCommandType commandType, ParameterCollection parameters, bool preferSilent)
        {
            IServiceProvider site    = this.SqlDataSource.Site;
            DbCommand        command = null;

            try
            {
                DbProviderFactory dbProviderFactory    = GetDbProviderFactory(connection.ProviderName);
                DbConnection      designTimeConnection = GetDesignTimeConnection(base.Component.Site, connection);
                if (designTimeConnection == null)
                {
                    if (!preferSilent)
                    {
                        UIServiceHelper.ShowError(this.SqlDataSource.Site, System.Design.SR.GetString("SqlDataSourceDesigner_CouldNotCreateConnection"));
                    }
                    return(false);
                }
                command = this.BuildSelectCommand(dbProviderFactory, designTimeConnection, commandText, parameters, commandType);
                DbDataAdapter adapter = CreateDataAdapter(dbProviderFactory, command);
                adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                DataSet dataSet = new DataSet();
                adapter.FillSchema(dataSet, SchemaType.Source, "DefaultView");
                DataTable schemaTable = dataSet.Tables["DefaultView"];
                if (schemaTable == null)
                {
                    if (!preferSilent)
                    {
                        UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceDesigner_CannotGetSchema"));
                    }
                    return(false);
                }
                this.SaveSchema(connection, commandText, schemaTable);
                return(true);
            }
            catch (Exception exception)
            {
                if (!preferSilent)
                {
                    UIServiceHelper.ShowError(site, exception, System.Design.SR.GetString("SqlDataSourceDesigner_CannotGetSchema"));
                }
            }
            finally
            {
                if ((command != null) && (command.Connection.State == ConnectionState.Open))
                {
                    command.Connection.Close();
                }
            }
            return(false);
        }
Exemple #18
0
        private void ValidatePropertyGrid()
        {
            MenuItemContainer selectedNode = (MenuItemContainer)this._treeView.SelectedNode;

            if (selectedNode != null)
            {
                selectedNode.Text = selectedNode.WebMenuItem.Text;
                if (selectedNode.WebMenuItem.Selected && (!selectedNode.WebMenuItem.Selectable || !selectedNode.WebMenuItem.Enabled))
                {
                    UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("MenuItemCollectionEditor_CantSelect"));
                    selectedNode.WebMenuItem.Selected = false;
                    this._propertyGrid.Refresh();
                }
            }
        }
        protected bool CheckValidProvider()
        {
            DesignerDataConnection dataConnection = this.DataConnection;

            try
            {
                SqlDataSourceDesigner.GetDbProviderFactory(dataConnection.ProviderName);
                return(true);
            }
            catch (Exception exception)
            {
                UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceConnectionPanel_ProviderNotFound", new object[] { dataConnection.ProviderName }));
                return(false);
            }
        }
        private void OnBindablePropsTreeAfterSelect(object sender, TreeViewEventArgs e)
        {
            BindablePropertyNode selectedNode = (BindablePropertyNode)this._bindablePropsTree.SelectedNode;

            if (this._currentNode != selectedNode)
            {
                this._currentNode = selectedNode;
                if ((this._currentNode != null) && this._currentNode.IsBound)
                {
                    ExpressionBinding binding = this._currentNode.Binding;
                    if (!this._currentNode.IsGenerated)
                    {
                        ExpressionEditor editor = (ExpressionEditor)this._expressionEditors[binding.ExpressionPrefix];
                        if (editor == null)
                        {
                            UIServiceHelper.ShowMessage(base.ServiceProvider, System.Design.SR.GetString("ExpressionBindingsDialog_UndefinedExpressionPrefix", new object[] { binding.ExpressionPrefix }), System.Design.SR.GetString("ExpressionBindingsDialog_Text", new object[] { this.Control.Site.Name }), MessageBoxButtons.OK);
                            editor = new GenericExpressionEditor();
                        }
                        this._currentEditor  = editor;
                        this._currentSheet   = this._currentEditor.GetExpressionEditorSheet(binding.Expression, base.ServiceProvider);
                        this._internalChange = true;
                        try
                        {
                            foreach (ExpressionItem item in this._expressionBuilderComboBox.Items)
                            {
                                if (string.Equals(item.ToString(), binding.ExpressionPrefix, StringComparison.OrdinalIgnoreCase))
                                {
                                    this._expressionBuilderComboBox.SelectedItem = item;
                                }
                            }
                            this._currentNode.IsValid = this._currentSheet.IsValid;
                        }
                        finally
                        {
                            this._internalChange = false;
                        }
                    }
                }
                else
                {
                    this._expressionBuilderComboBox.SelectedItem = this.NoneItem;
                    this._currentEditor = null;
                    this._currentSheet  = null;
                }
                this._expressionBuilderPropertyGrid.SelectedObject = this._currentSheet;
                this.UpdateUIState();
            }
        }
        private bool ConfigureDataSourceChangeCallback(object context)
        {
            IServiceProvider site    = base.Component.Site;
            IDataEnvironment service = (IDataEnvironment)site.GetService(typeof(IDataEnvironment));

            if (service == null)
            {
                return(false);
            }
            IDataSourceViewSchema schema = this.GetView("DefaultView").Schema;
            bool flag = false;

            if (schema == null)
            {
                this._forceSchemaRetrieval = true;
                schema = this.GetView("DefaultView").Schema;
                this._forceSchemaRetrieval = false;
                if (schema != null)
                {
                    flag = true;
                }
            }
            SqlDataSourceWizardForm form = this.CreateConfigureDataSourceWizardForm(site, service);

            if (UIServiceHelper.ShowDialog(site, form) != DialogResult.OK)
            {
                return(false);
            }
            this.OnComponentChanged(this, new ComponentChangedEventArgs(base.Component, null, null, null));
            IDataSourceViewSchema schema2 = null;

            try
            {
                this._forceSchemaRetrieval = true;
                schema2 = this.GetView("DefaultView").Schema;
            }
            finally
            {
                this._forceSchemaRetrieval = false;
            }
            if (!flag && !DataSourceDesigner.ViewSchemasEquivalent(schema, schema2))
            {
                this.OnSchemaRefreshed(EventArgs.Empty);
            }
            this.OnDataSourceChanged(EventArgs.Empty);
            return(true);
        }
Exemple #22
0
 private void OnQueryBuilderButtonClick(object sender, EventArgs e)
 {
     if ((this._dataConnection.ConnectionString == null) || (this._dataConnection.ConnectionString.Trim().Length == 0))
     {
         UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("SqlDataSourceQueryEditorForm_QueryBuilderNeedsConnectionString"));
     }
     else
     {
         string str = this._dataEnvironment.BuildQuery(this, this._dataConnection, this._queryBuilderMode, this._commandTextBox.Text);
         if ((str != null) && (str.Length > 0))
         {
             this._commandTextBox.Text = str;
         }
         this._commandTextBox.Focus();
         this._commandTextBox.Select(0, 0);
     }
 }
Exemple #23
0
        private bool ConfigureDataSourceChangeCallback(object context)
        {
            bool flag;

            try
            {
                this.SuppressDataSourceEvents();
                IServiceProvider site = base.Component.Site;
                XmlDataSourceConfigureDataSourceForm form = new XmlDataSourceConfigureDataSourceForm(site, this.XmlDataSource);
                flag = UIServiceHelper.ShowDialog(site, form) == DialogResult.OK;
            }
            finally
            {
                this.ResumeDataSourceEvents();
            }
            return(flag);
        }
        internal static void SetRenderOuterTable(bool value, ControlDesigner designer, bool isFormView)
        {
            TransactedChangeCallback callback = null;
            IComponent component             = designer.Component;
            IRenderOuterTableControl control = (IRenderOuterTableControl)component;

            if (value != control.RenderOuterTable)
            {
                if (!value && IsAnyPropertyOnOuterTableChanged(component, isFormView))
                {
                    if (UIServiceHelper.ShowMessage(component.Site, System.Design.SR.GetString("RenderOuterTable_RemoveOuterTableWarning"), System.Design.SR.GetString("RenderOuterTable_RemoveOuterTableCaption", new object[] { control.GetType().Name, control.ID }), MessageBoxButtons.YesNo) == DialogResult.No)
                    {
                        return;
                    }
                    if (callback == null)
                    {
                        callback = delegate(object context) {
                            try
                            {
                                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(component);
                                string[] strArray = isFormView ? formViewStylePropertiesOnOuterTable : loginStylePropertiesOnOuterTable;
                                if (isFormView)
                                {
                                    ((FormView)control).ControlStyle.Reset();
                                }
                                foreach (string str in strArray)
                                {
                                    properties[str].ResetValue(component);
                                }
                                return(true);
                            }
                            catch (Exception)
                            {
                                return(false);
                            }
                        };
                    }
                    ControlDesigner.InvokeTransactedChange(component, callback, null, System.Design.SR.GetString("RenderOuterTableHelper_ResetProperties"));
                }
                control.RenderOuterTable = value;
                TypeDescriptor.Refresh(component);
            }
        }
 protected virtual void DeriveParameters(string providerName, DbCommand command)
 {
     if (string.Equals(providerName, "System.Data.Odbc", StringComparison.OrdinalIgnoreCase))
     {
         OdbcCommandBuilder.DeriveParameters((OdbcCommand)command);
     }
     else if (string.Equals(providerName, "System.Data.OleDb", StringComparison.OrdinalIgnoreCase))
     {
         OleDbCommandBuilder.DeriveParameters((OleDbCommand)command);
     }
     else if (string.Equals(providerName, "System.Data.SqlClient", StringComparison.OrdinalIgnoreCase) || string.IsNullOrEmpty(providerName))
     {
         SqlCommandBuilder.DeriveParameters((SqlCommand)command);
     }
     else
     {
         UIServiceHelper.ShowError(this.SqlDataSource.Site, System.Design.SR.GetString("SqlDataSourceDesigner_InferStoredProcedureNotSupported", new object[] { providerName }));
     }
 }
        protected internal override void OnComplete()
        {
            DesignerDataConnection dataConnection = this._dataConnection;

            if (this._saveCheckBox.Checked)
            {
                try
                {
                    dataConnection = this._dataEnvironment.ConfigureConnection(this, this._dataConnection, this._nameTextBox.Text.Trim());
                }
                catch (Exception exception)
                {
                    if (exception != CheckoutException.Canceled)
                    {
                        UIServiceHelper.ShowError(base.ServiceProvider, exception, System.Design.SR.GetString("SqlDataSourceSaveConfiguredConnectionPanel_CouldNotSaveConnection"));
                    }
                }
            }
            PersistConnectionSettings(this._sqlDataSource, this._sqlDataSourceDesigner, dataConnection);
            this._sqlDataSourceDesigner.SaveConfiguredConnectionState = dataConnection.IsConfigured;
        }
Exemple #27
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            DataBoundControl dataBoundControl = context.Instance as DataBoundControl;

            if (dataBoundControl != null)
            {
                IDesignerHost            service       = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
                DataBoundControlDesigner designer      = (DataBoundControlDesigner)service.GetDesigner(dataBoundControl);
                IComponentChangeService  changeService = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService));
                ControlDesigner.InvokeTransactedChange(dataBoundControl, delegate(object callbackContext) {
                    DataControlFieldsEditor form = new DataControlFieldsEditor(designer);
                    DialogResult result          = UIServiceHelper.ShowDialog(provider, form);
                    if ((result == DialogResult.OK) && (changeService != null))
                    {
                        changeService.OnComponentChanged(dataBoundControl, null, null, null);
                    }
                    return(result == DialogResult.OK);
                }, null, System.Design.SR.GetString("GridView_EditFieldsTransaction"));
                return(value);
            }
            return(null);
        }
Exemple #28
0
        private bool ConfigureDataSourceChangeCallback(object context)
        {
            bool flag;

            try
            {
                this.SuppressDataSourceEvents();
                IServiceProvider           site = base.Component.Site;
                ObjectDataSourceWizardForm form = new ObjectDataSourceWizardForm(site, this);
                if (UIServiceHelper.ShowDialog(site, form) == DialogResult.OK)
                {
                    this.OnDataSourceChanged(EventArgs.Empty);
                    return(true);
                }
                flag = false;
            }
            finally
            {
                this.ResumeDataSourceEvents();
            }
            return(flag);
        }
        private void OnQueryBuilderButtonClick(object sender, EventArgs e)
        {
            IServiceProvider site = this._sqlDataSourceDesigner.Component.Site;

            if ((this._dataConnection.ConnectionString != null) && (this._dataConnection.ConnectionString.Trim().Length == 0))
            {
                UIServiceHelper.ShowError(site, System.Design.SR.GetString("SqlDataSourceCustomCommandEditor_NoConnectionString"));
            }
            else
            {
                DesignerDataConnection connection = this._dataConnection;
                if (string.IsNullOrEmpty(this._dataConnection.ProviderName))
                {
                    connection = new DesignerDataConnection(this._dataConnection.Name, "System.Data.SqlClient", this._dataConnection.ConnectionString, this._dataConnection.IsConfigured);
                }
                string str = this._dataEnvironment.BuildQuery(this, connection, this._editorMode, this._commandTextBox.Text);
                if ((str != null) && (str.Length > 0))
                {
                    this._commandTextBox.Text = str;
                    this._commandTextBox.Focus();
                    this._commandTextBox.Select(0, 0);
                }
            }
        }
Exemple #30
0
        private void UpdatePreview()
        {
            System.Drawing.Image expandImage = this._imageInfo.ExpandImage;
            if (expandImage == null)
            {
                expandImage = this.DefaultPlusImage;
            }
            System.Drawing.Image collapseImage = this._imageInfo.CollapseImage;
            if (collapseImage == null)
            {
                collapseImage = this.DefaultMinusImage;
            }
            System.Drawing.Image noExpandImage = this._imageInfo.NoExpandImage;
            int width = this._imageInfo.Width;

            if (width < 1)
            {
                UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("TreeViewImageGenerator_InvalidValue", new object[] { "Width" }));
            }
            else
            {
                int height = this._imageInfo.Height;
                if (height < 1)
                {
                    UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("TreeViewImageGenerator_InvalidValue", new object[] { "Height" }));
                }
                else
                {
                    int lineWidth = this._imageInfo.LineWidth;
                    if (lineWidth < 1)
                    {
                        UIServiceHelper.ShowError(base.ServiceProvider, System.Design.SR.GetString("TreeViewImageGenerator_InvalidValue", new object[] { "LineWidth" }));
                    }
                    else
                    {
                        int      lineStyle = (int)this._imageInfo.LineStyle;
                        Color    lineColor = this._imageInfo.LineColor;
                        Font     font      = new Font("Tahoma", 10f);
                        Graphics graphics  = Graphics.FromHwnd(base.Handle);
                        int      num5      = (width * 2) + ((int)graphics.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleParent", new object[] { 1 }), font).Width);
                        int      num6      = Math.Max((int)graphics.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleParent", new object[] { 1 }), font).Height, height);
                        graphics.Dispose();
                        int      num7  = num6 * 6;
                        int      num8  = Math.Max(width, this._treeView.NodeIndent);
                        Bitmap   image = new Bitmap(Math.Max(num5, this._previewPanel.Width), Math.Max(num7, this._previewPanel.Height));
                        Graphics g     = Graphics.FromImage(image);
                        int      x     = 5;
                        int      y     = 5;
                        g.FillRectangle(Brushes.White, x, y, num5, num7);
                        this.RenderImage(g, x, y, width, height, '-', lineStyle, lineWidth, lineColor, expandImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 1 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 1 }), font).Height) + 1f) / 2f));
                        y += num6;
                        x -= width;
                        this.RenderImage(g, x, y, width, height, 'r', lineStyle, lineWidth, lineColor, collapseImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 2 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 2 }), font).Height) + 1f) / 2f));
                        y += num6;
                        x -= width;
                        this.RenderImage(g, x, y, width, height, 'i', lineStyle, lineWidth, lineColor, null);
                        x += num8;
                        this.RenderImage(g, x, y, width, height, 't', lineStyle, lineWidth, lineColor, expandImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleParent", new object[] { 1 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleParent", new object[] { 1 }), font).Height) + 1f) / 2f));
                        y += num6;
                        x -= width + num8;
                        this.RenderImage(g, x, y, width, height, 'i', lineStyle, lineWidth, lineColor, null);
                        x += num8;
                        this.RenderImage(g, x, y, width, height, 't', lineStyle, lineWidth, lineColor, noExpandImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleLeaf", new object[] { 1 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleLeaf", new object[] { 1 }), font).Height) + 1f) / 2f));
                        y += num6;
                        x -= width + num8;
                        this.RenderImage(g, x, y, width, height, 'i', lineStyle, lineWidth, lineColor, null);
                        x += num8;
                        this.RenderImage(g, x, y, width, height, 'l', lineStyle, lineWidth, lineColor, noExpandImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleLeaf", new object[] { 2 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleLeaf", new object[] { 2 }), font).Height) + 1f) / 2f));
                        y += num6;
                        x -= width + num8;
                        this.RenderImage(g, x, y, width, height, 'l', lineStyle, lineWidth, lineColor, expandImage);
                        x += width;
                        g.DrawString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 3 }), font, Brushes.Black, (float)x, y + (((height - g.MeasureString(System.Design.SR.GetString("TreeViewImageGenerator_SampleRoot", new object[] { 3 }), font).Height) + 1f) / 2f));
                        g.Dispose();
                        image.MakeTransparent(this._imageInfo.TransparentColor);
                        this._previewPictureBox.Image  = image;
                        this._previewPictureBox.Width  = Math.Max(num5, this._previewPanel.Width);
                        this._previewPictureBox.Height = Math.Max(num7, this._previewPanel.Height);
                    }
                }
            }
        }