Exemple #1
1
        public PanelExTitle()
        {
            m_ExpandChangeButton = new ButtonItem("close");
            m_ExpandChangeButton.Style = eDotNetBarStyle.Office2003;
            m_ExpandChangeButton.Image = BarFunctions.LoadBitmap("SystemImages.CollapseTitle.png");
            m_ExpandChangeButton.Displayed = true;
            m_ExpandChangeButton.Click += new EventHandler(m_ExpandChangeButton_Click);

            m_ItemContainer = new ItemContainer();
            m_ItemContainer.ContainerControl = this;
            m_ItemContainer.Style = eDotNetBarStyle.Office2003;
            m_ItemContainer.SubItems.Add(m_ExpandChangeButton);
            base.MarkupUsesStyleAlignment = true;
        }
Exemple #2
0
        //开始操作
        public void HomeOperation(ButtonItem button)
        {
            string action = button.Text;
            switch (action)
            {
                case "openmxd":
                    OpenMXD();
                    break;
                case "zoomin":
                    MapNavigation("zoomin");
                    break;
                case "点":
                    SpatialQuery(action);
                    break;
                case "attributequery":
                    AttributeQuery();
                    break;
                case "adddata":
                    AddData();
                    break;
                default:

                    break;
            }


        }
Exemple #3
0
 private void Escaneo_Load(object sender, EventArgs e)
 {
     try
     {
         if (devices.Count != 0)
         {
             DevComponents.DotNetBar.BaseItem[] botones = new DevComponents.DotNetBar.BaseItem[devices.Count];
             int i = 0;
             foreach (string device in devices)
             {
                 botones[i]        = new DevComponents.DotNetBar.ButtonItem();
                 botones[i].Text   = device.Split('|')[0];
                 botones[i].Click += new System.EventHandler(this.seleccionarEscaner);
                 i++;
             }
             btnEscaners.SubItems.AddRange(botones);
         }
         else
         {
             btnEscaners.SubItems.Add(new DevComponents.DotNetBar.ButtonItem("btnConectados", "No hay escaners conectados"));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #4
0
        public static ButtonItemPainter CreateButtonPainter(ButtonItem button)
        {
            if (button is RibbonTabItem)
            {
                return CreateRibbonTabItemPainter((RibbonTabItem)button);
            }
            if (button is RibbonOverflowButtonItem)
            {
                ButtonItemPainter p = CreateRibbonOverflowButtonPainter((RibbonOverflowButtonItem)button);
                if (p != null)
                    return p;
            }

            eDotNetBarStyle buttonEffectiveStyle = button.EffectiveStyle;
            if (buttonEffectiveStyle == eDotNetBarStyle.Office2010 && button.ContainerState == eContainerState.NavigationPane)
            {
                return _Office2010NavPaneButtonPainter;
            }
            
            if (buttonEffectiveStyle == eDotNetBarStyle.Office2010 && button is ApplicationButton)
                return Office2010ApplicationButtonPainter;
            else if (button is DevComponents.DotNetBar.Metro.MetroAppButton || button is ApplicationButton && buttonEffectiveStyle == eDotNetBarStyle.Metro)
                return MetroAppButtonPainter;

            if (BarFunctions.IsOffice2007Style(buttonEffectiveStyle))
            {
                if (buttonEffectiveStyle == eDotNetBarStyle.Metro)
                    return m_MetroButtonPainter;
                if (button.ContainerControl is RibbonBar)
                    return m_Office2007Painter;
                return m_Office2007Painter;
            }
            return m_Office2003Painter;
        }
        private void defaultToolMenu()
        {
            //ButtonItem toolbarItem0 = new ButtonItem("redept", "切换科室");

            //toolbarItem0.ImageFixedSize = new Size(30, 30);
            //toolbarItem0.Image = Image.FromFile(@"images\1.png");
            //toolbarItem0.ImagePosition = eImagePosition.Top;
            ButtonItem toolbarItem1 = new ButtonItem("relogin", "切换用户");
            toolbarItem1.ImageFixedSize = new Size(30, 30);
            toolbarItem1.Image = Image.FromFile(AppGlobal.AppRootPath + @"images\2.png");
            toolbarItem1.ImagePosition = eImagePosition.Top;
            ButtonItem toolbarItem2 = new ButtonItem("changepassword", "修改密码");
            toolbarItem2.ImageFixedSize = new Size(30, 30);
            toolbarItem2.Image = Image.FromFile(AppGlobal.AppRootPath + @"images\3.png");
            toolbarItem2.ImagePosition = eImagePosition.Top;
            ButtonItem toolbarItem3 = new ButtonItem("welcome", "系统首页");
            toolbarItem3.BeginGroup = true;
            toolbarItem3.ImageFixedSize = new Size(30, 30);
            toolbarItem3.Image = Image.FromFile(AppGlobal.AppRootPath + @"images\1.png");
            toolbarItem3.ImagePosition = eImagePosition.Top;

            ButtonItem toolbarItem4 = new ButtonItem("close", "最小化系统");
            toolbarItem4.ImageFixedSize = new Size(30, 30);
            toolbarItem4.Image = Image.FromFile(AppGlobal.AppRootPath + @"images\4.png");
            toolbarItem4.ImagePosition = eImagePosition.Top;
            toolbarItem4.BeginGroup = true;

            this.barMainToolBar.Items.AddRange(new BaseItem[] { toolbarItem3, 
                //toolbarItem0, 
                toolbarItem1, toolbarItem2, toolbarItem4 });
        }
Exemple #6
0
 void sbuttonItem6_Click(object sender, EventArgs e)
 {
     try
     {
         DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
         if (sender != null)
         {
             var s = buttonItem.Tag as StatusInfoV3_1;
             if (s != null)
             {
                 FormEditHistoryAnalyseParam f = new FormEditHistoryAnalyseParam(m_viewModel.CurrentTask, s.AlgthmType, s.AnalyseParam);
                 if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                 {
                     //m_viewModel.CurrentTask.AnalyseParam = f.Task.AnalyseParam;
                     bool ret = m_viewModel.ReAnalyse(f.AlgthmType, f.AnalyseParam);
                     if (ret)
                     {
                         //m_isSplitTimeChanged = false;
                         //this.highlighter1.SetHighlightColor(this.comboBoxExSplitTime, DevComponents.DotNetBar.Validator.eHighlightColor.None);
                     }
                 }
             }
         }
     }
     catch (SDKCallException ex)
     {
         MessageBoxEx.Show("当前状态无法进行重新分析,[" + ex.ErrorCode + "]" + ex.Message, Framework.Environment.PROGRAM_NAME);
     }
 }
Exemple #7
0
        private void LoadHistory()
        {
            string strfile    = Path.Combine(Application.StartupPath, "history.txt");
            string strHistory = FileFolderHelper.FileToString(strfile);

            if (strHistory.Length == 0)
            {
                return;
            }

            string[] historys = strHistory.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string history in historys)
            {
                DevComponents.DotNetBar.ButtonItem newitemLeft = new DevComponents.DotNetBar.ButtonItem();
                newitemLeft.ImagePaddingHorizontal = 8;
                newitemLeft.Name   = history;
                newitemLeft.Text   = history;
                newitemLeft.Click += new System.EventHandler(this.historyItem_Click_Left);
                this.bOpenFolder1.SubItems.Add(newitemLeft);

                DevComponents.DotNetBar.ButtonItem newitemRight = new DevComponents.DotNetBar.ButtonItem();
                newitemRight.ImagePaddingHorizontal = 8;
                newitemRight.Name   = history;
                newitemRight.Text   = history;
                newitemRight.Click += new System.EventHandler(this.historyItem_Click_Right);
                this.bOpenFolder2.SubItems.Add(newitemRight);
            }
        }
Exemple #8
0
        private void historyItem_Click(object sender, EventArgs e)
        {
            DevComponents.DotNetBar.ButtonItem item = sender as DevComponents.DotNetBar.ButtonItem;
            string filename = item.Text;

            OpenDoc(filename);
        }
Exemple #9
0
        private RibbonBar CreateChildMenus(MenuInfo subMenuInfo)
        {
            ButtonItem buttonItem = new DevComponents.DotNetBar.ButtonItem();
            buttonItem.Name = subMenuInfo.MenuID;
            buttonItem.Text = subMenuInfo.MenuName;
            buttonItem.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
            //buttonItem.Image = ((System.Drawing.Image)(resourceManager.GetObject("buttonItem1.Image")));
            //buttonItem.Image = ((System.Drawing.Image)(resourceManager.GetObject("OpenExistingPlace")));
            buttonItem.Image = imageList.Images["OpenExistingPlace"];
            buttonItem.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
            buttonItem.RibbonWordWrap = false;
            buttonItem.Visible = true;

            DevComponents.DotNetBar.RibbonBar ribbonBar = new DevComponents.DotNetBar.RibbonBar();

            ribbonBar.AutoOverflowEnabled = true;
            ribbonBar.BackgroundMouseOverStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            ribbonBar.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            ribbonBar.ContainerControlProcessDialogKey = true;
            ribbonBar.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
            buttonItem});
            ribbonBar.Location = new System.Drawing.Point(3, 0);
            ribbonBar.Name = System.Guid.NewGuid().ToString();
            ribbonBar.Size = new System.Drawing.Size(337, 82);
            ribbonBar.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            ribbonBar.TabIndex = 0;
            //ribbonBar.Text = subMenuInfo.MenuName;
            ribbonBar.TitleStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            ribbonBar.TitleStyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            ribbonBar.Visible = true;

            return ribbonBar;
        }
        private void LoadSubSystem()
        {
            cboCurrentSystem.Items.Clear();
            dicSubSystem.Clear();
            this.barMenu.Items.Clear();
            foreach (var dr in from DataRow dr in ClientCache.Instance.DTUserMoule.Rows
                     let moduleType = BusinessLogic.ConvertToNullableInt(dr[PiModuleTable.FieldModuleType])
                                      let loadModule = (moduleType == null || moduleType == 1 || moduleType == 3) ? true : false
                                                       where (dr[PiModuleTable.FieldParentId] == DBNull.Value || dr[PiModuleTable.FieldParentId] == null || string.IsNullOrEmpty(dr[PiModuleTable.FieldParentId].ToString())) && loadModule select dr)
            {
                dicSubSystem.Add(dr[PiModuleTable.FieldFullName].ToString().Trim(), dr[PiModuleTable.FieldId].ToString());
                cboCurrentSystem.Items.Add(dr[PiModuleTable.FieldFullName].ToString().Trim());

                //增加横向菜单
                var buttonItem1 = new DevComponents.DotNetBar.ButtonItem
                {
                    Name = dr[PiModuleTable.FieldId].ToString(),
                    Text = dr[PiModuleTable.FieldFullName].ToString().Trim()
                };
                buttonItem1.Click += this.menuItem_Click;
                this.barMenu.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] { buttonItem1 });
            }

            if (cboCurrentSystem.Items.Count > 0)
            {
                cboCurrentSystem.SelectedIndex = 0;
            }
        }
Exemple #11
0
 protected override Rectangle GetTextRectangle(ButtonItem button, ItemPaintArgs pa, eTextFormat stringFormat, CompositeImage image)
 {
     Rectangle r = base.GetTextRectangle(button, pa, stringFormat, image);
     if (image == null && string.IsNullOrEmpty(button.Symbol))
         r.Inflate(-3, 0);
     return r;
 }
Exemple #12
0
        private void CreatePopupMenu()
        {
            DevComponents.DotNetBar.ButtonItem item;

            m_PopupFromCode = new DevComponents.DotNetBar.ButtonItem();

            // Create items
            item      = new DevComponents.DotNetBar.ButtonItem("bCut");
            item.Text = "Cu&t";
            // To remember: cannot use the ImageIndex for items that we create from code
            item.Image = imageList1.Images[0];
            m_PopupFromCode.SubItems.Add(item);

            item       = new DevComponents.DotNetBar.ButtonItem("bCopy");
            item.Text  = "&Copy";
            item.Image = imageList1.Images[1];
            m_PopupFromCode.SubItems.Add(item);

            item       = new DevComponents.DotNetBar.ButtonItem("bPaste");
            item.Text  = "&Paste";
            item.Image = imageList1.Images[2];
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bOpenFile");
            item.Text       = "&Open File";
            item.Enabled    = false;
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bInsertBreakpoint");
            item.Text       = "Insert B&reakpoint";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item      = new DevComponents.DotNetBar.ButtonItem("bNewBreakpoint");
            item.Text = "New &Breakpoint...";
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bRunToCursor");
            item.Text       = "&Run To Cursor";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bAddTask");
            item.Text       = "Add Task List S&hortcut";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            // Setup side-bar, make sure that image that is used fits, or exceeds the height
            // Side-bar will be displayed only for popup menus
            DevComponents.DotNetBar.SideBarImage si = new DevComponents.DotNetBar.SideBarImage();
            si.Picture = new Bitmap(typeof(Popup.Form1), "devco.jpg");
            // If image exceeds the size of the popup menu this specifies the image alignment
            si.Alignment = DevComponents.DotNetBar.eAlignment.Bottom;
            // If there is no image specified gradient can be used
            si.GradientColor1            = Color.Orange;
            si.GradientColor2            = Color.Black;
            m_PopupFromCode.PopUpSideBar = si;
        }
Exemple #13
0
        public override void PaintButtonBackground(ButtonItem button, ItemPaintArgs pa, CompositeImage image)
		{
            bool isOnMenu = IsOnMenu(button, pa);
			if(isOnMenu)
				base.PaintButtonBackground(button,pa, image);
			else
				PaintButtonCheck(button,pa,image,button.DisplayRectangle);
		}
Exemple #14
0
 void buttonItem_Click(object sender, EventArgs e)
 {
     DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
     if (sender != null)
     {
         var s = (E_VIDEO_ANALYZE_TYPE)buttonItem.Tag;
         m_viewModel.AddAnalyse(s);
     }
 }
Exemple #15
0
 /// <summary>
 /// Paints state of the button, either hot, pressed or checked
 /// </summary>
 /// <param name="button"></param>
 /// <param name="pa"></param>
 /// <param name="image"></param>
 public override void PaintButtonMouseOver(ButtonItem button, ItemPaintArgs pa, CompositeImage image, Rectangle r)
 {
     if (IsOffice2003Rendering(button, pa))
     {
         base.PaintButtonMouseOver(button, pa, image, r);
         return;
     }
     //PaintState(button, pa, image, r, button.IsMouseDown);
 }
Exemple #16
0
        protected virtual IShapeDescriptor GetButtonShape(ButtonItem button, ItemPaintArgs pa)
        {
            IShapeDescriptor shape = Office2007ButtonItemPainter.GetButtonShape(button);

            if (pa.ContainerControl is ButtonX)
                shape = ((ButtonX)pa.ContainerControl).GetButtonShape();
            else if (pa.ContainerControl is NavigationBar)
                shape = ((NavigationBar)pa.ContainerControl).ButtonShape;
            return shape;
        }
Exemple #17
0
        StartControl _StartControl = null; // Start control displayed on startup

        #endregion Fields

        #region Constructors

        public MainForm()
        {
            InitializeComponent();

            // Prepare commands
            _Commands = new MetroBillCommands();

            _Commands.ToggleStartControl = new Command(components);
            _Commands.ToggleStartControl.Executed += new EventHandler(ToggleStartControlExecuted);

            // Initialize Client related commands
            _Commands.ClientCommands.New = new Command(components); // We pass in components from Form so the command gets disposed automatically when form is disposed
            _Commands.ClientCommands.New.Executed += NewClientExecuted;
            _Commands.ClientCommands.Cancel = new Command(components);
            _Commands.ClientCommands.Cancel.Executed += CancelClientExecuted;
            _Commands.ClientCommands.Save = new Command(components);
            _Commands.ClientCommands.Save.Executed += SaveClientExecuted;
            // Invoice related commands
            _Commands.InvoiceCommands.New = new Command(components); // We pass in components from Form so the command gets disposed automatically when form is disposed
            _Commands.InvoiceCommands.New.Executed += NewInvoiceExecuted;
            _Commands.InvoiceCommands.Cancel = new Command(components);
            _Commands.InvoiceCommands.Cancel.Executed += CancelInvoiceExecuted;
            _Commands.InvoiceCommands.Save = new Command(components);
            _Commands.InvoiceCommands.Save.Executed += SaveInvoiceExecuted;
            // General commands
            _Commands.ChangeMetroTheme = new Command(components, new EventHandler(ChangeMetroThemeExecuted));
            _Commands.NotImplemented = new Command(components, new EventHandler(NotImplementedExecuted));
            _Commands.DevComponents = new Command(components, new EventHandler(DevComponentsExecuted));
            _Commands.GettingStartedCommand = new Command(components, new EventHandler(GettingStartedExecuted));

            this.SuspendLayout();
            _StartControl = new StartControl();
            _StartControl.Commands = _Commands;
            this.Controls.Add(_StartControl);
            _StartControl.BringToFront();
            _StartControl.SlideSide = DevComponents.DotNetBar.Controls.eSlideSide.Right;
            _StartControl.Click += new EventHandler(StartControl_Click);
            this.ResumeLayout(false);

            // Assign commands to toolbar buttons
            newInvoiceButton.Command = _Commands.InvoiceCommands.New;
            newClientButton.Command = _Commands.ClientCommands.New;

            // Add metro color themes
            MetroColorGeneratorParameters[] metroThemes = MetroColorGeneratorParameters.GetAllPredefinedThemes();
            foreach (MetroColorGeneratorParameters mt in metroThemes)
            {
                ButtonItem theme = new ButtonItem(mt.ThemeName, mt.ThemeName);
                theme.Command = _Commands.ChangeMetroTheme;
                theme.CommandParameter = mt;
                colorThemeButton.SubItems.Add(theme);
            }

            AddSampleData();
        }
Exemple #18
0
        public CustomColorPicker()
        {
            buttonItemNoColor = new DevComponents.DotNetBar.ButtonItem();
            this.buttonItemNoColor.GlobalItem = false;
            this.buttonItemNoColor.Name       = "buttonItemNoColor";
            this.buttonItemNoColor.Text       = "NoColor";

            buttonItemNoColor.Click += new EventHandler(buttonItemNoColor_Click);
            base.PopupOpen          += new EventHandler(CustomColorPicker_PopupOpen);
            base.PopupClose         += new EventHandler(CustomColorPicker_PopupClose);
        }
Exemple #19
0
        void miSub_Click(object sender, EventArgs e)
        {
            DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;

            if (buttonItem.Tag is INavigateModule)
            {
                INavigateModule module = buttonItem.Tag as INavigateModule;
                object          addIn  = EAS.Objects.ClassProvider.GetObjectInstance(module.Assembly, module.Type);
                this.OpenModule(addIn);
            }
        }
 /// <summary>
 /// 加载子菜单
 /// </summary>
 /// <param name="menuId">父菜单Id</param>
 /// <param name="patientItem">父菜单控件</param>
 /// <param name="menuData">菜单数据</param>
 private void AddSubMenu(int menuId, BaseItem patientItem, List<BaseMenu> allmenus)
 {
     List<BaseMenu> mainMenu = allmenus.FindAll(x => x.PMenuId == menuId).OrderBy(x => x.SortId).ToList();
     foreach (BaseMenu menu in mainMenu)
     {
         AddToolMenu(menu);
         BaseItem bottonItem = new ButtonItem(menu.MenuId.ToString(), menu.Name);
         bottonItem.Tag = menu;
         AddSubMenu(menu.MenuId, bottonItem, allmenus);
         patientItem.SubItems.Add(bottonItem);
     }
 }
Exemple #21
0
 private static ButtonItem AddSubItem(string PathName, System.EventHandler btnItemClickEvent)
 {
     DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem();
     try
     {
         bi.Name   = PathName;                                   //包含字符串头的名称,防止用“非字母,下划线,”开头。
         bi.Text   = PathName.Substring(4, PathName.Length - 4); //去除"btn_"字符串头
         bi.Click += new EventHandler(btnItemClickEvent);        //添加事件
     }
     catch { }
     return(bi);
 }
Exemple #22
0
 /// <summary>
 /// 添加一个按钮
 /// </summary>
 /// <param name="SceneName">场景</param>
 /// <returns></returns>
 private ButtonItem AddSubItemScene(string SceneName)
 {
     DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem();
     try
     {
         bi.Name   = SceneName; //给按钮命名,需要加上btn,防止用“非字母,下划线,”开头。
         bi.Text   = SceneName.Substring(4, SceneName.Length - 4);
         bi.Click += new EventHandler(btnItemClickEvent);
     }
     catch { }
     return(bi);
 }
Exemple #23
0
 void buttonItem1_Click(object sender, EventArgs e)
 {
     DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
     if (sender != null)
     {
         var s = buttonItem.Tag as StatusInfoV3_1;
         if (s != null)
         {
             m_viewModel.DeleteAnalyse(s.AlgthmType);
         }
     }
 }
Exemple #24
0
 void buttonItem2_Click(object sender, EventArgs e)
 {
     DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
     if (sender != null)
     {
         var s = buttonItem.Tag as Tuple <E_VIDEO_ANALYZE_TYPE, uint>;
         if (s != null)
         {
             bool ret = m_viewModel.ReAnalyse(s.Item1, "", s.Item2);
         }
     }
 }
Exemple #25
0
        public frmMain()
        {
            InitializeComponent();
            this.Load += new EventHandler(
                    delegate(object sender, EventArgs e)
                    {
                        this.pbSvrUpdate.Visible = false;
                        this.stripSvrUpdate.Visible = false;
                        stripSvrUpdate.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Bold);

                        __SvrUpdateInterval = new System.Threading.Timer(new System.Threading.TimerCallback(delegate {
                            this.SvrUpdate();
                        }),null,15*1000,1000*60*60);
                        __SvrResetInterval = new System.Threading.Timer(new System.Threading.TimerCallback(delegate {
                            this.SvrReset();
                        }),null,1000,1000*60);
                        notifyIcon1.Visible = false;
                        //statusServer.ForeColor = Color.Red;
                        statusServer.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Bold);
                        statusServer.ForeColor = System.Drawing.SystemColors.HotTrack;
                        try
                        {
                            string SvrVersionFile = @"Version.Xml";
                            DirectoryInfo SvrPath = new DirectoryInfo(@".\");
                            if (new FileInfo(string.Format(@"{0}{1}", SvrPath.FullName, SvrVersionFile)).Exists)
                            {
                                XElement root = XElement.Load(new FileInfo(string.Format(@"{0}{1}", SvrPath.FullName, SvrVersionFile)).FullName);
                                XElement VersionStr = root.Element(@"SvrReset");
                                __resetHour = VersionStr.Value;
                            }
                        }
                        catch { }
                        statusInfo.Font = new System.Drawing.Font("Arial", 9F, System.Drawing.FontStyle.Bold);
                        statusInfo.ForeColor = Color.Red ;
                        notifyIcon1.Text = this.Text;
                        lstAsync.Groups.AddRange(new ListViewGroup[] { group1, group2 });
                            foreach (object itemValue in Enum.GetValues(DevComponents.DotNetBar.eStyle.Windows7Blue.GetType())) {
                                ButtonItem btnItem = new ButtonItem() { ButtonStyle = eButtonStyle.ImageAndText, Text = itemValue.ToString(), Tag=itemValue };
                                btnItem.Image = global::ASyncSDK.Office.Properties.Resources.Flag2_Green;
                                btnItem.Click += new EventHandler(
                                        delegate(object btnSender, EventArgs btnEvent) {
                                            this.styleManager1.ManagerStyle = (eStyle)(btnItem as ButtonItem).Tag;
                                        }
                                    );
                                this.btnSkin.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
                                btnItem
                            });
                        }
                            this.btnStart_Click(null, EventArgs.Empty);
                    }
                );
        }
Exemple #26
0
 public override void PaintButtonCheck(ButtonItem button, ItemPaintArgs pa, CompositeImage image, Rectangle r)
 {
     if (IsOffice2003Rendering(button, pa))
     {
         base.PaintButtonCheck(button, pa, image, r);
         return;
     }
     bool isOnMenu = IsOnMenu(button, pa);
     if (isOnMenu)
         base.PaintButtonCheck(button, pa, image, r);
     //else
     //    PaintState(button, pa, image, r, button.IsMouseDown);
 }
Exemple #27
0
 public void SetColumnsShow(DevComponents.DotNetBar.ButtonItem button)
 {
     foreach (DevComponents.DotNetBar.ButtonItem item in button.SubItems)
     {
         foreach (System.Windows.Forms.DataGridViewColumn cl in this.Columns)
         {
             if (cl.HeaderText.CompareTo(item.Text) == 0)
             {
                 cl.Visible = item.Checked;
             }
         }
     }
 }
		public static void Link(
			ButtonItem selectorButton,
			IEnumerable<Theme> themes,
			string selectedThemeName,
			IThemeSettingsContainer settingsContainer,
			Action<Theme, bool> themeSelected)
		{
			var themesExisted = themes.Any();
			selectorButton.ForeColor = Color.Black;
			selectorButton.ImagePosition = eImagePosition.Left;
			selectorButton.Text = String.Empty;
			selectorButton.AutoExpandOnClick = false;
			if (themesExisted)
			{
				var currentTheme = themes.FirstOrDefault(t => t.Name.Equals(selectedThemeName) || String.IsNullOrEmpty(selectedThemeName)) ?? themes.FirstOrDefault();
				if (currentTheme == null) return;
				selectorButton.Image = currentTheme.RibbonLogo;
				((RibbonBar)selectorButton.ContainerControl).Text = String.Format("{0}", currentTheme.Name);
				if (selectorButton.Tag == null)
				{
					selectorButton.Tag = new ThemeButtonInfo();
					selectorButton.Click += (button, e) =>
					{
						((ThemeButtonInfo)((ButtonItem)button).Tag).ClickHandler?.Invoke();
					};
				}
				((ThemeButtonInfo)selectorButton.Tag).CurrentTheme = currentTheme;
				((ThemeButtonInfo) selectorButton.Tag).ClickHandler = () =>
				{
					using (var form = new FormThemeSelector())
					{
						form.ApplyThemeForAllSlideTypes = settingsContainer.ApplyThemeForAllSlideTypes;
						form.LoadThemes(themes);
						form.Shown += (o, args) =>
						{
							form.SetSelectedTheme(((ThemeButtonInfo)selectorButton.Tag).CurrentTheme.Name);
						};
						if (form.ShowDialog() != DialogResult.OK) return;
						var selectedTheme = form.SelectedTheme;
						if (selectedTheme == null) return;
						selectorButton.Image = selectedTheme.RibbonLogo;
						((RibbonBar)selectorButton.ContainerControl).Text = String.Format("{0}", selectedTheme.Name);
						((ThemeButtonInfo)selectorButton.Tag).CurrentTheme = selectedTheme;
						themeSelected(selectedTheme, form.ApplyThemeForAllSlideTypes);
					}
				};
			}
			else
				selectorButton.Image = Resources.OutputDisabled;
		}
Exemple #29
0
 private static ButtonItem AddLayerSubItem(LayerInfo layerInfo, System.EventHandler btnItemClickEvent)
 {
     DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem();
     try
     {
         bi.Name             = layerInfo.LayerName;                                              //包含字符串头的名称,防止用“非字母,下划线,”开头。
         bi.Text             = layerInfo.LayerName.Substring(4, layerInfo.LayerName.Length - 4); //去除"btn_"字符串头
         bi.AutoCheckOnClick = true;                                                             //点击后自动选中或不选中
         bi.Checked          = layerInfo.isVisible;                                              //是否被选中代表着图层是否显示
         bi.Click           += new EventHandler(btnItemClickEvent);                              //添加事件
     }
     catch { }
     return(bi);
 }
		private void LoadDigitalCategories()
		{
			foreach (var category in ListManager.Instance.Categories)
			{
				var categoryButton = new ButtonItem();
				categoryButton.Image = category.Logo;
				categoryButton.Text = "<b>" + category.TooltipTitle + "</b><p>" + category.TooltipValue + "</p>";
				categoryButton.ImagePaddingHorizontal = 8;
				categoryButton.SubItemsExpandWidth = 14;
				categoryButton.Tag = category;
				categoryButton.Click += DigitalProductAdd;
				Controller.Instance.HomeDigitalProductAdd.SubItems.Add(categoryButton);
			}
		}
Exemple #31
0
 protected override PopupItem CreatePopupItem()
 {
     m_Button = CreateButtonItem();
     m_Button.GlobalItem = false;
     m_Button.Displayed = true;
     m_Button.ContainerControl = this;
     m_Button.ColorTable = eButtonColor.BlueWithBackground;
     m_Button.ButtonStyle = eButtonStyle.ImageAndText;
     m_Button._FitContainer = true;
     m_Button.Style = eDotNetBarStyle.Office2007;
     m_Button.SetOwner(this);
     m_Button.CheckedChanged += new EventHandler(OnCheckedChanged);
     return m_Button;
 }
		Bar CreateToolBarFromCodon(ToolbarCodon codon)
		{
			Bar bar = new Bar();
			bar.Stretch=true;
			bar.CanHide=false;
			bar.GrabHandleStyle=eGrabHandleStyle.StripeFlat;
			bar.WrapItemsDock=false;
			bar.BackColor = SystemColors.Control;

			ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));
			StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

			foreach (ToolbarItemCodon childCodon in codon.SubItems) 
			{
				ButtonItem button = new ButtonItem();
				
				if (childCodon.Icon != null) 
				{
					button.Image = ResourceService.GetBitmap(childCodon.Icon);
				}
				if (childCodon.Text != null) 
				{
					button.Text = stringParserService.Parse(childCodon.Text);
					button.ButtonStyle = eButtonStyle.ImageAndText;
				}
				
				if (childCodon.ToolTip != null) 
				{
					if (childCodon.BeginGroup == "true") 
					{
						button.BeginGroup = true;
					} 
					else 
					{
						button.Tooltip = stringParserService.Parse(childCodon.ToolTip);
					}
				}
				button.Enabled     = childCodon.Enabled;
				if (childCodon.Class != null) 
				{
					ClickWrapper clickHandler = new ClickWrapper((ICommand)childCodon.AddIn.CreateObject(childCodon.Class));
					button.Click += new EventHandler(clickHandler.Run);
				}
				bar.Items.Add(button);
			}
			return bar;
		}
Exemple #33
0
 private void buttonItem1_Click(object sender, EventArgs e)
 {
     try
     {
         DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
         if (sender != null)
         {
             var s = buttonItem.Tag as StatusInfoV3_1;
             if (s != null)
             {
                 if ((Program.PRODUCT_TYPE & Framework.Environment.E_PRODUCT_TYPE.PuDong_PRODUCT) > 0)
                 {
                     FormEditRealtimeAnalyseParamNoDIO f = new FormEditRealtimeAnalyseParamNoDIO(m_viewModel.CurrentTask.TaskId, s.AlgthmType, s.AnalyseParam);
                     if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                     {
                         //m_viewModel.CurrentTask.AnalyseParam = f.Task.AnalyseParam;
                         m_viewModel.PauseTask();
                         bool ret = m_viewModel.ReAnalyse(f.AlgthmType, f.AnalyseParam);
                         if (ret)
                         {
                         }
                         m_viewModel.ResumeTask();
                     }
                 }
                 else
                 {
                     FormEditRealtimeAnalyseParam f = new FormEditRealtimeAnalyseParam(m_viewModel.CurrentTask, s.AlgthmType, s.AnalyseParam);
                     if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                     {
                         //m_viewModel.CurrentTask.AnalyseParam = f.Task.AnalyseParam;
                         m_viewModel.PauseTask();
                         bool ret = m_viewModel.ReAnalyse(f.AlgthmType, f.AnalyseParam);
                         if (ret)
                         {
                         }
                         m_viewModel.ResumeTask();
                     }
                 }
             }
         }
     }
     catch (SDKCallException ex)
     {
         MessageBoxEx.Show("当前状态无法进行重新分析,[" + ex.ErrorCode + "]" + ex.Message, Framework.Environment.PROGRAM_NAME);
     }
 }
Exemple #34
0
        void buttonItem_ExpandChange(object sender, EventArgs e)
        {
            DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
            if (buttonItem != null)
            {
                if (buttonItem.Expanded)
                {
                    foreach (var item in list)
                    {
                        item.Expanded = false;
                    }
                    list.Clear();

                    list.Add(buttonItem);
                }
            }
        }
Exemple #35
0
 /// <summary>
 /// 添加图层管理子按钮
 /// </summary>
 /// <param name="LayerInfoList">图层信息list</param>
 /// <param name="layerBtn">图层管理主按钮</param>
 /// <param name="btnItemClickedEvent">按钮事件</param>
 public static void AddLayerNameButons(List <LayerInfo> LayerInfoList, DevComponents.DotNetBar.ButtonItem layerBtn, System.EventHandler btnItemClickedEvent)
 {
     try
     {
         //如果图层为空
         if (LayerInfoList.Count == 0)
         {
             return;
         }
         foreach (LayerInfo layerInfo in LayerInfoList)
         {
             ButtonItem bi = AddLayerSubItem(layerInfo, btnItemClickedEvent); //取得按钮
             layerBtn.SubItems.Add(bi);                                       //添加按钮
         }
     }
     catch { }
 }
Exemple #36
0
        /// <summary>
        /// 初始化右键菜单
        /// </summary>
        protected virtual void InitMenuStrip()
        {
            // 初始化菜单参数                        
            contextMenyBar.Items.Add(editMenu);
            contextMenyBar.Items.Add(canvasMenu);
            contextMenyBar.Style = eDotNetBarStyle.Office2003;

            // 初始化编辑菜单
            ButtonItem bEditRemark = new ButtonItem("bEditRemark", "编辑注释");
            bEditRemark.Click += new EventHandler(EditRemark);
            editMenu.SubItems.Add(bEditRemark);

            ButtonItem bCutGraphElement = new ButtonItem("bCutGraphElement", "剪切 (Ctrl + P)");
            bCutGraphElement.Click += new EventHandler(CutGraphElement);
            editMenu.SubItems.Add(bCutGraphElement);

            ButtonItem bCopyGraphElement = new ButtonItem("bCopyGraphElement", "复制 (Ctrl + C)");
            bCopyGraphElement.Click += new EventHandler(CopyGraphElement);
            editMenu.SubItems.Add(bCopyGraphElement);

            ButtonItem bCAndCConditionNode = new ButtonItem("bCAndCConditionNode", "创建并连接 条件结点 (2)");
            bCAndCConditionNode.Click += new EventHandler(CAndCConditionNode);
            editMenu.SubItems.Add(bCAndCConditionNode);

            ButtonItem bCAndCActionNode = new ButtonItem("bCAndCActionNode", "创建并连接 动作结点 (3)");
            bCAndCActionNode.Click += new EventHandler(CAndCActionNode);
            editMenu.SubItems.Add(bCAndCActionNode);

            // 初始化绘图板菜单
            ButtonItem bRefreshCanvas = new ButtonItem("bRefreshCancas", "刷新(F5)");
            bRefreshCanvas.Click += new EventHandler(RefreshCanvas);
            canvasMenu.SubItems.Add(bRefreshCanvas);

            ButtonItem bResetGraphElementID = new ButtonItem("bResetGraphElementID", "重新分配图元ID");
            bResetGraphElementID.Click += new EventHandler(ResetGraphElementID);
            canvasMenu.SubItems.Add(bResetGraphElementID);

            ButtonItem bPasteGraphElement = new ButtonItem("bPasteGraphElement", "粘贴 (Ctrl + V)");
            bPasteGraphElement.Click += new EventHandler(PasteGraphElement);
            canvasMenu.SubItems.Add(bPasteGraphElement);

            ButtonItem bCreateEventNode = new ButtonItem("bCreateEventNode", "创建事件结点 (1)");
            bCreateEventNode.BeginGroup = true;
            bCreateEventNode.Click += new EventHandler(CreateEventNode);
            canvasMenu.SubItems.Add(bCreateEventNode);
        }
Exemple #37
0
        private void TestAddButton(NavigationPane navPane, string t)
        {
            ButtonItem b = new DevComponents.DotNetBar.ButtonItem();

            navPane.Items.Add(b);

            b.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
            //b.Image = ((System.Drawing.Image)(resources.GetObject("buttonItem2.Image")));
            b.ImageIndex = 1;
            //b.Name = "b";
            //	b.OptionGroup = "navBar";
            b.Style = DevComponents.DotNetBar.eDotNetBarStyle.Office2003;
            b.Text  = t;
            //	b.Tooltip = t;

            MakePanelToGoWithButton(navPane, b, null);
        }
Exemple #38
0
		public static Color GetTextColor(ButtonItem button, ItemPaintArgs pa)
		{
			Color textColor=SystemColors.ControlText;

			if(!ButtonItemPainter.IsItemEnabled(button, pa))
			{
				if(!pa.Colors.ItemDisabledText.IsEmpty)
					textColor=pa.Colors.ItemDisabledText;
				else
					textColor=SystemColors.ControlDark;
			}
			else if(button.IsMouseDown && !pa.Colors.ItemPressedText.IsEmpty)
			{
				textColor=pa.Colors.ItemPressedText;
			}
			else if(button.IsMouseOver)
			{
				if(!button.HotForeColor.IsEmpty)
					textColor=button.HotForeColor;
				else
					textColor=pa.Colors.ItemHotText;
			}
			else if(button.Expanded && !pa.Colors.ItemExpandedText.IsEmpty)
			{
				textColor=pa.Colors.ItemExpandedText;
			}
			else if(button.Checked && !pa.Colors.ItemCheckedText.IsEmpty)
			{
				textColor=pa.Colors.ItemCheckedText;
			}
			else
			{
				if(!button.ForeColor.IsEmpty)
					textColor=button.ForeColor;
				else
				{
					if(button.IsThemed && button.IsOnMenuBar && pa.Colors.ItemText==SystemColors.ControlText)
						textColor=SystemColors.MenuText;
					else
						textColor=pa.Colors.ItemText;
				}
			}

			return textColor;
		}
Exemple #39
0
        /// <summary>
        /// 初始化菜单
        /// </summary>
        void InitMenu(DevComponents.DotNetBar.ButtonItem item, INavigateGroup m_Group)
        {
            IList <INavigateGroup> m_GroupList = navigationProxy.GetGroupList(m_Group == null ? string.Empty : m_Group.ID);
            int mask = (int)GroupType.Windows;

            //1.处理下级组。
            foreach (INavigateGroup var in m_GroupList)
            {
                if ((var.Attributes & mask) == mask)
                {
                    DevComponents.DotNetBar.ButtonItem miMan = new DevComponents.DotNetBar.ButtonItem();
                    miMan.Text          = var.Name;
                    miMan.Image         = imageList1.Images[0];
                    miMan.ImagePosition = eImagePosition.Left;
                    miMan.ButtonStyle   = eButtonStyle.ImageAndText;
                    miMan.Tag           = var.Attributes;

                    if (item == null)
                    {
                        this.barMenu.Items.Add(miMan);
                    }
                    else
                    {
                        item.SubItems.Add(miMan);
                    }

                    this.InitMenu(miMan, var);
                }
            }

            //2.增加功能插件
            if (m_Group != null)  //功能节点
            {
                IList <INavigateModule> m_moduleList = navigationProxy.GetModuleList(m_Group.ID);
                foreach (INavigateModule module in m_moduleList)
                {
                    DevComponents.DotNetBar.ButtonItem miSub = new DevComponents.DotNetBar.ButtonItem();
                    miSub.Image  = imageList1.Images[1];
                    miSub.Text   = module.Name;
                    miSub.Tag    = module;
                    miSub.Click += new EventHandler(miSub_Click);
                    item.SubItems.Add(miSub);
                }
            }
        }
Exemple #40
0
 private void seleccionarEscaner(object sender, EventArgs e)
 {
     try
     {
         DevComponents.DotNetBar.ButtonItem button = sender as DevComponents.DotNetBar.ButtonItem;
         for (int i = 0; i < devices.Count; i++)
         {
             if (devices[i].Split('|')[0] == button.Text)
             {
                 escanerActual = devices[i].Split('|')[1];
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 /// <summary>
 /// 添加工具栏菜单
 /// </summary>
 /// <param name="menu">需要加载的菜单对象</param>
 private void AddToolMenu(BaseMenu menu)
 {
     if (menu.MenuToolBar == 1)
     {
         ButtonItem toolbarItem = new ButtonItem(menu.MenuId.ToString(), menu.Name);
         toolbarItem.ImageFixedSize = new Size(30, 30);
         try
         {
             toolbarItem.Image = Image.FromFile(menu.Image);
         }
         catch {
             toolbarItem.Image = Image.FromFile(AppGlobal.AppRootPath + @"images\defaulttool.png");
         }
         toolbarItem.ImagePosition = eImagePosition.Top;
         toolbarItem.Tag = menu;
         this.barMainToolBar.Items.Add(toolbarItem);
     }
 }
		public IEnumerable<ButtonItem> GetPartToggleButtons()
		{
			if (CalendarToggles.Any() || !CalendarParts.Any())
				return CalendarToggles;
			var selectedCalendarPart = SelectedCalendarPart;
			foreach (var partControl in CalendarParts)
			{
				var button = new ButtonItem();
				button.Text = partControl.PartData.Name;
				button.Tag = partControl;
				button.Enabled = partControl.PartData.Enabled;
				button.Checked = partControl == selectedCalendarPart;
				button.Click += OnCalendarPartClicked;
				button.CheckedChanged += OnCalendarPartSelected;
				CalendarToggles.Add(button);
			}
			return CalendarToggles;
		}
Exemple #43
0
        /// <summary>
        /// 添加飞行子按钮
        /// </summary>
        /// <param name="FlyPathList">飞行路径list</param>
        /// <param name="FlyButton">主按钮</param>
        /// <param name="btnItemClickEvent">按钮事件</param>
        public static void AddFlyPathButton(List <string> FlyPathList, DevComponents.DotNetBar.ButtonItem FlyButton, System.EventHandler btnItemClickEvent)
        {
            try
            {
                //如果路径为空
                if (FlyPathList.Count == 0)
                {
                    return;
                }

                foreach (string pathName in FlyPathList)
                {
                    ButtonItem bi = AddSubItem(pathName, btnItemClickEvent); //新建按钮
                    FlyButton.SubItems.Add(bi);                              //添加为按钮
                }
            }
            catch { }
        }
Exemple #44
0
        private void LoadHistory()
        {
            string strfile = Path.Combine(Application.StartupPath, "DesignerSceneEditor.history");
            string strHistory = FileFolderHelper.FileToString(strfile);
            if (strHistory.Length == 0) return;

            string[] historys = strHistory.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string history in historys)
            {
                DevComponents.DotNetBar.ButtonItem newitem = new DevComponents.DotNetBar.ButtonItem();
                newitem.ImagePaddingHorizontal = 8;
                newitem.Name = history;
                newitem.Text = history;
                newitem.Click += new System.EventHandler(this.historyItem_Click);

                this.buttonOpen.SubItems.Add(newitem);
            }
        }
Exemple #45
0
        protected virtual void AddClick(object sender, EventArgs e)
        {
            string editFormText = string.Empty;

            if (EditBaseForm != null)
            {
                if (sender is DevComponents.DotNetBar.ButtonItem)
                {
                    DevComponents.DotNetBar.ButtonItem button = sender as DevComponents.DotNetBar.ButtonItem;
                    editFormText = button.Text;
                }
                EditBaseForm editBaseForm = Activator.CreateInstance(EditBaseForm) as EditBaseForm;
                editBaseForm.Icon          = Xl.UIComponent.Properties.Resources.Icon;
                editBaseForm.IsAdd         = true;
                editBaseForm.Text          = editFormText;
                editBaseForm.StartPosition = FormStartPosition.CenterParent;
                editBaseForm.ShowDialog();
            }
        }
Exemple #46
0
        private void CreatePopupMenu()
        {
            DevComponents.DotNetBar.ButtonItem item;

            m_PopupFromCode = new DevComponents.DotNetBar.ButtonItem();

            // Create items
            item            = new DevComponents.DotNetBar.ButtonItem("bInsertBreakpoint");
            item.Text       = "企业&仓库";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item      = new DevComponents.DotNetBar.ButtonItem("bNewBreakpoint");
            item.Text = "数据接口";
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bRunToCursor");
            item.Text       = "设备管理";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("bAddTask");
            item.Text       = "报警设置";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);


            item            = new DevComponents.DotNetBar.ButtonItem("display");
            item.Text       = "显示";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);


            item            = new DevComponents.DotNetBar.ButtonItem("system");
            item.Text       = "系统";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);

            item            = new DevComponents.DotNetBar.ButtonItem("advance");
            item.Text       = "高级";
            item.BeginGroup = true;
            m_PopupFromCode.SubItems.Add(item);
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context != null
                && context.Instance != null
                && provider != null)
            {
                edSvc = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
                string stringValue = null;
                if (value != null) stringValue = value.ToString();

                if (edSvc != null)
                {
                    ItemPanel itemPanel = new ItemPanel();
                    itemPanel.Font = Symbols.FontAwesome;
                    itemPanel.MultiLine = true;
                    itemPanel.AutoScroll = true;
                    itemPanel.LayoutOrientation = eOrientation.Horizontal;
                    itemPanel.SelectedIndexChanged += new EventHandler(ItemPanelSelectedIndexChanged);
#if !TRIAL
                    itemPanel.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
#endif

                    Dictionary<int, bool> supportedChars = GetFontSupportedChars(itemPanel.Font);
                    for (int i = 0xf000; i <= 0xf200; i++)
                    {
                        if (!supportedChars.ContainsKey(i)) continue;
                        ButtonItem button = new ButtonItem();
                        button.AutoCheckOnClick = true;
                        button.OptionGroup = "sym";
                        button.Text = char.ConvertFromUtf32(i);
                        button.Tooltip = string.Format("{0:x}", i);
                        if (button.Text == stringValue) button.Checked = true;
                        itemPanel.Items.Add(button);
                    }
                    edSvc.DropDownControl(itemPanel);
                    itemPanel.SelectedIndexChanged -= new EventHandler(ItemPanelSelectedIndexChanged);
                    if (itemPanel.SelectedItem != null)
                        return itemPanel.SelectedItem.Text;
                }
            }

            return value;
        }
Exemple #48
0
        protected virtual void EditClick(object sender, EventArgs e)
        {
            string editFormText = string.Empty;

            if (EditBaseForm != null)
            {
                if (sender is DevComponents.DotNetBar.ButtonItem)
                {
                    DevComponents.DotNetBar.ButtonItem button = sender as DevComponents.DotNetBar.ButtonItem;
                    editFormText = button.Text;
                }
                if (Id <= 0)
                {
                    MessageBoxEx.Show("请选择一条数据");
                    return;
                }
                EditBaseForm editBaseForm = Activator.CreateInstance(EditBaseForm) as EditBaseForm;
                editBaseForm.IsAdd = false;
                editBaseForm.Id    = Id;
                editBaseForm.Text  = editFormText;
                editBaseForm.ShowDialog();
            }
        }
        void btnAddTileset_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dialog = new OpenFileDialog())
            {
                dialog.Title = "Add Tileset";
                dialog.Filter = "Images|*.png;*.jpg;*.jpeg;*.gif;*.bmp";

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        foreach (WorldTileset t in world.Tilesets)
                        {
                            if (dialog.FileName == t.Filename)
                            {
                                MessageBox.Show("The following tileset already exists\n\n" + dialog.FileName, 
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                return;
                            }
                        }

                        world.AddTileset(new WorldTileset(dialog.FileName, world.CanvasGraphicsDevice));

                        ButtonItem item = new ButtonItem(String.Empty, dialog.SafeFileName);

                        tilesetsList.Items.Add(item);
                        tilesetsList.SelectedItem = item;
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show(exception.Message, "Error Loading Tileset", 
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Exemple #50
0
 void buttonItem3_Click(object sender, EventArgs e)
 {
     try
     {
         DevComponents.DotNetBar.ButtonItem buttonItem = sender as DevComponents.DotNetBar.ButtonItem;
         if (sender != null)
         {
             var s = buttonItem.Tag as StatusInfoV3_1;
             if (s != null)
             {
                 bool ret = m_viewModel.ReAnalyse(s.AlgthmType, "");
                 if (ret)
                 {
                     //m_isSplitTimeChanged = false;
                     //this.highlighter1.SetHighlightColor(this.comboBoxExSplitTime, DevComponents.DotNetBar.Validator.eHighlightColor.None);
                 }
             }
         }
     }
     catch (SDKCallException ex)
     {
         MessageBoxEx.Show("当前状态无法进行重新分析,[" + ex.ErrorCode + "]" + ex.Message, Framework.Environment.PROGRAM_NAME);
     }
 }
Exemple #51
0
        protected override void PaintState(ButtonItem button, ItemPaintArgs pa, CompositeImage image, Rectangle r, bool isMouseDown)
        {
            if (r.IsEmpty || !IsItemEnabled(button, pa) || r.Width == 0 || r.Height == 0)
                return;

            RibbonTabItem tab = button as RibbonTabItem;
            if (tab == null || IsOnMenu(button, pa))
            {
                base.PaintState(button, pa, image, r, isMouseDown);
                return;
            }

            bool isOnMenu = pa.IsOnMenu;
            Office2007RibbonTabItemColorTable tabColorTable = GetColorTable(tab);
            if (tabColorTable == null)
                return;
            bool ribbonExpanded = pa.ControlExpanded;

            Office2007RibbonTabItemStateColorTable stateColors = GetStateColorTable(tabColorTable, tab, ribbonExpanded);

            if (stateColors == null)
                return;

            Graphics g = pa.Graphics;
            int cornerSize = tabColorTable.CornerSize;
            Region oldClip = g.Clip;
            try
            {
                Rectangle rClip = r;
                rClip.Inflate(1, 0);
                g.SetClip(rClip, CombineMode.Replace);

                if (stateColors != null)
                {
                    eDotNetBarStyle effectiveStyle = button.EffectiveStyle;
                    using (GraphicsPath path = GetTabPath(r, cornerSize, true, effectiveStyle))
                    {
                        DisplayHelp.FillPath(g, path, stateColors.Background);
                        DisplayHelp.DrawGradientPathBorder(g, path, stateColors.OuterBorder, 1);
                    }
                    if (effectiveStyle != eDotNetBarStyle.Metro && tab.Checked && ribbonExpanded && tab.RenderTabState /*|| tab.IsMouseOver*/)
                    {
                        SmoothingMode sm = g.SmoothingMode;
                        g.SmoothingMode = SmoothingMode.Default;

                        if (this.ColorTable.RibbonControl.TabsBackground.Start.GetBrightness() > .5 && !stateColors.OuterBorder.IsEmpty)
                        {
                            using (GraphicsPath path = new GraphicsPath())
                            {
                                path.AddRectangle(new Rectangle(r.Right - 1, r.Y + cornerSize + 1, 1, r.Height - cornerSize - 3));
                                DisplayHelp.FillPath(g, path, Color.FromArgb(96, stateColors.OuterBorder.Start), Color.FromArgb(32, stateColors.OuterBorder.End), 90);
                            }
                            using (GraphicsPath path = new GraphicsPath())
                            {
                                path.AddRectangle(new Rectangle(r.X + 1, r.Y + cornerSize + 1, 1, r.Height - cornerSize - 3));
                                DisplayHelp.FillPath(g, path, Color.FromArgb(32, stateColors.OuterBorder.Start), Color.FromArgb(8, stateColors.OuterBorder.End), 90);
                            }
                        }
                        g.SmoothingMode = sm;
                    }

                    Rectangle r1 = r;
                    r1.Inflate(-1, 0);
                    r1.Height--;
                    r1.Y++;
                    using (GraphicsPath path = GetTabPath(r1, cornerSize, true, effectiveStyle))
                    {
                        DisplayHelp.DrawGradientPathBorder(g, path, stateColors.InnerBorder, 1);
                    }

                    if (tab.Checked && ribbonExpanded && tab.RenderTabState)
                    {
                        using (SolidBrush brush = new SolidBrush(stateColors.InnerBorder.Start))
                        {
                            SmoothingMode sm = g.SmoothingMode;
                            g.SmoothingMode = SmoothingMode.None;
                            g.FillRectangle(brush, new Rectangle(r1.X + cornerSize, r1.Y + 1, r1.Width - cornerSize * 2, 2));
                            g.SmoothingMode = sm;
                        }
                    }

                    float topSplit = .6f;
                    float bottomSplit = .4f;

                    Rectangle fillRectangle = r;
                    Rectangle backRect = new Rectangle(fillRectangle.X, fillRectangle.Y + (int)(fillRectangle.Height * topSplit), fillRectangle.Width, (int)(fillRectangle.Height * bottomSplit));

                    if (!stateColors.BackgroundHighlight.IsEmpty)
                    {
                        Rectangle ellipse = new Rectangle(backRect.X, backRect.Y, fillRectangle.Width, fillRectangle.Height);
                        GraphicsPath path = new GraphicsPath();
                        path.AddEllipse(ellipse);
                        PathGradientBrush brush = new PathGradientBrush(path);
                        brush.CenterColor = stateColors.BackgroundHighlight.Start;
                        brush.SurroundColors = new Color[] { stateColors.BackgroundHighlight.End };
                        brush.CenterPoint = new PointF(ellipse.X + ellipse.Width / 2, fillRectangle.Bottom + 2);
                        Blend blend = new Blend();
                        blend.Factors = new float[] { 0f, .8f, 1f };
                        blend.Positions = new float[] { .0f, .55f, 1f };
                        brush.Blend = blend;
                        g.FillRectangle(brush, backRect);
                        brush.Dispose();
                        path.Dispose();
                    }
                }

                if (tab.ReducedSize && !tab.Checked && !tab.IsMouseOver && tabColorTable != null && tabColorTable.Selected != null)
                {
                    Color c = this.ColorTable.RibbonControl.OuterBorder.Start;
                    if (!c.IsEmpty)
                        DisplayHelp.DrawGradientLine(g, new Point(r.Right - 1, r.Y), new Point(r.Right - 1, r.Bottom - 1),
                            Color.Transparent, c, 90, 1, new float[] { 0, .8f, 1f }, new float[] { 0, .50f, 1f });
                }

                g.Clip = oldClip;
            }
            finally
            {
                if (oldClip != null) oldClip.Dispose();
            }
        }
Exemple #52
0
        public override void PaintButtonText(ButtonItem button, ItemPaintArgs pa, Color textColor, CompositeImage image)
        {
            eDotNetBarStyle effectiveStyle = button.EffectiveStyle;
            if (!((effectiveStyle == eDotNetBarStyle.Office2010 || effectiveStyle == eDotNetBarStyle.Metro) && pa.GlassEnabled))
            {
                base.PaintButtonText(button, pa, textColor, image);
                return;
            }

            Rectangle r = GetTextRectangle(button, pa, eTextFormat.HorizontalCenter | eTextFormat.VerticalCenter, image);
            //r.Offset(0, 3);
            //r.Height -= 2;
            ThemeTextFormat textFormat = ThemeTextFormat.Center | ThemeTextFormat.VCenter | ThemeTextFormat.HidePrefix | ThemeTextFormat.SingleLine;
            bool renderGlow = true;
            //if (effectiveStyle == eDotNetBarStyle.Office2010 && StyleManager.Style == eStyle.Office2010Black)
            //    renderGlow = false;
            Office2007RibbonControlPainter.PaintTextOnGlass(pa.Graphics, button.Text, pa.Font, r, textFormat, textColor, true, renderGlow, 10);
        }
Exemple #53
0
 public override eTextFormat GetStringFormat(ButtonItem button, ItemPaintArgs pa, CompositeImage image)
 {
     eTextFormat sf = base.GetStringFormat(button, pa, image);
     sf &= ~(sf & eTextFormat.EndEllipsis);
     return sf;
 }
Exemple #54
0
        protected override Color GetTextColor(ButtonItem button, ItemPaintArgs pa)
        {
            if (!IsItemEnabled(button, pa) || !(button is RibbonTabItem))
                return base.GetTextColor(button, pa);

            RibbonTabItem tab = button as RibbonTabItem;

            Color textColor = Color.Empty;

            Office2007RibbonTabItemStateColorTable ct = GetStateColorTable(GetColorTable(tab), tab, pa.ControlExpanded);

            if (ct != null)
            {
                if (pa.GlassEnabled && !ct.GlassText.IsEmpty)
                    return ct.GlassText;
                textColor = ct.Text;
            }

            if (textColor.IsEmpty)
                return base.GetTextColor(button, pa);

            return textColor;
        }
Exemple #55
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
     this.bar1 = new DevComponents.DotNetBar.Bar();
     this.buttonBlackScheme       = new DevComponents.DotNetBar.ButtonItem();
     this.buttonSilverScheme      = new DevComponents.DotNetBar.ButtonItem();
     this.buttonBlueScheme        = new DevComponents.DotNetBar.ButtonItem();
     this.colorPickerCustomScheme = new DevComponents.DotNetBar.ColorPickerDropDown();
     this.groupPanel1             = new DevComponents.DotNetBar.Controls.GroupPanel();
     this.textBoxX5   = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.comboBoxEx1 = new DevComponents.DotNetBar.Controls.ComboBoxEx();
     this.textBoxX4   = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.textBoxX3   = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.textBoxX2   = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.textBoxX1   = new DevComponents.DotNetBar.Controls.TextBoxX();
     this.buttonX1    = new DevComponents.DotNetBar.ButtonX();
     ((System.ComponentModel.ISupportInitialize)(this.bar1)).BeginInit();
     this.groupPanel1.SuspendLayout();
     this.SuspendLayout();
     //
     // bar1
     //
     this.bar1.BarType = DevComponents.DotNetBar.eBarType.StatusBar;
     this.bar1.Dock    = System.Windows.Forms.DockStyle.Top;
     this.bar1.Items.AddRange(new DevComponents.DotNetBar.BaseItem[] {
         this.buttonBlackScheme,
         this.buttonSilverScheme,
         this.buttonBlueScheme,
         this.colorPickerCustomScheme
     });
     this.bar1.Name         = "bar1";
     this.bar1.RoundCorners = false;
     this.bar1.Size         = new System.Drawing.Size(338, 25);
     this.bar1.Stretch      = true;
     this.bar1.Style        = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
     this.bar1.TabIndex     = 0;
     this.bar1.TabStop      = false;
     this.bar1.Text         = "bar1";
     //
     // buttonBlackScheme
     //
     this.buttonBlackScheme.Name   = "buttonBlackScheme";
     this.buttonBlackScheme.Text   = "Black";
     this.buttonBlackScheme.Click += new System.EventHandler(this.buttonBlackScheme_Click);
     //
     // buttonSilverScheme
     //
     this.buttonSilverScheme.Name   = "buttonSilverScheme";
     this.buttonSilverScheme.Text   = "Silver";
     this.buttonSilverScheme.Click += new System.EventHandler(this.buttonSilverScheme_Click);
     //
     // buttonBlueScheme
     //
     this.buttonBlueScheme.Name   = "buttonBlueScheme";
     this.buttonBlueScheme.Text   = "Blue";
     this.buttonBlueScheme.Click += new System.EventHandler(this.buttonBlueScheme_Click);
     //
     // colorPickerCustomScheme
     //
     this.colorPickerCustomScheme.AutoExpandOnClick = true;
     this.colorPickerCustomScheme.Image             = ((System.Drawing.Bitmap)(resources.GetObject("colorPickerCustomScheme.Image")));
     this.colorPickerCustomScheme.Name = "colorPickerCustomScheme";
     this.colorPickerCustomScheme.Text = "Custom";
     this.colorPickerCustomScheme.SelectedColorChanged += new System.EventHandler(this.colorPickerCustomScheme_SelectedColorChanged);
     this.colorPickerCustomScheme.ExpandChange         += new System.EventHandler(this.colorPickerCustomScheme_ExpandChange);
     this.colorPickerCustomScheme.ColorPreview         += new DevComponents.DotNetBar.ColorPreviewEventHandler(this.colorPickerCustomScheme_ColorPreview);
     //
     // groupPanel1
     //
     this.groupPanel1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                 | System.Windows.Forms.AnchorStyles.Left)
                                | System.Windows.Forms.AnchorStyles.Right);
     this.groupPanel1.AutoScroll       = true;
     this.groupPanel1.CanvasColor      = System.Drawing.SystemColors.Control;
     this.groupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
     this.groupPanel1.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.textBoxX5,
         this.comboBoxEx1,
         this.textBoxX4,
         this.textBoxX3,
         this.textBoxX2,
         this.textBoxX1
     });
     this.groupPanel1.Location = new System.Drawing.Point(8, 40);
     this.groupPanel1.Name     = "groupPanel1";
     this.groupPanel1.Size     = new System.Drawing.Size(322, 199);
     //
     // groupPanel1.Style
     //
     this.groupPanel1.Style.BackColor2SchemePart   = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
     this.groupPanel1.Style.BackColorGradientAngle = 90;
     this.groupPanel1.Style.BackColorSchemePart    = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
     this.groupPanel1.Style.BorderBottom           = DevComponents.DotNetBar.eStyleBorderType.Solid;
     this.groupPanel1.Style.BorderBottomWidth      = 1;
     this.groupPanel1.Style.BorderColorSchemePart  = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
     this.groupPanel1.Style.BorderLeft             = DevComponents.DotNetBar.eStyleBorderType.Solid;
     this.groupPanel1.Style.BorderLeftWidth        = 1;
     this.groupPanel1.Style.BorderRight            = DevComponents.DotNetBar.eStyleBorderType.Solid;
     this.groupPanel1.Style.BorderRightWidth       = 1;
     this.groupPanel1.Style.BorderTop           = DevComponents.DotNetBar.eStyleBorderType.Solid;
     this.groupPanel1.Style.BorderTopWidth      = 1;
     this.groupPanel1.Style.CornerDiameter      = 4;
     this.groupPanel1.Style.CornerType          = DevComponents.DotNetBar.eCornerType.Rounded;
     this.groupPanel1.Style.Font                = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.groupPanel1.Style.TextAlignment       = DevComponents.DotNetBar.eStyleTextAlignment.Center;
     this.groupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
     this.groupPanel1.Style.TextLineAlignment   = DevComponents.DotNetBar.eStyleTextAlignment.Near;
     this.groupPanel1.TabIndex = 1;
     this.groupPanel1.Text     = "Customer Data";
     //
     // textBoxX5
     //
     this.textBoxX5.AutoSize = false;
     //
     // textBoxX5.Border
     //
     this.textBoxX5.Border.Class = "TextBoxBorder";
     this.textBoxX5.Location     = new System.Drawing.Point(16, 168);
     this.textBoxX5.Multiline    = true;
     this.textBoxX5.Name         = "textBoxX5";
     this.textBoxX5.ScrollBars   = System.Windows.Forms.ScrollBars.Vertical;
     this.textBoxX5.Size         = new System.Drawing.Size(264, 104);
     this.textBoxX5.TabIndex     = 5;
     //
     // comboBoxEx1
     //
     this.comboBoxEx1.DisplayMember = "Text";
     this.comboBoxEx1.DrawMode      = System.Windows.Forms.DrawMode.OwnerDrawFixed;
     this.comboBoxEx1.Location      = new System.Drawing.Point(16, 104);
     this.comboBoxEx1.Name          = "comboBoxEx1";
     this.comboBoxEx1.Size          = new System.Drawing.Size(264, 21);
     this.comboBoxEx1.TabIndex      = 4;
     this.comboBoxEx1.WatermarkText = "Choose State";
     //
     // textBoxX4
     //
     this.textBoxX4.AutoSize = false;
     //
     // textBoxX4.Border
     //
     this.textBoxX4.Border.Class  = "TextBoxBorder";
     this.textBoxX4.Location      = new System.Drawing.Point(16, 136);
     this.textBoxX4.Name          = "textBoxX4";
     this.textBoxX4.Size          = new System.Drawing.Size(264, 20);
     this.textBoxX4.TabIndex      = 3;
     this.textBoxX4.WatermarkText = "Post code";
     //
     // textBoxX3
     //
     this.textBoxX3.AutoSize = false;
     //
     // textBoxX3.Border
     //
     this.textBoxX3.Border.Class  = "TextBoxBorder";
     this.textBoxX3.Location      = new System.Drawing.Point(16, 72);
     this.textBoxX3.Name          = "textBoxX3";
     this.textBoxX3.Size          = new System.Drawing.Size(264, 20);
     this.textBoxX3.TabIndex      = 2;
     this.textBoxX3.WatermarkText = "Address";
     //
     // textBoxX2
     //
     this.textBoxX2.AutoSize = false;
     //
     // textBoxX2.Border
     //
     this.textBoxX2.Border.Class  = "TextBoxBorder";
     this.textBoxX2.Location      = new System.Drawing.Point(16, 40);
     this.textBoxX2.Name          = "textBoxX2";
     this.textBoxX2.Size          = new System.Drawing.Size(264, 20);
     this.textBoxX2.TabIndex      = 1;
     this.textBoxX2.WatermarkText = "Last Name";
     //
     // textBoxX1
     //
     this.textBoxX1.AutoSize = false;
     //
     // textBoxX1.Border
     //
     this.textBoxX1.Border.Class  = "TextBoxBorder";
     this.textBoxX1.Location      = new System.Drawing.Point(16, 8);
     this.textBoxX1.Name          = "textBoxX1";
     this.textBoxX1.Size          = new System.Drawing.Size(264, 20);
     this.textBoxX1.TabIndex      = 0;
     this.textBoxX1.WatermarkText = "First Name";
     //
     // buttonX1
     //
     this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
     this.buttonX1.Anchor         = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
     this.buttonX1.ColorScheme.DockSiteBackColorGradientAngle = 0;
     this.buttonX1.Location = new System.Drawing.Point(258, 247);
     this.buttonX1.Name     = "buttonX1";
     this.buttonX1.Size     = new System.Drawing.Size(72, 24);
     this.buttonX1.TabIndex = 2;
     this.buttonX1.Text     = "Close";
     this.buttonX1.Click   += new System.EventHandler(this.buttonX1_Click);
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.BackColor         = System.Drawing.Color.FromArgb(((System.Byte)(194)), ((System.Byte)(217)), ((System.Byte)(247)));
     this.ClientSize        = new System.Drawing.Size(338, 277);
     this.Controls.AddRange(new System.Windows.Forms.Control[] {
         this.buttonX1,
         this.groupPanel1,
         this.bar1
     });
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.Icon            = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "Form1";
     this.Text            = "Drop-in replacement controls";
     this.Load           += new System.EventHandler(this.Form1_Load);
     ((System.ComponentModel.ISupportInitialize)(this.bar1)).EndInit();
     this.groupPanel1.ResumeLayout(false);
     this.ResumeLayout(false);
 }
        private void LoadData()
        {
            // 載入畫面
            itmPnlSubjectName.SuspendLayout();
            itmPnlSubjectName.Items.Clear();
            txtSubjectName.Text = "";
            dgDataField.Rows.Clear();

                foreach (string name in _ABCardTemplateTransfer.GetAllSubjectNameList())
                {
                    ButtonItem btnItem = new ButtonItem();
                    btnItem.Name = name;
                    btnItem.Text = name;
                    btnItem.OptionGroup = "itmPnlSubjectName";
                    btnItem.ButtonStyle = DevComponents.DotNetBar.eButtonStyle.ImageAndText;
                    btnItem.Click += new EventHandler(btnItem_Click);
                    itmPnlSubjectName.Items.Add(btnItem);
                }

            itmPnlSubjectName.ResumeLayout();
            itmPnlSubjectName.Refresh();
        }
Exemple #57
0
        /// <summary>
        /// 初始导航。
        /// </summary>
        void InitializeNavigationPublic()
        {
            //清空。
            for (int i = this.ribbonControl.Items.Count - 1; i >= 0; i--)
            {
                var tabItem = this.ribbonControl.Items[i] as RibbonTabItem;
                if (tabItem != null)
                {
                    this.ribbonControl.Items.RemoveAt(i);
                    this.ribbonControl.Controls.Remove(tabItem.Panel);
                }
            }

            //初始化导航
            int mask = (int)GroupType.Windows;
            IList <INavigateGroup> rootGroups = navigationProxy.GetGroupList(Guid.Empty.ToString().ToUpper());
            int index = 0;

            foreach (var vGroup in rootGroups)  //根分组。
            {
                if ((vGroup.Attributes & mask) == mask)
                {
                    #region 一级组/RibbonTabItem

                    DevComponents.DotNetBar.RibbonPanel ribbonPanel = new DevComponents.DotNetBar.RibbonPanel();
                    ribbonPanel.ColorSchemeStyle          = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
                    ribbonPanel.Size                      = new System.Drawing.Size(908, 100);
                    ribbonPanel.Dock                      = System.Windows.Forms.DockStyle.Fill;
                    ribbonPanel.Padding                   = new System.Windows.Forms.Padding(3, 0, 3, 3);
                    ribbonPanel.Style.CornerType          = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonPanel.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
                    ribbonPanel.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;

                    DevComponents.DotNetBar.RibbonTabItem ribbonTabItem = new DevComponents.DotNetBar.RibbonTabItem();
                    //ribbonTabItem.Checked = true;
                    ribbonTabItem.Text  = vGroup.Name;
                    ribbonTabItem.Tag   = vGroup;
                    ribbonTabItem.Panel = ribbonPanel;

                    //二级组
                    IList <INavigateGroup> groups = navigationProxy.GetGroupList(vGroup.ID);
                    if (groups.Count == 0)
                    {
                        groups.Add(vGroup);
                    }

                    //工作组。
                    foreach (var xGroup in groups)
                    {
                        #region 工作组/RibbonBar

                        DevComponents.DotNetBar.RibbonBar ribbonBar = new DevComponents.DotNetBar.RibbonBar();
                        ribbonBar.Text  = xGroup.Name;
                        ribbonBar.Tag   = xGroup;
                        ribbonBar.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;

                        var modules = navigationProxy.GetAllModuleList(xGroup.ID);
                        foreach (var module in modules)
                        {
                            DevComponents.DotNetBar.ButtonItem buttonItem = new DevComponents.DotNetBar.ButtonItem();
                            buttonItem.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
                            buttonItem.Text  = module.Name;
                            buttonItem.Tag   = module;

                            buttonItem.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;

                            Image image = this.GetModuleImage(module.Icon);
                            if (image == null)
                            {
                                image = DrugShop.Res.Properties.Resources.buttonImage;
                            }
                            buttonItem.Image = image;

                            buttonItem.Click += new EventHandler(buttonItem_Click);
                            ribbonBar.Items.Add(buttonItem);
                        }

                        ribbonPanel.Controls.Add(ribbonBar);

                        #endregion
                    }

                    this.ribbonControl.Controls.Add(ribbonPanel);
                    this.ribbonControl.Items.Add(ribbonTabItem, 1 + index);

                    #endregion
                }
            }

            if (rootGroups.Count > 0)
            {
                this.ribbonControl.SelectedRibbonTabItem = this.ribbonControl.Items[1] as RibbonTabItem;
            }
        }
        /// <summary>
        /// pnl : 整個課表的 container
        /// schType : 課表類型
        /// 
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="schType"></param>
        public DecCalendar(DevComponents.DotNetBar.PanelEx pnl)
        {
            pnl.Tag = this;

            #region 註冊事件
            CalendarEvents.ReplaceEvent += (sender, e) => UpdateContent();
            CalendarEvents.ExchangeEvent += (sender, e) =>
            {
                this.SelectedCalendars = new List<CalendarRecord>();
                UpdateContent();
            };
            CalendarEvents.WeekChangeEvent += (vsender, ve) =>
            {
                if (ve.Type.Equals(this.Type) &&
                    ve.AssocID.Equals(this.AssocID))
                {
                    this.SelectedCalendars = new List<CalendarRecord>();
                    this.UpdateContent();
                }
            };
            CalendarEvents.WeekdayPeriodChangeEvent += CalendarEvents_WeekdayPeriodChangeEvent;
            #endregion

            #region 建立元件
            pnl.Controls.Clear();

            PanelEx pnlCalendarControl = makePanel(string.Empty, string.Empty, new Point(), new Size(10,50));
            pnlCalendarControl.Dock = DockStyle.Top;

            btnPrevious = CreateButton(new Size(50, 25));
            btnNext = CreateButton(new Size(50, 25));

            btnPrevious.Text = "上週";
            btnPrevious.Location = new Point(10, 10);
            btnPrevious.Click += (sender, e) =>
            {
                SchoolYearSemesterOption.Instance.StartDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(-7);
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.EndDate.AddDays(-7);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            btnNext.Text = "下週";
            btnNext.Location = new Point(70, 10);
            btnNext.Click += (sender, e) =>
            {
                SchoolYearSemesterOption.Instance.StartDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(7);
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.EndDate.AddDays(7);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            btnCurrent = CreateButton(new Size(50, 25));
            btnCurrent.Text = "本週";
            btnCurrent.Location = new Point(130, 10);
            btnCurrent.Click += (sender,e)=>
            {
                SchoolYearSemesterOption.Instance.StartDate = DateTime.Now.StartOfWeek(DayOfWeek.Monday).ToDayStart();
                SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(6);
                CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
            };

            ButtonX btnPrint = CreateButton(new Size(50, 25));
            btnPrint.Location = new Point(190,10);
            btnPrint.Text = "列印";
            btnPrint.Click += (sender,e)=>
            {
                if (this.Type.Equals(CalendarType.Teacher))
                {
                    List<CalendarRecord> QueryResult = new List<CalendarRecord>();

                    DateTime dteStart = SchoolYearSemesterOption.Instance.StartDate;
                    DateTime dteEnd = SchoolYearSemesterOption.Instance.EndDate;
                    List<string> SelectedClassNames = new List<string>();
                    List<string> SelectedTeacherNames = new List<string>(){AssocID};

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (vsender, ve) =>
                    {
                        #region 找出調課記錄
                        List<CalendarRecord> ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null,
                        null, null, null, null, null);

                        List<CalendarRecord> ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null);

                        Dictionary<string, CalendarRecord> Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出代課記錄
                        List<CalendarRecord> RepRecords = Calendar.Instance.FindReplaceRecords(
                            SelectedTeacherNames, null, SelectedClassNames, null, dteStart, dteEnd);

                        List<CalendarRecord> AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, SelectedTeacherNames, SelectedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);
                        #endregion

                        QueryResult.AddRange(Records.Values);

                        List<CalendarRecord> RelatedQueryResult = new List<CalendarRecord>();

                        List<string> RelatedClassNames = new List<string>();
                        List<string> RelatedTeacherNames = new List<string>();

                        foreach (CalendarRecord record in Records.Values)
                        {
                            if (!string.IsNullOrWhiteSpace(record.ReplaceID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.AbsTeacherName);
                            }

                            if (!string.IsNullOrWhiteSpace(record.ExchangeID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);

                                if (record.ExchangeCalendar!=null)
                                    RelatedTeacherNames.Add(record.ExchangeCalendar.TeacherName);
                            }
                        }

                        RelatedTeacherNames = RelatedTeacherNames.Distinct().ToList();
                        RelatedClassNames = RelatedClassNames.Distinct().ToList();
                        QueryResult.Clear();

                        #region 找出相關調課記錄
                        ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, RelatedTeacherNames, RelatedClassNames, null,
                        null, null, null, null, null);

                        ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, RelatedTeacherNames, RelatedClassNames, null);

                        Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出相關代課記錄
                        RepRecords = Calendar.Instance.FindReplaceRecords(
                            RelatedTeacherNames, null, RelatedClassNames, null, dteStart, dteEnd);

                        AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, RelatedTeacherNames, RelatedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion
                    };

                    worker.RunWorkerCompleted += (vsender, ve) =>
                    {
                        ExchangeReplaceReport.Instance.Print(QueryResult, dteStart, dteEnd);
                        MotherForm.SetStatusBarMessage(string.Empty);
                        btnPrint.Enabled = true;
                    };

                    worker.RunWorkerAsync();
                    MotherForm.SetStatusBarMessage("取得報表資料中!");
                    btnPrint.Enabled = false;
                }
                else if (this.Type.Equals(CalendarType.Class))
                {
                    List<CalendarRecord> QueryResult = new List<CalendarRecord>();

                    DateTime dteStart = SchoolYearSemesterOption.Instance.StartDate;
                    DateTime dteEnd = SchoolYearSemesterOption.Instance.EndDate;
                    List<string> SelectedClassNames = new List<string>() { AssocID };
                    List<string> SelectedTeacherNames = new List<string>();

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (vsender, ve) =>
                    {
                        #region 找出調課記錄
                        List<CalendarRecord> ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null,
                        null, null, null, null, null);

                        List<CalendarRecord> ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null);

                        Dictionary<string, CalendarRecord> Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出代課記錄
                        List<CalendarRecord> RepRecords = Calendar.Instance.FindReplaceRecords(
                            SelectedTeacherNames, null, SelectedClassNames, null, dteStart, dteEnd);

                        List<CalendarRecord> AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, SelectedTeacherNames, SelectedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);
                        #endregion

                        QueryResult.AddRange(Records.Values);

                        List<CalendarRecord> RelatedQueryResult = new List<CalendarRecord>();

                        List<string> RelatedClassNames = new List<string>();
                        List<string> RelatedTeacherNames = new List<string>();

                        foreach (CalendarRecord record in Records.Values)
                        {
                            if (!string.IsNullOrWhiteSpace(record.ReplaceID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.AbsTeacherName);
                            }

                            if (!string.IsNullOrWhiteSpace(record.ExchangeID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.ExchangeCalendar.TeacherName);
                            }
                        }

                        RelatedTeacherNames = RelatedTeacherNames.Distinct().ToList();
                        RelatedClassNames = RelatedClassNames.Distinct().ToList();
                        QueryResult.Clear();

                        #region 找出相關調課記錄
                        ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, RelatedTeacherNames, null, null,
                        null, null, null, null, null);

                        ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, RelatedTeacherNames, null, null);

                        Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出相關代課記錄
                        RepRecords = Calendar.Instance.FindReplaceRecords(
                            RelatedTeacherNames, null, null, null, dteStart, dteEnd);

                        AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, RelatedTeacherNames, null, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion
                    };

                    worker.RunWorkerCompleted += (vsender, ve) =>
                    {
                        ExchangeReplaceReport.Instance.Print(QueryResult, dteStart, dteEnd);
                        MotherForm.SetStatusBarMessage(string.Empty);
                        btnPrint.Enabled = true;
                    };

                    worker.RunWorkerAsync();
                    MotherForm.SetStatusBarMessage("取得報表資料中!");
                    btnPrint.Enabled = false;
                }
            };

            ButtonItem btnPrintAll = new ButtonItem("列印所有", "列印所有");

            btnPrintAll.Click += (sender, e) =>
            {
                if (this.Type.Equals(CalendarType.Teacher))
                {
                    List<CalendarRecord> QueryResult = new List<CalendarRecord>();

                    DateTime dteStart = SchoolYearSemesterOption.Instance.StartDate;
                    DateTime dteEnd = SchoolYearSemesterOption.Instance.EndDate;
                    List<string> SelectedClassNames = new List<string>();
                    List<string> SelectedTeacherNames = new List<string>();

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (vsender, ve) =>
                    {
                        #region 找出調課記錄
                        List<CalendarRecord> ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null,
                        null, null, null, null, null);

                        List<CalendarRecord> ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null);

                        Dictionary<string, CalendarRecord> Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出代課記錄
                        List<CalendarRecord> RepRecords = Calendar.Instance.FindReplaceRecords(
                            SelectedTeacherNames, null, SelectedClassNames, null, dteStart, dteEnd);

                        List<CalendarRecord> AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, SelectedTeacherNames, SelectedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);
                        #endregion

                        QueryResult.AddRange(Records.Values);

                        List<CalendarRecord> RelatedQueryResult = new List<CalendarRecord>();

                        List<string> RelatedClassNames = new List<string>();
                        List<string> RelatedTeacherNames = new List<string>();

                        foreach (CalendarRecord record in Records.Values)
                        {
                            if (!string.IsNullOrWhiteSpace(record.ReplaceID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.AbsTeacherName);
                            }

                            if (!string.IsNullOrWhiteSpace(record.ExchangeID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.ExchangeCalendar.TeacherName);
                            }
                        }

                        RelatedTeacherNames = RelatedTeacherNames.Distinct().ToList();
                        RelatedClassNames = RelatedClassNames.Distinct().ToList();
                        QueryResult.Clear();

                        #region 找出相關調課記錄
                        ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, RelatedTeacherNames, RelatedClassNames, null,
                        null, null, null, null, null);

                        ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, RelatedTeacherNames, RelatedClassNames, null);

                        Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出相關代課記錄
                        RepRecords = Calendar.Instance.FindReplaceRecords(
                            RelatedTeacherNames, null, RelatedClassNames, null, dteStart, dteEnd);

                        AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, RelatedTeacherNames, RelatedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion
                    };

                    worker.RunWorkerCompleted += (vsender, ve) =>
                    {
                        ExchangeReplaceReport.Instance.Print(QueryResult, dteStart, dteEnd);
                        MotherForm.SetStatusBarMessage(string.Empty);
                        btnPrint.Enabled = true;
                    };

                    worker.RunWorkerAsync();
                    MotherForm.SetStatusBarMessage("取得報表資料中!");
                    btnPrint.Enabled = false;
                }
                else if (this.Type.Equals(CalendarType.Class))
                {
                    List<CalendarRecord> QueryResult = new List<CalendarRecord>();

                    DateTime dteStart = SchoolYearSemesterOption.Instance.StartDate;
                    DateTime dteEnd = SchoolYearSemesterOption.Instance.EndDate;
                    List<string> SelectedClassNames = new List<string>();
                    List<string> SelectedTeacherNames = new List<string>();

                    BackgroundWorker worker = new BackgroundWorker();

                    worker.DoWork += (vsender, ve) =>
                    {
                        #region 找出調課記錄
                        List<CalendarRecord> ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null,
                        null, null, null, null, null);

                        List<CalendarRecord> ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, SelectedTeacherNames, SelectedClassNames, null);

                        Dictionary<string, CalendarRecord> Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出代課記錄
                        List<CalendarRecord> RepRecords = Calendar.Instance.FindReplaceRecords(
                            SelectedTeacherNames, null, SelectedClassNames, null, dteStart, dteEnd);

                        List<CalendarRecord> AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, SelectedTeacherNames, SelectedClassNames, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);
                        #endregion

                        QueryResult.AddRange(Records.Values);

                        List<CalendarRecord> RelatedQueryResult = new List<CalendarRecord>();

                        List<string> RelatedClassNames = new List<string>();
                        List<string> RelatedTeacherNames = new List<string>();

                        foreach (CalendarRecord record in Records.Values)
                        {
                            if (!string.IsNullOrWhiteSpace(record.ReplaceID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.AbsTeacherName);
                            }

                            if (!string.IsNullOrWhiteSpace(record.ExchangeID))
                            {
                                RelatedClassNames.Add(record.ClassName);
                                RelatedTeacherNames.Add(record.TeacherName);
                                RelatedTeacherNames.Add(record.ExchangeCalendar.TeacherName);
                            }
                        }

                        RelatedTeacherNames = RelatedTeacherNames.Distinct().ToList();
                        RelatedClassNames = RelatedClassNames.Distinct().ToList();
                        QueryResult.Clear();

                        #region 找出相關調課記錄
                        ExchangeARecords = Calendar.Instance.FindExchangeRecords(
                        dteStart, dteEnd, RelatedTeacherNames, null, null,
                        null, null, null, null, null);

                        ExchangeBRecords = Calendar.Instance.FindExchangeRecords(
                        null, null, null, null, null,
                        dteStart, dteEnd, RelatedTeacherNames, null, null);

                        Records = new Dictionary<string, CalendarRecord>();

                        foreach (CalendarRecord ExchangeRecord in ExchangeARecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        foreach (CalendarRecord ExchangeRecord in ExchangeBRecords)
                            if (!Records.ContainsKey(ExchangeRecord.UID))
                                Records.Add(ExchangeRecord.UID, ExchangeRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion

                        #region 找出相關代課記錄
                        RepRecords = Calendar.Instance.FindReplaceRecords(
                            RelatedTeacherNames, null, null, null, dteStart, dteEnd);

                        AbsRecords = Calendar.Instance.FindReplaceRecords(
                            null, RelatedTeacherNames, null, null, dteStart, dteEnd);

                        foreach (CalendarRecord RepRecord in RepRecords)
                            if (!Records.ContainsKey(RepRecord.UID))
                                Records.Add(RepRecord.UID, RepRecord);

                        foreach (CalendarRecord AbsRecord in AbsRecords)
                            if (!Records.ContainsKey(AbsRecord.UID))
                                Records.Add(AbsRecord.UID, AbsRecord);

                        QueryResult.AddRange(Records.Values);
                        #endregion
                    };

                    worker.RunWorkerCompleted += (vsender, ve) =>
                    {
                        ExchangeReplaceReport.Instance.Print(QueryResult, dteStart, dteEnd);
                        MotherForm.SetStatusBarMessage(string.Empty);
                        btnPrint.Enabled = true;
                    };

                    worker.RunWorkerAsync();
                    MotherForm.SetStatusBarMessage("取得報表資料中!");
                    btnPrint.Enabled = false;
                }
            };

            btnPrint.SubItems.Add(btnPrintAll);

            ButtonItem btnSetting = new ButtonItem("設定", "設定");

            btnSetting.Click += (sender, e) =>
            {
                #region 讀取 Preference
                ConfigData configExchagne = K12.Data.School.Configuration["調代課通知單"];

                if (configExchagne != null)
                {
                    int _useTemplateNumber = 0;
                    int.TryParse(configExchagne["TemplateNumber"], out _useTemplateNumber);

                    string customize = configExchagne["CustomizeTemplate"];
                    byte[] _buffer = Resources.調代課通知單;

                    if (!string.IsNullOrEmpty(customize))
                        _buffer = Convert.FromBase64String(customize);
                    frmExchangeReplaceTemplateConfig frmConfig = new frmExchangeReplaceTemplateConfig(
                        _buffer,
                        _useTemplateNumber);

                    frmConfig.ShowDialog();
                }
                #endregion

                //switch (mCalendarType)
                //{
                //    case CalendarType.Teacher:
                //        new frmCalendarOption(CalendarOption.GetTeacherOption()).ShowDialog();
                //        break;
                //    case CalendarType.Class:
                //        new frmCalendarOption(CalendarOption.GetClassOption()).ShowDialog();
                //        break;
                //    case CalendarType.Classroom:
                //        new frmCalendarOption(CalendarOption.GetClassroomOption()).ShowDialog();
                //        break;
                //}
            };
            btnPrint.SubItems.Add(btnSetting);

            if (CalendarOption.PrintExtraButtons.Count > 0)
            {
                foreach (ButtonItem vButton in CalendarOption.PrintExtraButtons)
                    btnPrint.SubItems.Add(vButton);
            }

            ErrorProvider errProvier = new ErrorProvider();

            DateTime dt = new DateTime();

            lblName.Name = "lblTitle";
            lblName.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            lblName.Font = new System.Drawing.Font("新細明體", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            lblName.Location = new Point(240, 13);
            lblName.AutoSize = true;

            txtStartDate.Font = new System.Drawing.Font("新細明體", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            txtStartDate.Location = new Point(380, 13);
            txtStartDate.Width = 40;
            txtStartDate.TextChanged += (sender, e) =>
            {
              string value = txtStartDate.Text;
                if (string.IsNullOrEmpty(value)) //沒有資料就不作任何檢查。
                    return;

                if (!DateTime.TryParse(value, out dt))
                {
                    errProvier.SetError(txtStartDate, "日期格式錯誤。");
                }
                else
                {
                    errProvier.Clear();
                }
            };
            txtStartDate.KeyPress += (sender, e) =>
            {
                if (e.KeyChar.Equals((char)Keys.Return))
                {
                    SchoolYearSemesterOption.Instance.StartDate = dt.StartOfWeek(DayOfWeek.Monday);
                    SchoolYearSemesterOption.Instance.EndDate = SchoolYearSemesterOption.Instance.StartDate.AddDays(6);
                    txtStartDate.Text = SchoolYearSemesterOption.Instance.StartDate.Month + "/" + SchoolYearSemesterOption.Instance.StartDate.Day;
                    CalendarEvents.RaiseWeekChangeEvent(this.Type,this.AssocID);
                }
            };

            lblEndDate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            lblEndDate.Font = new System.Drawing.Font("新細明體", 13F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(136)));
            lblEndDate.Location = new Point(420, 13);
            lblEndDate.AutoSize = true;

            pnlCalendarControl.Controls.Add(btnPrint);
            pnlCalendarControl.Controls.Add(txtStartDate);
            pnlCalendarControl.Controls.Add(lblName);
            pnlCalendarControl.Controls.Add(lblEndDate);
            pnlCalendarControl.Controls.Add(btnPrevious);
            pnlCalendarControl.Controls.Add(btnCurrent);
            pnlCalendarControl.Controls.Add(btnNext);

            PanelEx pnlCalendarContent = new PanelEx();
            pnlCalendarContent.Dock = DockStyle.Fill;

            pnl.Controls.Add(pnlCalendarContent);
            pnl.Controls.Add(pnlCalendarControl);

            this.pnlContainer = pnlCalendarContent;
            this.pnlContainer.Resize += (sender, e) => Resize();
            this.cells = new Dictionary<string, DevComponents.DotNetBar.PanelEx>();
            this.decPeriods = new Dictionary<string, DecPeriod>();
            this.headerCells = new Dictionary<string, DevComponents.DotNetBar.PanelEx>();

            ContextMenu Menu = new ContextMenu();
            this.pnlContainer.ContextMenu = Menu;
            Menu.Popup += Menu_Popup;
            #endregion

            #region 星期節次
            Campus.Configuration.ConfigData config = Campus.Configuration.Config.User["CalendarOption"];

            string vWeekday = config["Weekday"];
            string vPeriods = config["PeriodList"];

            if (!string.IsNullOrWhiteSpace(vWeekday))
                this.weekday = K12.Data.Int.Parse(vWeekday);
            else
                this.weekday = 5;

            this.periods = Utility.GetPeriodList(vPeriods);
            this.RedrawGrid();
            #endregion
        }
Exemple #59
0
        private void InitializeNavigationGuest()
        {
            //清空。
            for (int i = this.ribbonControl.Items.Count - 1; i >= 0; i--)
            {
                var tabItem = this.ribbonControl.Items[i] as RibbonTabItem;
                if (tabItem != null)
                {
                    this.ribbonControl.Items.RemoveAt(i);
                    this.ribbonControl.Controls.Remove(tabItem.Panel);
                }
            }

            //根组。
            DevComponents.DotNetBar.RibbonPanel ribbonPanel = new DevComponents.DotNetBar.RibbonPanel();
            ribbonPanel.ColorSchemeStyle          = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            ribbonPanel.Size                      = new System.Drawing.Size(908, 100);
            ribbonPanel.Dock                      = System.Windows.Forms.DockStyle.Fill;
            ribbonPanel.Padding                   = new System.Windows.Forms.Padding(3, 0, 3, 3);
            ribbonPanel.Style.CornerType          = DevComponents.DotNetBar.eCornerType.Square;
            ribbonPanel.StyleMouseDown.CornerType = DevComponents.DotNetBar.eCornerType.Square;
            ribbonPanel.StyleMouseOver.CornerType = DevComponents.DotNetBar.eCornerType.Square;

            DevComponents.DotNetBar.RibbonTabItem ribbonTabItem = new DevComponents.DotNetBar.RibbonTabItem();
            //ribbonTabItem.Checked = true;
            ribbonTabItem.Text  = "相关连接";
            ribbonTabItem.Tag   = null;
            ribbonTabItem.Panel = ribbonPanel;

            //工作组
            DevComponents.DotNetBar.RibbonBar ribbonBar = new DevComponents.DotNetBar.RibbonBar();
            ribbonBar.Text  = ribbonTabItem.Text;
            ribbonBar.Tag   = null;
            ribbonBar.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;

            //模块
            DevComponents.DotNetBar.ButtonItem buttonItem = new DevComponents.DotNetBar.ButtonItem();
            buttonItem.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            buttonItem.Text  = "登录";
            buttonItem.Tag   = typeof(LoginForm);

            buttonItem.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
            buttonItem.Image         = DrugShop.Res.Properties.Resources.buttonImage;
            buttonItem.Click        += new EventHandler(buttonItem_Click);
            ribbonBar.Items.Add(buttonItem);

            buttonItem       = new DevComponents.DotNetBar.ButtonItem();
            buttonItem.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
            buttonItem.Text  = "关于";
            buttonItem.Tag   = typeof(AboutForm);

            buttonItem.ImagePosition = DevComponents.DotNetBar.eImagePosition.Top;
            buttonItem.Image         = DrugShop.Res.Properties.Resources.buttonImage;
            buttonItem.Click        += new EventHandler(buttonItem_Click);
            ribbonBar.Items.Add(buttonItem);

            ribbonPanel.Controls.Add(ribbonBar);

            this.ribbonControl.Controls.Add(ribbonPanel);
            this.ribbonControl.Items.Add(ribbonTabItem, 1);

            this.ribbonControl.SelectedRibbonTabItem = ribbonTabItem;
        }
Exemple #60
0
        private void ColorSelected()
        {
            DevComponents.DotNetBar.PopupContainerControl ctrl = this.Parent as DevComponents.DotNetBar.PopupContainerControl;
            if (ctrl == null)
            {
                return;
            }

            // Change the Parent Item image to indicate which color was selected last
            // Assumes that Image with ImageIndex 21 is used on button
            DevComponents.DotNetBar.ButtonItem btn = ctrl.ParentItem as DevComponents.DotNetBar.ButtonItem;
            Bitmap   bmp = new Bitmap(btn.Image);
            Graphics g   = Graphics.FromImage(bmp);

            g.DrawImageUnscaled(btn.Image, 0, 0);
            using (SolidBrush brush = new SolidBrush(this.SelectedColor))
                g.FillRectangle(brush, 0, 12, 16, 4);
            g.Dispose();
            btn.ImageIndex = -1;
            DevComponents.DotNetBar.DotNetBarManager manager = null;
            if (btn.ContainerControl is DevComponents.DotNetBar.Bar)
            {
                manager = ((DevComponents.DotNetBar.Bar)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            else if (btn.ContainerControl is DevComponents.DotNetBar.MenuPanel)
            {
                manager = ((DevComponents.DotNetBar.MenuPanel)btn.ContainerControl).Owner as DevComponents.DotNetBar.DotNetBarManager;
            }
            if (manager != null && btn.Name != "")
            {
                ArrayList items = manager.GetItems(btn.Name, true);
                foreach (DevComponents.DotNetBar.ButtonItem item in items)
                {
                    item.Image = bmp;
                }
            }
            else
            {
                btn.Image = bmp;
            }

            if (btn.ContainerControl is RibbonBar)
            {
                ((RibbonBar)btn.ContainerControl).RecalcLayout();
            }

            if (btn.IsOnMenu)
            {
                DevComponents.DotNetBar.BaseItem topItem = ctrl.ParentItem;
                while (topItem.Parent is DevComponents.DotNetBar.ButtonItem)
                {
                    topItem = topItem.Parent;
                }
                topItem.Expanded = false;
                if (topItem.Parent != null)
                {
                    topItem.Parent.AutoExpand = false;
                }
            }
            else
            {
                btn.Expanded = false;
            }
        }