Exemplo n.º 1
0
		///<summary>
		/// Shows loading bar. Also takes job settings: the number of resource groups
		/// to be initialised, the number of resource groups to be loaded, and the
		/// proportion of the job that will be taken up by initialization. Usually,
		/// script parsing takes up most time, so the default value is 0.7.
		/// </summary>
		/// <param name="numGroupsInit"></param>
		/// <param name="numGroupsLoad"></param>
		/// <param name="initProportion"></param>
		public void ShowLoadingBar( int numGroupsInit, int numGroupsLoad, Real initProportion )
		{
			if ( this.LoadBar != null )
			{
				HideLoadingBar();
				return;
			}
			this.LoadBar = new ProgressBar( this.mName + "/LoadingBar", "Loading...", 400, 308 );
			OverlayElement e = this.LoadBar.OverlayElement;
			this.mDialogShade.AddChild( e );
			e.VerticalAlignment = VerticalAlignment.Center;
			e.Left = ( -( e.Width/2 ) );
			e.Top = ( -( e.Height/2 ) );
			ResourceGroupManager.Instance.AddResourceGroupListener( this );
			this.CursorWasVisible = IsCursorVisible;
			HideCursor();
			this.mDialogShade.Show();
			// calculate the proportion of job required to init/load one group
			if ( numGroupsInit == 0 && numGroupsLoad != 0 )
			{
				this.groupInitProportion = 0;
				this.groupLoadProportion = 1;
			}
			else if ( numGroupsLoad == 0 && numGroupsInit != 0 )
			{
				this.groupLoadProportion = 0;
				if ( numGroupsInit != 0 )
				{
					this.groupInitProportion = 1;
				}
			}
			else if ( numGroupsInit == 0 && numGroupsLoad == 0 )
			{
				this.groupInitProportion = 0;
				this.groupLoadProportion = 0;
			}
			else
			{
				this.groupInitProportion = initProportion/numGroupsInit;
				this.groupLoadProportion = ( 1 - initProportion )/numGroupsLoad;
			}
		}
Exemplo n.º 2
0
		/// <summary>
		/// 
		/// </summary>
		public void HideLoadingBar()
		{
			if ( this.LoadBar != null )
			{
				this.LoadBar.Cleanup();
				this.LoadBar = null;
				ResourceGroupManager.Instance.RemoveResourceGroupListener( this );
				if ( this.CursorWasVisible )
				{
					ShowCursor();
				}
				this.mDialogShade.Hide();
			}
		}
Exemplo n.º 3
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="trayLoc"></param>
		/// <param name="name"></param>
		/// <param name="caption"></param>
		/// <param name="width"></param>
		/// <param name="commentBoxWidth"></param>
		/// <returns></returns>
		public ProgressBar CreateProgressBar( TrayLocation trayLoc, String name, DisplayString caption, Real width,
		                                      Real commentBoxWidth )
		{
			var pb = new ProgressBar( name, caption, width, commentBoxWidth );
			MoveWidgetToTray( pb, trayLoc );
			return pb;
		}