예제 #1
0
		//-------------------------------------------------------------------------------------
		#region << Form Handlers >>
		private void MainForm_Load(object sender, EventArgs e)
		{
			try
			{
				PulsarQuery.ContextQuery.ClientType = ClientType.WinForms;
				PulsarQuery.ContextQuery.ClientName = "Sim";
				PulsarQuery.ContextQuery.ClientVersion = Application.ExecutablePath.Contains("bin\\Debug") == true
					? 0
					: GetLastVersion();
				navigator1.AssistSex = PulsarQuery.ContextQuery.User.Sex;

				ClientBaseForm.SetShellStatusText = (s) => toolStripStatusLabelText.Text = s;

				Rectangle bounds = this.Bounds;
				bounds.X = (int)ServerParamsBase.GetParam("MainForm", "X", 20);
				bounds.Y = (int)ServerParamsBase.GetParam("MainForm", "Y", 20);
				bounds.Width = (int)ServerParamsBase.GetParam("MainForm", "Width", 600);
				bounds.Height = (int)ServerParamsBase.GetParam("MainForm", "Height", 500);
				this.Bounds = bounds;
				this.WindowState = (FormWindowState)ServerParamsBase.GetParam("MainForm", "State", FormWindowState.Normal);

				//*** Имя сервера ***//
				toolStripStatusLabelServerName.Text = PulsarConnection.Default.ToString();

				PulsarConnection.DataAccessBegin += new EventHandler(server_DataAccessBegin);
				PulsarConnection.DataAccessEnd += new EventHandler(server_DataAccessEnd);

				#region Отображаем окно прогресса загрузки данных
				NetProgressControl progressForm = new NetProgressControl();
				//progressForm.buttonCancel.Enabled = false;
				progressForm.MessageText = "Инициализация программы.\r\nПожалуйста, подождите ...";
				foreach (Control c in this.Controls)
					c.Enabled = false;
				this.Controls.Add(progressForm);
				progressForm.BringToFront();
				#endregion Отображаем окно прогресса загрузки данных

				TaskManager.Run("MainMenu", this, () => PulsarConnection.Default.Get("MainMenu", "GetUserMainMenu",
						new { GetUserMainMenu = PulsarQuery.ContextQuery.User.OID }, PulsarQueryParams.None));
			}
			catch (Exception Err)
			{
				Sim.Controls.ErrorBox.Show(Err);
				this.Close();
			}
		}
예제 #2
0
		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Вызывает появление окна прогресса обмена данными с сервером.
		/// </summary>
		/// <param name="parentControl">Контрол, который будет родительским для окна прогресса.</param>
		/// <param name="cancelEnabled">Определяет доступность кнопки Отмена.</param>
		public void ShowProgressWindow(Control parentControl, bool cancelEnabled = true)
		{
			if(progressList.ContainsKey(parentControl))
				return;

			focusedControl = GetFocusedControl(parentControl);

			NetProgressControl progressForm = new NetProgressControl();
			progressForm.buttonCancel.Enabled = cancelEnabled;
			progressForm.NeedTerminate += progressAbortMethod;
			parentControl.Controls.Add(progressForm);
			progressForm.BringToFront();


			foreach(Control ctrl in parentControl.Controls)
			{
				if(ctrl != progressForm)
					ctrl.Enabled = false;
			}
			progressList.Add(parentControl, progressForm);
		}