Beispiel #1
0
        public void AddForm(Connections.AtiranAccModel.Menu menu_)
        {
            var    form     = GetHubForm.GetNameSpaceForm(menu_.FormID.Value);
            string typeName = form.NameSpace + "." + form.Class;
            string title    = form.Title;
            var    control  = this.GetType().Assembly.CreateInstance(typeName);
            Tab    tab      = new Tab(tabBar, title, (Atiran.UI.WindowsForms.Controls.UserControl)control, slate);

            this.tabBar.AddTab(tab);
            InvisibleSubMenus();
            menu.Left = this.Width;
        }
 public MenuButtonLevelOne(List <Connections.AtiranAccModel.Menu> childeren_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_) : base(childeren_, self_, parent_)
 {
     this.Height                 = 35;
     this.Width                  = 200;
     this.Font                   = FontManager.GetFont("IRANSans", 11F, FontStyle.Regular);
     rightSpace.Width            = 30;
     title.Width                 = 200 - 30;
     title.Height                = 35;
     this.rightSpace.MouseEnter += MenuButtonLevelOne_MouseEnter;
     this.title.MouseEnter      += MenuButtonLevelOne_MouseEnter;
     this.rightSpace.MouseLeave += RightSpace_MouseLeave;
     this.title.MouseLeave      += RightSpace_MouseLeave;
 }
Beispiel #3
0
 public MenuButtonLevelTwo(List <Connections.AtiranAccModel.Menu> childeren_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_) : base(childeren_, self_, parent_)
 {
     this.Width = 300;
     this.Font  = UI.WindowsForms.FontManager.GetFont("IRANSans", 9.5F, FontStyle.Regular);
     indicator  = new Panel()
     {
         Dock      = System.Windows.Forms.DockStyle.Right,
         BackColor = Color.Transparent,
         Width     = 5
     };
     rightSpace.Controls.Add(indicator);
     rightSpace.Width            = 20;
     title.Width                 = 300 - 20;
     title.Height                = 23;
     this.Height                 = 23;
     this.title.MouseEnter      += MenuButtonLevelTwo_MouseEnter;
     this.rightSpace.MouseEnter += MenuButtonLevelTwo_MouseEnter;
     this.title.MouseLeave      += Title_MouseLeave;
     this.rightSpace.MouseLeave += Title_MouseLeave;
     focusedLevelTwo             = true;
 }
Beispiel #4
0
        public void RunModule(Definitions.EnvironmentNames module, Connections.AtiranAccModel.Menu uc = null, bool callFromShortCut = false, Guid TabGUID = default(Guid))
        {
            using (var context = new Atiran.Connections.AtiranAccModel.AccModelEntities(Atiran.Connections.AtiranAccModel.ConnectionInfo.BuildConnectionString()))
            {
                if (module == Definitions.EnvironmentNames.SalesManagement || module == Definitions.EnvironmentNames.KalaGostaran || module == Definitions.EnvironmentNames.Sales || module == Definitions.EnvironmentNames.Accounting || module == Definitions.EnvironmentNames.Rahyab || module == Definitions.EnvironmentNames.Treasury)
                {
                    if (true)
                    {
                    }
                }
                switch (module)
                {
                case Definitions.EnvironmentNames.BasicInformation:
                {
                    break;
                }

                case Definitions.EnvironmentNames.SalesManagement:
                {
                    break;
                }

                case Definitions.EnvironmentNames.KalaGostaran:
                {
                    break;
                }

                case Definitions.EnvironmentNames.Sales:
                {
                    break;
                }

                case Definitions.EnvironmentNames.Reporting:
                {
                    break;
                }

                case Definitions.EnvironmentNames.Accounting:
                {
                    break;
                }

                case Definitions.EnvironmentNames.Rahyab:
                {
                    break;
                }

                case Definitions.EnvironmentNames.EMS:
                {
                    break;
                }

                case Definitions.EnvironmentNames.SMS:
                {
                    break;
                }

                case Definitions.EnvironmentNames.Settings:
                {
                    if (!Connections.AtiranAccModel.ConnectionInfo.OldSac)
                    {
                        if (AccessStatus(7))
                        {
                            if (!parent.environments.Contains(Definitions.EnvironmentNames.Settings))
                            {
                                Settings.Default defaultForm = new Settings.Default(Definitions.EnvironmentNames.Settings)
                                {
                                    SubSystemID = 7,
                                    Text        = ResourceManager.GetResourceManager().GetString("HublblHubItemSettingsText"),
                                    Icon        = (ResourceManager.GetResourceManager().GetObject("Settings_tiny_icon") as Icon)
                                };
                                defaultForm.FormClosing += DefaultForm_FormClosing;
                                defaultForm.SizeChanged += new EventHandler(DefaultForm_SizeChanged);
                                EnvironmentGenerator.Generate(Definitions.EnvironmentNames.Settings, defaultForm);
                                parent.environments.Add(Definitions.EnvironmentNames.Settings, defaultForm);
                                if (callFromShortCut)
                                {
                                    defaultForm.AddForm(uc);
                                }
                                defaultForm.Show();
                            }
                            else
                            {
                                if (callFromShortCut)
                                {
                                    ((Atiran.Settings.Default)parent.environments[Definitions.EnvironmentNames.Settings]).AddForm(uc);
                                }
                                ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.Settings]).WindowState = System.Windows.Forms.FormWindowState.Maximized;
                                ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.Settings]).Focus();
                                if (TabGUID != default(Guid))
                                {
                                    ((Atiran.Settings.Default)parent.environments[Definitions.EnvironmentNames.Settings]).FocuseOnTab(TabGUID);
                                }
                                try
                                {
                                    if (Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion").GetValue("ProductName").ToString().ToLower().Contains("windows 10"))
                                    {
                                        this.Refresh();
                                        ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.Settings]).Refresh();
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                        else
                        {
                            UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام سيستم", "شما مجوز دسترسي به اين زيرسيستم را نداريد");
                        }
                    }
                    break;
                }

                case Definitions.EnvironmentNames.BackupAndRestore:
                {
                    if (!Connections.AtiranAccModel.ConnectionInfo.OldSac)
                    {
                        if (AccessStatus(8))
                        {
                            if (!parent.environments.Contains(Definitions.EnvironmentNames.BackupAndRestore))
                            {
                                BackupAndRestore.Default defaultForm = new BackupAndRestore.Default(Definitions.EnvironmentNames.BackupAndRestore)
                                {
                                    SubSystemID = 8,
                                    Text        = ResourceManager.GetResourceManager().GetString("HublblHubItemBackupAndRestoreText"),
                                    Icon        = (ResourceManager.GetResourceManager().GetObject("Backup_tiny_icon") as Icon)
                                };
                                defaultForm.FormClosing += DefaultForm_FormClosing;
                                defaultForm.SizeChanged += new EventHandler(DefaultForm_SizeChanged);
                                EnvironmentGenerator.Generate(Definitions.EnvironmentNames.BackupAndRestore, defaultForm);
                                parent.environments.Add(Definitions.EnvironmentNames.BackupAndRestore, defaultForm);
                                if (callFromShortCut)
                                {
                                    defaultForm.AddForm(uc);
                                }
                                defaultForm.Show();
                            }
                            else
                            {
                                if (callFromShortCut)
                                {
                                    ((Atiran.BackupAndRestore.Default)parent.environments[Definitions.EnvironmentNames.BackupAndRestore]).AddForm(uc);
                                }
                                ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.BackupAndRestore]).WindowState = System.Windows.Forms.FormWindowState.Maximized;
                                ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.BackupAndRestore]).Focus();
                                if (TabGUID != default(Guid))
                                {
                                    ((Atiran.BackupAndRestore.Default)parent.environments[Definitions.EnvironmentNames.BackupAndRestore]).FocuseOnTab(TabGUID);
                                }
                                try
                                {
                                    if (Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion").GetValue("ProductName").ToString().ToLower().Contains("windows 10"))
                                    {
                                        this.Refresh();
                                        ((EnviromentMainForm)parent.environments[Definitions.EnvironmentNames.BackupAndRestore]).Refresh();
                                    }
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }
                        else
                        {
                            UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيام سيستم", "شما مجوز دسترسي به اين زيرسيستم را نداريد");
                        }
                    }
                    break;
                }

                case Definitions.EnvironmentNames.Treasury:
                {
                    break;
                }
                }
            }
        }
Beispiel #5
0
        public MenuButton(List <Connections.AtiranAccModel.Menu> menuData_, Connections.AtiranAccModel.Menu self_, MenuContainer parent_)
        {
            this.Margin = new Padding(0);
            menuData    = menuData_;
            self        = self_;
            children    = menuData.Where(md => md.ParentMenuID == self.MenuID).OrderBy(i => i.order).ToList();
            parent      = parent_;
            parent.AddItem(this);
            tlp                = new ToolTip();
            tlp.OwnerDraw      = true;
            tlp.Draw          += Tlp_Draw;
            tlp.Popup         += Tlp_Popup;
            this.FlowDirection = FlowDirection.RightToLeft;

            rightSpace = new Panel();

            rightSpace.Height = this.Height;
            rightSpace.Margin = new Padding(0);
            this.Controls.Add(rightSpace);

            title = new Label();
            if (children.Count > 0)
            {
                title.Image      = ResourceManager.GetResourceManager().GetObject("sort_down_green") as Image;
                title.ImageAlign = ContentAlignment.MiddleLeft;
                title.Padding    = new Padding(5, 0, 0, 0);
            }
            title.TextAlign = ContentAlignment.MiddleRight;
            title.Text      = (self_.Titel.Length > title.Width) ? " ... " + self_.Titel.Remove(self_.Titel.LastIndexOf(' ')).ToString() : self_.Titel;
            title.Tag       = self_.MenuID;
            title.Height    = this.Height;
            title.Margin    = new Padding(0);

            this.Controls.Add(title);

            this.ControlAdded += MenuButton_ControlAdded;
            this.Enter        += MenuButton_Enter;
            childContainer     = new MenuContainerLevelTwo((Atiran.UI.WindowsForms.UIElements.Form) this.Parent.Parent, (MenuContainer)this.parent, this);
            ((Atiran.UI.WindowsForms.UIElements.Form) this.Parent.Parent).AddToSubMenus(childContainer);
            childContainer.Visible = false;

            if (children != null && children.Count > 0)
            {
                foreach (Connections.AtiranAccModel.Menu c in children)
                {
                    MenuButtonLevelTwo mb = new MenuButtonLevelTwo(menuData, c, childContainer);
                }
            }
            childContainer.Top = this.Top + 69;

            //childContainer.Left = this.parent.Left - 200;
            this.BackColor              = Color.FromArgb(56, 79, 99);
            this.ForeColor              = Color.FromArgb(255, 255, 255);
            this.title.MouseMove       += MenuButtonMouseMove;
            this.title.MouseLeave      += MenuButton_MouseLeave;
            this.title.MouseEnter      += MenuButton_MouseEnter;
            this.title.Click           += MenuButton_Click;
            this.rightSpace.MouseMove  += MenuButtonMouseMove;
            this.rightSpace.MouseLeave += MenuButton_MouseLeave;
            this.rightSpace.MouseEnter += MenuButton_MouseEnter;
            this.rightSpace.Click      += MenuButton_Click;
            this.MouseHover            += MenuButton_MouseHover;
        }
Beispiel #6
0
 public void RunnerFromHub(Definitions.EnvironmentNames name, Connections.AtiranAccModel.Menu m, bool shortCut)
 {
     new HubButton(name, this).RunModule(name, m, shortCut);
 }