コード例 #1
0
ファイル: MainForm.cs プロジェクト: GoldMax/Pulsar.NET
		//-------------------------------------------------------------------------------------
		private void navigator1_FormSelected(object sender, FormInfo formInfo)
		{
			try
			{
				switch (formInfo.FormClassName)
				{
					case "SpecialConParams": toolStripStatusLabelServerName_DoubleClick(null, null); break;
					//case "SpecialCasheRefresh" : PulsarConnection.ObjectsCache.Clear(); break;
					default:
						if (tabViewer1.TabPages[formInfo.SD.ToString()] != null)
						{
							tabViewer1.SelectedTab = tabViewer1.TabPages[formInfo.SD.ToString()];
							return;
						}
						if (String.IsNullOrWhiteSpace(formInfo.FormClassName))
						{
							MessageBox.Show("Нет формы!");
							return;
						}
						//string formsDll = formInfo.FormClassName.Split('.')[0] + "." + formInfo.FormClassName.Split('.')[1];
						//formsDll = String.Format("{0}\\{1}.dll", Path.GetDirectoryName(Application.ExecutablePath), formsDll);
						//Assembly assem = Assembly.LoadFrom(formsDll);
						Type formType = Type.GetType(formInfo.FormClassName);
						if (formType == null)
							throw new PulsarException("Не удалось загрузить тип [{0}]!", formInfo.FormClassName);
						ClientBaseForm form =
							(ClientBaseForm)formType.InvokeMember(formInfo.FormClassName, BindingFlags.CreateInstance, null, null, null);

						form.FormInfo = formInfo;
						form.Name = formInfo.SD.ToString();
						if (formInfo.Caption != null)
							form.Text = formInfo.Caption;

						Control[] arr = null;
						if (form.Controls.Count == 1 && form.Controls[0] is Panel && form.Controls[0].Name == "panelBack")
							arr = new Control[1] { form.Controls[0] };
						else
						{
							arr = new Control[form.Controls.Count];
							form.Controls.CopyTo(arr, 0);
						}
						TabViewerPage page = new TabViewerPage(form.Text.Trim());
						page.Name = form.Name;
						page.Tag = form;
						page.Controls.AddRange(arr);
						tabViewer1.TabPages.Add(page);
						tabViewer1.SelectedTab = page;
						form.ControlAdded += new ControlEventHandler(ClientForm_ControlAdded);
						form.ShowInTaskbar = false;
						form.RaiseLoadEvent();
						//form.Show();
						//form.Hide();
						break;
				}
			}
			catch (Exception Err)
			{
				Sim.Controls.ErrorBox.Show(Err);
			}
		}
コード例 #2
0
ファイル: FormSetAccesses.cs プロジェクト: GoldMax/Pulsar.NET
		//-------------------------------------------------------------------------------------
		#region << Others Methods >>
		private void FillACLs(FormInfo fi)
		{
			try
			{
				OID sd = fi.SD;
				ACL.Clear();
				ACL.EventsOff();

				if(pSec.ACEs.ContainsKey(sd))
					foreach(ACE ace in pSec.ACEs[sd])
					{
						if(at != null && at.Contains(ace.SID) == false)
							continue;
						if(ace.SD == sd)
						{
							ACEitem i = new ACEitem();
							i.ACE = ace.Clone();
							IPersonSubject u = null;
							if(pSec.SecurityGroups.ContainsKey(ace.SID))
							{
								i.Image = global::Sim.AdminForms.Properties.Resources.Group;
								i.Name = pSec.SecurityGroups[ace.SID].Name;
							}
							else if((u = users[ace.SID]) != null)
							{
								i.Image = global::Sim.AdminForms.Properties.Resources.User;
								i.Name = u.FullName;
							}
							else
							{
								i.Image = global::Sim.AdminForms.Properties.Resources.UnknownGroup;
								i.Name = ace.SID.ToString();
							}
							ACL.Add(i);
						}
					}
				ACL.EventsOn();
				fdgvACL.Tag = sd;
			}
			catch(Exception Err)
			{
				Sim.Controls.ModalErrorBox.Show(Err, PanelBack);
			}
		}
コード例 #3
0
ファイル: MainForm.cs プロジェクト: GoldMax/Pulsar.NET
		//-------------------------------------------------------------------------------------
		#region << Navigator and TabViewer Handlers and Methods>>
		private void NavigatorAddSubItems(PulsarMainMenu menu, FormInfo child,
																																					ToolStripItemCollection col)
		{
			TreeItem<FormInfo> i = menu[child];
			ToolStripItem item;
			if (i.HasChildren == false)
			{
				if (child.Caption == "-")
				{
					item = new ToolStripSeparator();
					item.Name = child.SD.ToString();
				}
				else
				{
					if (i.Level > 1)
						item = new ToolStripMenuItem();
					else
						item = new ToolStripButton();
					item.Image = child.Image == null ? global::Sim.Shell.Properties.Resources.Point_Shadow :
																																								GetResourceImage(child.Image);
					item.Name = child.SD.ToString();
					item.Text = child.Caption;
					item.Tag = child;
				}
			}
			else
			{
				item = new ToolStripDropDownButton();
				((ToolStripDropDownButton)item).DropDownItemClicked +=
						new ToolStripItemClickedEventHandler(navigator1.ToolStrips_ItemClicked);
				item.Image = child.Image == null ? global::Sim.Shell.Properties.Resources.Arrow_Gray : GetResourceImage(child.Image);
				item.Name = child.SD.ToString();
				item.Text = child.Caption;
				((ToolStripDropDownButton)item).ShowDropDownArrow = false;
				foreach(TreeItem<FormInfo> ch in i.Children.OrderBy(x => x, PulsarMainMenu.PulsarMainMenuSorter.Default))
					NavigatorAddSubItems(menu, ch.Object, ((ToolStripDropDownButton)item).DropDownItems);
			}
			col.Add(item);
		}
コード例 #4
0
ファイル: Navigator.cs プロジェクト: GoldMax/Pulsar.NET
		/// <summary>
		/// Метод, вызывающий событие FormSelected.
		/// </summary>
		/// <param name="formInfo">Информация о форме.</param>
		protected void OnFormSelected(FormInfo formInfo)
		{
			if(FormSelected != null && formInfo != null)
				FormSelected(this, formInfo);
		}