Exemple #1
0
        static void Main( )
        {
            if (DataQueryProvider.Connect() == false)
            {
                MessageBox.Show("Please check connection", "Auto generator", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DataQueryProvider.InitDataTables();

            GenerationProvider.DetectModifyDatabase();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MessageBox.Show("Finished", "Auto generator", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #2
0
        void Toolbar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (e.Item.Tag == null)
            {
                return;
            }


            if (e.Item.Tag.ToString().Contains("Skin"))
            {
                SetSkin(e.Item as DevExpress.XtraBars.BarCheckItem);
            }

            HostSurface surface = (HostSurface)SurfaceManager.ActiveDesignSurface;

            #region Tools
            if (e.Item.Tag.ToString() == "DataTable")
            {
                DatabaseManagement form = new DatabaseManagement(DatabaseManagement.ActiveTab.DataTable, this);
                form.ShowDialog();
            }
            if (e.Item.Tag.ToString() == "SP")
            {
                DatabaseManagement form = new DatabaseManagement(DatabaseManagement.ActiveTab.StoredProcedure, this);
                form.ShowDialog();
            }
            if (e.Item.Tag.ToString() == "TableConfig")
            {
                DatabaseManagement form = new DatabaseManagement(DatabaseManagement.ActiveTab.TableConfig, this);
                form.ShowDialog();
            }
            if (e.Item.Tag.ToString() == "FieldConfig")
            {
                DatabaseManagement form = new DatabaseManagement(DatabaseManagement.ActiveTab.FieldConfig, this);
                form.ShowDialog();
            }
            if (e.Item.Tag.ToString() == "EnumDefine")
            {
                DatabaseManagement form = new DatabaseManagement(DatabaseManagement.ActiveTab.EnumDefine, this);
                form.ShowDialog();
            }
            if (e.Item.Tag.ToString() == "GenDLL")
            {
                GenerationProvider.GenerateAll();
                ABCHelper.ABCMessageBox.Show("Done!");
            }
            #endregion

            #region Screens
            if (e.Item.Tag.ToString() == "BindConfig")
            {
                ConfigBinding();
            }
            if (e.Item.Tag.ToString() == "BindRefresh")
            {
                RefreshFieldBindingTree(true);
            }
            #endregion

            #region Standard
            if (e.Item.Tag.ToString() == "NewBlank")
            {
                Worker.AddNewForm();
            }
            if (e.Item.Tag.ToString() == "NewWizard")
            {
                new Wizard.NewView(this).ShowDialog();
            }
            if (e.Item.Tag.ToString() == "Save")
            {
                Worker.SaveCurrentView();
            }
            if (e.Item.Tag.ToString() == "Open")
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Filter           = "xml files (*.xml)|*.xml|All files (*.*)|*.*";
                dlg.FilterIndex      = 2;
                dlg.RestoreDirectory = true;
                dlg.Title            = "Open Layout from XML file";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Worker.OpenFromXMLFile(dlg.FileName);
                }
            }
            #endregion

            if (this.SurfaceManager.ActiveDesignSurface == null)
            {
                return;
            }

            #region Surface

            if (e.Item.Tag.ToString() == "Close")
            {
                Worker.CloseActiveSurface();
            }

            if (e.Item.Tag.ToString() == "Refresh")
            {
                Worker.RefreshActiveSurface();
            }

            if (e.Item.Tag.ToString() == "Run")
            {
                Worker.TestCurrentScreen();
            }


            #region Layout
            if (e.Item.Tag.ToString() == "SelectAll")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.SelectAll);
            }
            if (e.Item.Tag.ToString() == "Delete")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Delete);
            }
            if (e.Item.Tag.ToString() == "Cut")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Cut);
            }
            if (e.Item.Tag.ToString() == "Copy")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Copy);
            }
            if (e.Item.Tag.ToString() == "Paste")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Paste);
            }
            if (e.Item.Tag.ToString() == "Undo")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Undo);
            }
            if (e.Item.Tag.ToString() == "Redo")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.Redo);
            }
            if (e.Item.Tag.ToString() == "Left")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignLeft);
            }
            if (e.Item.Tag.ToString() == "Center")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignVerticalCenters);
            }
            if (e.Item.Tag.ToString() == "Right")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignRight);
            }
            if (e.Item.Tag.ToString() == "Top")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignTop);
            }
            if (e.Item.Tag.ToString() == "Middle")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignHorizontalCenters);
            }
            if (e.Item.Tag.ToString() == "Bottom")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.AlignBottom);
            }
            if (e.Item.Tag.ToString() == "SameWidth")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.SizeToControlWidth);
            }
            if (e.Item.Tag.ToString() == "SameHeight")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.SizeToControlHeight);
            }
            if (e.Item.Tag.ToString() == "SameSize")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.SizeToControl);
            }
            if (e.Item.Tag.ToString() == "BringFront")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.BringToFront);
            }
            if (e.Item.Tag.ToString() == "BringEnd")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.SendToBack);
            }

            if (e.Item.Tag.ToString() == "HorizontalSpacingEqual")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.HorizSpaceMakeEqual);
            }
            if (e.Item.Tag.ToString() == "IncreaseHorizontal")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.HorizSpaceIncrease);
            }
            if (e.Item.Tag.ToString() == "DecreaseHorizontal")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.HorizSpaceDecrease);
            }
            if (e.Item.Tag.ToString() == "RemoveHorizontal")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.HorizSpaceConcatenate);
            }

            if (e.Item.Tag.ToString() == "VerticalSpacingEqual")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.VertSpaceMakeEqual);
            }
            if (e.Item.Tag.ToString() == "IncreaseVertial")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.VertSpaceIncrease);
            }
            if (e.Item.Tag.ToString() == "DecreaseVertical")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.VertSpaceDecrease);
            }
            if (e.Item.Tag.ToString() == "RemoveVertical")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.VertSpaceConcatenate);
            }

            if (e.Item.Tag.ToString() == "Locked")
            {
                surface.PerformAction(System.ComponentModel.Design.StandardCommands.LockControls);
            }

            #endregion

            #region DOCK
            if (e.Item.Tag.ToString() == "DockNone")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.None;
                }
            }

            if (e.Item.Tag.ToString() == "DockFill")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.Fill;
                }
            }
            if (e.Item.Tag.ToString() == "DockLeft")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.Left;
                }
            }
            if (e.Item.Tag.ToString() == "DockRight")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.Right;
                }
            }
            if (e.Item.Tag.ToString() == "DockTop")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.Top;
                }
            }
            if (e.Item.Tag.ToString() == "DockBottom")
            {
                foreach (Control ctrl in surface.ServiceSelection.GetSelectedComponents())
                {
                    ctrl.Dock = DockStyle.Bottom;
                }
            }
            #endregion

            #endregion
        }