示例#1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.txtTableName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 2:

            #line 32 "..\..\..\ScriptGen.xaml"
                ((System.Windows.Controls.TabControl)(target)).SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TabControl_SelectionChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.TabItem1 = ((System.Windows.Controls.TabItem)(target));
                return;

            case 4:
                this.txtFileName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:
                this.btnBrowse = ((System.Windows.Controls.Button)(target));

            #line 44 "..\..\..\ScriptGen.xaml"
                this.btnBrowse.Click += new System.Windows.RoutedEventHandler(this.btnBrowse_Click);

            #line default
            #line hidden
                return;

            case 6:
                this.TabItem2 = ((System.Windows.Controls.TabItem)(target));
                return;

            case 7:
                this.txtHeader = ((System.Windows.Controls.TextBox)(target));
                return;

            case 8:
                this.ScriptGen1 = ((FastDB.Control.ScriptGeneratorControl)(target));
                return;
            }
            this._contentLoaded = true;
        }
        private void cmbDataType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox currentCmb = (ComboBox)sender;

            ScriptGen scriptgenerator = (ScriptGen)GetTopLevelControl(this);
            ScriptGeneratorControl StackPanelScriptGen = new ScriptGeneratorControl();
            int numberOfStackPanel = scriptgenerator.ScriptGen1.StackPanelScriptGen.Children.Count;

            for (int i = 0; i < numberOfStackPanel; i++)
            {
                if (scriptgenerator.ScriptGen1.StackPanelScriptGen.Children[i] != currentCmb)
                {
                    if (new string[] { "TINYTEXT", "TEXT", "BLOB", "MEDIUMTEXT", "MEDIUMBLOB", "LONGTEXT", "LONGBLOB", "FLOAT", "DATE", "DATETIME", "TIMESTAMP", "TIME", "SET" }.Contains(currentCmb.SelectedItem.ToString()))
                    {
                        txtSize.IsEnabled = false;
                    }
                    else
                    {
                        txtSize.IsEnabled = true;
                    }
                }
            }
        }
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            Button    btnDelete = (Button)sender;
            ScriptGen sg        = (ScriptGen)GetTopLevelControl(this.cmbDataType);
            ScriptGeneratorControl scriptgenerator = (ScriptGeneratorControl)GetRVC(this.cmbDataType);
            DependencyObject       parent          = GetRVC(this.cmbDataType);

            if (parent != null)
            {
                //ScriptGen  = (ScriptGen)parent;
                //ScriptGeneratorControl sg = (ScriptGeneratorControl)parent;
                if (scriptgenerator.StackPanelScriptGen.Children.Count > 0)
                {
                    DockPanel            dkp           = (DockPanel)btnDelete.Parent;
                    ScirptGenControlMore scriptGenMore = (ScirptGenControlMore)((Grid)((StackPanel)dkp.Parent).Parent).Parent;
                    scriptgenerator.StackPanelScriptGen.Children.Remove(scriptGenMore);
                }
                if (scriptgenerator.StackPanelScriptGen.Children.Count == 0)
                {
                    scriptgenerator.btnGenerateScript.Visibility = System.Windows.Visibility.Hidden;
                    scriptgenerator.borderJoinDock.Visibility    = System.Windows.Visibility.Hidden;
                }
            }
        }
        private void cmbDataType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox currentCmb = (ComboBox)sender;

            ScriptGen scriptgenerator = (ScriptGen)GetTopLevelControl(this);
            ScriptGeneratorControl StackPanelScriptGen = new ScriptGeneratorControl();
            int numberOfStackPanel = scriptgenerator.ScriptGen1.StackPanelScriptGen.Children.Count;
            for (int i = 0; i < numberOfStackPanel; i++)
            {
                if (scriptgenerator.ScriptGen1.StackPanelScriptGen.Children[i] != currentCmb)
                {
                    if (new string[] { "TINYTEXT", "TEXT", "BLOB", "MEDIUMTEXT", "MEDIUMBLOB", "LONGTEXT", "LONGBLOB", "FLOAT", "DATE", "DATETIME", "TIMESTAMP", "TIME", "SET" }.Contains(currentCmb.SelectedItem.ToString()))
                    {
                        txtSize.IsEnabled = false;
                    }
                    else
                    {
                        txtSize.IsEnabled = true;
                    }
                }

            }
        }