public CreateKaraokeDatabaseAgent( CreateDatabaseAgentView theCallingView, FileInfo theDatabaseInfo, DirectoryInfo theSourceDirectoryInfo) { this._CallingView = theCallingView; this._DatabaseInfo = theDatabaseInfo; this._SourceDirectoryInfo = theSourceDirectoryInfo; }
public void CreateDatabaseAgentView_ShowForMusic( CreateDatabaseView theCallingView, DirectoryInfo theSourceDirectoryInfo, FileInfo theTargetFileInfo) { CreateDatabaseAgentView theView = new CreateDatabaseAgentView( theSourceDirectoryInfo, theTargetFileInfo); theView.FormClosing += new FormClosingEventHandler(CreateDatabaseAgentView_FormClosing); CreateMusicDatabaseAgent theAgent = new CreateMusicDatabaseAgent( theView, theTargetFileInfo, theSourceDirectoryInfo); theAgent.Inserting += new EventHandler(CreateDatabaseAgent_Inserting); theAgent.Updating += new EventHandler(CreateDatabaseAgent_Updating); theAgent.Completed += new EventHandler(CreateDatabaseAgent_Completed); RegistryAgent.LastMusicDatabase = theTargetFileInfo.FullName; this._CurrentMusicDatabaseFileInfo = new FileInfo(theTargetFileInfo.FullName); this._Thread = new Thread( new ThreadStart(theAgent.Start)); this._Thread.Start(); theView.ShowDialog( theCallingView); theCallingView.Close(); this.OpenDatabase(); }
public void OnCreateDatabaseAgentCompleted( CreateDatabaseAgentView theView) { // InvokeRequired compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this._MainView.InvokeRequired) { this._MainView.Invoke( new CreateDatabaseAgentCompletedHandler( this.OnCreateDatabaseAgentCompleted), theView); } else { theView.Close(); } }
public void OnCreateDatabaseAgentUpdating( CreateDatabaseAgentView theView, FileInfo theFileInfo) { // InvokeRequired compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this._MainView.InvokeRequired) { this._MainView.Invoke( new CreateDatabaseAgentUpdatingHandler( this.OnCreateDatabaseAgentUpdating), theView, theFileInfo); } else { theView.Cursor = Cursors.WaitCursor; string theCurrentDirectory = theFileInfo.DirectoryName.Replace( theView.SourceDirectoryInfo.FullName, String.Empty); TextRenderer.MeasureText( theCurrentDirectory, theView.labelCurrentDirectory.Font, new Size( theView.labelCurrentDirectory.Width, theView.labelCurrentDirectory.Height), TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis); theView.labelCurrentDirectory.Text = theCurrentDirectory; string theCurrentFile = "Updating " + theFileInfo.Name; TextRenderer.MeasureText( theCurrentFile, theView.labelCurrentFile.Font, new Size( theView.labelCurrentFile.Width, theView.labelCurrentFile.Height), TextFormatFlags.ModifyString | TextFormatFlags.PathEllipsis); theView.labelCurrentFile.Text = theCurrentFile; Application.DoEvents(); } }