public Form1()
        {
            InitializeComponent();

            queryBuilder1.ActiveUnionSubQueryChanged += delegate
            {
                sqlTextEditor1.ExpressionContext = queryBuilder1.ActiveUnionSubQuery;
            };
            dataViewer1.SqlQuery = queryBuilder1.SQLQuery;
            // DEMO WARNING
            if (BuildInfo.GetEdition() == BuildInfo.Edition.Trial)
            {
                Panel trialNoticePanel = new Panel
                {
                    AutoSize     = true,
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    BackColor    = Color.LightGreen,
                    BorderStyle  = BorderStyle.FixedSingle,
                    Dock         = DockStyle.Top,
                    Padding      = new Padding(6, 5, 3, 0),
                };

                Label label = new Label
                {
                    AutoSize = true,
                    Margin   = new Padding(0),
                    Text     =
                        @"Generation of random aliases for the query output columns is the limitation of the trial version. The full version is free from this behavior.",
                    Dock = DockStyle.Fill,
                    UseCompatibleTextRendering = true
                };

                var buttonClose = new PictureBox
                {
                    Image = Properties.Resources.cancel, SizeMode = PictureBoxSizeMode.AutoSize, Cursor = Cursors.Hand
                };
                buttonClose.Click += delegate { Controls.Remove(trialNoticePanel); };

                trialNoticePanel.Controls.Add(buttonClose);

                trialNoticePanel.Resize += delegate
                {
                    buttonClose.Location = new Point(trialNoticePanel.Width - buttonClose.Width - 10,
                                                     trialNoticePanel.Height / 2 - buttonClose.Height / 2);
                };

                trialNoticePanel.Controls.Add(label);
                Controls.Add(trialNoticePanel);

                Controls.SetChildIndex(trialNoticePanel, 2);
            }

            Load += Form1_Load;
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            _openFileDialog.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
            _saveFileDialog.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";

            sqlTextEditor1.QueryProvider   = queryBuilder;
            queryBuilder.SleepModeChanged += QueryBuilder_SleepModeChanged;
            queryBuilder.QueryAwake       += QueryBuilder_QueryAwake;

            dataGridView1.SqlQuery             = queryBuilder.SQLQuery;
            dataGridView1.SqlGenerationOptions = queryBuilder.SQLGenerationOptions;

            // DEMO WARNING
            if (BuildInfo.GetEdition() == BuildInfo.Edition.Trial)
            {
                var grid = new Grid();

                var trialNoticePanel = new Border
                {
                    BorderBrush     = Brushes.Black,
                    BorderThickness = new Thickness(1),
                    Background      = Brushes.LightGreen,
                    Padding         = new Thickness(5),
                    Margin          = new Thickness(0, 0, 0, 2)
                };
                trialNoticePanel.SetValue(Grid.RowProperty, 0);

                var label = new TextBlock
                {
                    Text =
                        @"Generation of random aliases for the query output columns is the limitation of the trial version. The full version is free from this behavior.",
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top
                };

                var button = new Button
                {
                    Background          = Brushes.Transparent,
                    Padding             = new Thickness(0),
                    BorderThickness     = new Thickness(0),
                    Cursor              = Cursors.Hand,
                    Margin              = new Thickness(0, 0, 5, 0),
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Content             = new Image
                    {
                        Source  = Properties.Resources.cancel.GetImageSource(),
                        Stretch = Stretch.None
                    }
                };

                button.Click += delegate { PanelNotifications.Children.Remove(grid); };

                button.SetValue(Grid.RowProperty, 0);

                trialNoticePanel.Child = label;
                grid.Children.Add(trialNoticePanel);
                grid.Children.Add(button);

                PanelNotifications.Children.Add(grid);
            }
        }
Пример #3
0
        public MainForm()
        {
            InitializeComponent();

            // Options to present the formatted SQL query text to end-user
            // Use names of virtual objects, do not replace them with appropriate derived tables
            _sqlFormattingOptions = new SQLFormattingOptions {
                ExpandVirtualObjects = false
            };

            // Options to generate the SQL query text for execution against a database server
            // Replace virtual objects with derived tables
            _sqlGenerationOptions = new SQLGenerationOptions {
                ExpandVirtualObjects = true
            };

            if (Program.Settings.WindowPlacement == Rectangle.Empty)
            {
                StartPosition = FormStartPosition.WindowsDefaultLocation;
            }
            else
            {
                Bounds = Program.Settings.WindowPlacement;
            }

            if (Program.Settings.IsMaximized)
            {
                WindowState = FormWindowState.Maximized;
            }

            LoadLanguages();

            SizeChanged            += MainForm_SizeChanged;
            LocationChanged        += MainForm_LocationChanged;
            MdiChildActivate       += MainForm_MdiChildActivate;
            Application.Idle       += Application_Idle;
            DBView.ItemDoubleClick += DBView_ItemDoubleClick;

            TryToLoadOptions();

            // DEMO WARNING

            if (BuildInfo.GetEdition() == BuildInfo.Edition.Trial)
            {
                Panel trialNoticePanel = new Panel
                {
                    AutoSize     = true,
                    AutoSizeMode = AutoSizeMode.GrowAndShrink,
                    BackColor    = Color.LightGreen,
                    BorderStyle  = BorderStyle.FixedSingle,
                    Dock         = DockStyle.Top,
                    Padding      = new Padding(6, 5, 3, 0),
                };

                Label label = new Label
                {
                    AutoSize = true,
                    Margin   = new Padding(0),
                    Text     = @"Generation of random aliases for the query output columns is the limitation of the trial version. The full version is free from this behavior.",
                    Dock     = DockStyle.Fill,
                    UseCompatibleTextRendering = true
                };

                var buttonClose = new PictureBox {
                    Image = Properties.Resources.cancel, SizeMode = PictureBoxSizeMode.AutoSize, Cursor = Cursors.Hand
                };
                buttonClose.Click += delegate { Controls.Remove(trialNoticePanel); };

                trialNoticePanel.Controls.Add(buttonClose);

                trialNoticePanel.Resize += delegate
                {
                    buttonClose.Location = new Point(trialNoticePanel.Width - buttonClose.Width - 10, trialNoticePanel.Height / 2 - buttonClose.Height / 2);
                };

                trialNoticePanel.Controls.Add(label);
                Controls.Add(trialNoticePanel);

                Controls.SetChildIndex(trialNoticePanel, 2);
            }
        }
        public MainWindow()
        {
            // Options to present the formatted SQL query text to end-user
            // Use names of virtual objects, do not replace them with appropriate derived tables
            _sqlFormattingOptions = new SQLFormattingOptions {
                ExpandVirtualObjects = false
            };

            // Options to generate the SQL query text for execution against a database server
            // Replace virtual objects with derived tables
            _sqlGenerationOptions = new SQLGenerationOptions {
                ExpandVirtualObjects = true
            };

            InitializeComponent();

            Closing += MainWindow_Closing;
            MdiContainer1.ActiveWindowChanged += MdiContainer1_ActiveWindowChanged;
            Dispatcher.CurrentDispatcher.Hooks.DispatcherInactive += Hooks_DispatcherInactive;

            var currentLang = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;

            LoadLanguage();

            var defLang = "en";

            if (Helpers.Localizer.Languages.Contains(currentLang.ToLower()))
            {
                Language = XmlLanguage.GetLanguage(currentLang);
                defLang  = currentLang.ToLower();
            }

            var menuItem = MenuItemLanguage.Items.Cast <MenuItem>().First(item => (string)item.Tag == defLang);

            menuItem.IsChecked = true;

            TryToLoadOptions();

            // DEMO WARNING
            if (BuildInfo.GetEdition() == BuildInfo.Edition.Trial)
            {
                var trialNoticePanel = new Border
                {
                    BorderBrush     = Brushes.Black,
                    BorderThickness = new Thickness(1),
                    Background      = Brushes.LightGreen,
                    Padding         = new Thickness(5),
                    Margin          = new Thickness(0, 0, 0, 2)
                };
                trialNoticePanel.SetValue(Grid.RowProperty, 1);

                var label = new TextBlock
                {
                    Text =
                        @"Generation of random aliases for the query output columns is the limitation of the trial version. The full version is free from this behavior.",
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top
                };

                var button = new Button
                {
                    Background          = Brushes.Transparent,
                    Padding             = new Thickness(0),
                    BorderThickness     = new Thickness(0),
                    Cursor              = Cursors.Hand,
                    Margin              = new Thickness(0, 0, 5, 0),
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Content             = new Image
                    {
                        Source  = Properties.Resources.cancel.GetImageSource(),
                        Stretch = Stretch.None
                    }
                };

                button.Click += delegate { GridRoot.Visibility = Visibility.Collapsed; };

                trialNoticePanel.Child = label;
                GridRoot.Children.Add(trialNoticePanel);
                GridRoot.Children.Add(button);
            }
        }