2017-05-11 14:49:17 +01:00
//
// Author:
// Natalia Portillo claunia@claunia.com
//
// Copyright (c) 2017, © Claunia.com
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the distribution.
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
using System ;
2017-05-11 15:57:02 +01:00
using System.IO ;
2017-05-11 14:50:29 +01:00
using System.Threading ;
using Gtk ;
using osrepodbmgr.Core ;
2017-05-11 14:49:17 +01:00
namespace osrepodbmgr
{
2017-05-11 14:50:29 +01:00
public partial class frmMain : Window
2017-05-11 14:49:17 +01:00
{
2017-05-11 14:50:29 +01:00
ListStore osView ;
Thread thdPulseProgress ;
Thread thdPopulateOSes ;
2017-05-12 04:10:43 +01:00
Thread thdCompressTo ;
Thread thdSaveAs ;
2017-05-11 14:50:29 +01:00
2017-05-11 14:49:17 +01:00
public frmMain ( ) :
2017-05-11 14:50:29 +01:00
base ( WindowType . Toplevel )
2017-05-11 14:49:17 +01:00
{
2017-05-11 14:50:29 +01:00
Build ( ) ;
Workers . InitDB ( ) ;
CellRendererText developerCell = new CellRendererText ( ) ;
CellRendererText productCell = new CellRendererText ( ) ;
CellRendererText versionCell = new CellRendererText ( ) ;
CellRendererText languagesCell = new CellRendererText ( ) ;
CellRendererText architectureCell = new CellRendererText ( ) ;
CellRendererText machineCell = new CellRendererText ( ) ;
CellRendererText formatCell = new CellRendererText ( ) ;
CellRendererText descriptionCell = new CellRendererText ( ) ;
CellRendererToggle oemCell = new CellRendererToggle ( ) ;
CellRendererToggle upgradeCell = new CellRendererToggle ( ) ;
CellRendererToggle updateCell = new CellRendererToggle ( ) ;
CellRendererToggle sourceCell = new CellRendererToggle ( ) ;
CellRendererToggle filesCell = new CellRendererToggle ( ) ;
CellRendererToggle netinstallCell = new CellRendererToggle ( ) ;
CellRendererText pathCell = new CellRendererText ( ) ;
TreeViewColumn developerColumn = new TreeViewColumn ( "Developer" , developerCell , "text" , 0 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn productColumn = new TreeViewColumn ( "Product" , productCell , "text" , 1 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn versionColumn = new TreeViewColumn ( "Version" , versionCell , "text" , 2 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn languagesColumn = new TreeViewColumn ( "Languages" , languagesCell , "text" , 3 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn architectureColumn = new TreeViewColumn ( "Architecture" , architectureCell , "text" , 4 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn machineColumn = new TreeViewColumn ( "Machine" , machineCell , "text" , 5 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn formatColumn = new TreeViewColumn ( "Format" , formatCell , "text" , 6 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn descriptionColumn = new TreeViewColumn ( "Description" , descriptionCell , "text" , 7 , "background" , 14 , "foreground" , 15 ) ;
TreeViewColumn oemColumn = new TreeViewColumn ( "OEM?" , oemCell , "active" , 8 ) ;
TreeViewColumn upgradeColumn = new TreeViewColumn ( "Upgrade?" , upgradeCell , "active" , 9 ) ;
TreeViewColumn updateColumn = new TreeViewColumn ( "Update?" , updateCell , "active" , 10 ) ;
TreeViewColumn sourceColumn = new TreeViewColumn ( "Source?" , sourceCell , "active" , 11 ) ;
TreeViewColumn filesColumn = new TreeViewColumn ( "Files?" , filesCell , "active" , 12 ) ;
TreeViewColumn netinstallColumn = new TreeViewColumn ( "NetInstall?" , netinstallCell , "active" , 13 ) ;
TreeViewColumn pathColumn = new TreeViewColumn ( "Path in repo" , pathCell , "text" , 16 , "background" , 14 , "foreground" , 15 ) ;
osView = new ListStore ( typeof ( string ) , typeof ( string ) , typeof ( string ) , typeof ( string ) , typeof ( string ) , typeof ( string ) , typeof ( string ) , typeof ( string ) ,
typeof ( bool ) , typeof ( bool ) , typeof ( bool ) , typeof ( bool ) , typeof ( bool ) , typeof ( bool ) , typeof ( string ) , typeof ( string ) , typeof ( string ) ,
typeof ( long ) , typeof ( string ) ) ;
treeOSes . Model = osView ;
treeOSes . AppendColumn ( developerColumn ) ;
treeOSes . AppendColumn ( productColumn ) ;
treeOSes . AppendColumn ( versionColumn ) ;
treeOSes . AppendColumn ( languagesColumn ) ;
treeOSes . AppendColumn ( architectureColumn ) ;
treeOSes . AppendColumn ( machineColumn ) ;
treeOSes . AppendColumn ( formatColumn ) ;
treeOSes . AppendColumn ( descriptionColumn ) ;
treeOSes . AppendColumn ( oemColumn ) ;
treeOSes . AppendColumn ( upgradeColumn ) ;
treeOSes . AppendColumn ( updateColumn ) ;
treeOSes . AppendColumn ( sourceColumn ) ;
treeOSes . AppendColumn ( filesColumn ) ;
treeOSes . AppendColumn ( netinstallColumn ) ;
treeOSes . AppendColumn ( pathColumn ) ;
treeOSes . Selection . Mode = SelectionMode . Single ;
thdPulseProgress = new Thread ( ( ) = >
{
while ( true )
{
Application . Invoke ( delegate
{
prgProgress . Pulse ( ) ;
} ) ;
Thread . Sleep ( 66 ) ;
}
} ) ;
Workers . Failed + = LoadOSesFailed ;
Workers . Finished + = LoadOSesFinished ;
Workers . UpdateProgress + = UpdateProgress ;
Workers . AddOS + = AddOS ;
thdPopulateOSes = new Thread ( Workers . GetAllOSes ) ;
thdPopulateOSes . Start ( ) ;
}
void LoadOSesFailed ( string text )
{
Application . Invoke ( delegate
{
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Error , ButtonsType . Ok ,
string . Format ( "Error {0} when populating OSes file, exiting..." , text ) ) ;
dlgMsg . Run ( ) ;
dlgMsg . Destroy ( ) ;
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
if ( thdPopulateOSes ! = null )
{
thdPopulateOSes . Abort ( ) ;
thdPopulateOSes = null ;
}
Workers . Failed - = LoadOSesFailed ;
Workers . Finished - = LoadOSesFinished ;
Workers . UpdateProgress - = UpdateProgress ;
Application . Quit ( ) ;
} ) ;
}
void LoadOSesFinished ( )
{
Application . Invoke ( delegate
{
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
if ( thdPopulateOSes ! = null )
{
thdPopulateOSes . Abort ( ) ;
thdPopulateOSes = null ;
}
Workers . Failed - = LoadOSesFailed ;
Workers . Finished - = LoadOSesFinished ;
Workers . UpdateProgress - = UpdateProgress ;
lblProgress . Visible = false ;
prgProgress . Visible = false ;
treeOSes . Sensitive = true ;
btnAdd . Visible = true ;
btnRemove . Visible = true ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = true ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = true ;
btnHelp . Visible = true ;
btnSettings . Visible = true ;
} ) ;
}
public void UpdateProgress ( string text , string inner , long current , long maximum )
{
Application . Invoke ( delegate
{
lblProgress . Text = text ;
prgProgress . Text = inner ;
if ( maximum > 0 )
prgProgress . Fraction = current / ( double ) maximum ;
else
prgProgress . Pulse ( ) ;
} ) ;
}
public void UpdateProgress2 ( string text , string inner , long current , long maximum )
{
Application . Invoke ( delegate
{
lblProgress2 . Text = text ;
prgProgress2 . Text = inner ;
if ( maximum > 0 )
prgProgress2 . Fraction = current / ( double ) maximum ;
else
prgProgress2 . Pulse ( ) ;
} ) ;
}
void AddOS ( DBEntry os , bool existsInRepo , string pathInRepo )
{
Application . Invoke ( delegate
{
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
string color = existsInRepo ? "green" : "red" ;
osView . AppendValues ( os . developer , os . product , os . version , os . languages , os . architecture , os . machine ,
os . format , os . description , os . oem , os . upgrade , os . update , os . source ,
os . files , os . netinstall , color , "black" , pathInRepo , os . id , os . mdid ) ;
} ) ;
}
protected void OnBtnAddClicked ( object sender , EventArgs e )
{
2017-05-11 15:50:07 +01:00
dlgAdd _dlgAdd = new dlgAdd ( ) ;
_dlgAdd . OnAddedOS + = ( os , existsInRepo , pathInRepo ) = >
2017-05-11 15:06:14 +01:00
{
string color = existsInRepo ? "green" : "red" ;
osView . AppendValues ( os . developer , os . product , os . version , os . languages , os . architecture , os . machine ,
os . format , os . description , os . oem , os . upgrade , os . update , os . source ,
os . files , os . netinstall , color , "black" , pathInRepo , os . id , os . mdid ) ;
} ;
2017-05-11 15:50:07 +01:00
_dlgAdd . Run ( ) ;
_dlgAdd . Destroy ( ) ;
2017-05-11 14:50:29 +01:00
}
protected void OnBtnRemoveClicked ( object sender , EventArgs e )
{
TreeIter osIter ;
if ( treeOSes . Selection . GetSelected ( out osIter ) )
{
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Question , ButtonsType . YesNo ,
"Are you sure you want to remove the selected OS?" ) ;
if ( dlgMsg . Run ( ) = = ( int ) ResponseType . Yes )
{
Workers . RemoveOS ( ( long ) osView . GetValue ( osIter , 17 ) , ( string ) osView . GetValue ( osIter , 18 ) ) ;
osView . Remove ( ref osIter ) ;
}
dlgMsg . Destroy ( ) ;
}
}
2017-05-12 04:10:43 +01:00
protected void OnBtnSaveClicked ( object sender , EventArgs e )
2017-05-11 14:50:29 +01:00
{
TreeIter osIter ;
if ( treeOSes . Selection . GetSelected ( out osIter ) )
{
2017-05-12 04:10:43 +01:00
Context . dbInfo . id = ( long ) osView . GetValue ( osIter , 17 ) ;
2017-05-11 14:50:29 +01:00
2017-05-12 04:10:43 +01:00
FileChooserDialog dlgFolder = new FileChooserDialog ( "Save to..." , this , FileChooserAction . SelectFolder ,
2017-05-11 14:50:29 +01:00
"Cancel" , ResponseType . Cancel , "Choose" , ResponseType . Accept ) ;
dlgFolder . SelectMultiple = false ;
if ( dlgFolder . Run ( ) = = ( int ) ResponseType . Accept )
{
2017-05-12 04:10:43 +01:00
Context . path = dlgFolder . Filename ;
2017-05-11 14:50:29 +01:00
2017-05-11 15:22:44 +01:00
dlgFolder . Destroy ( ) ;
2017-05-11 14:50:29 +01:00
lblProgress . Visible = true ;
prgProgress . Visible = true ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = true ;
2017-05-11 14:50:29 +01:00
prgProgress2 . Visible = true ;
treeOSes . Sensitive = false ;
btnAdd . Visible = false ;
btnRemove . Visible = false ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = false ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = false ;
btnHelp . Visible = false ;
btnSettings . Visible = false ;
btnStop . Visible = true ;
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
Workers . Failed + = SaveAsFailed ;
Workers . Finished + = SaveAsFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress + = UpdateProgress ;
Workers . UpdateProgress2 + = UpdateProgress2 ;
2017-05-12 04:10:43 +01:00
thdSaveAs = new Thread ( Workers . SaveAs ) ;
thdSaveAs . Start ( ) ;
2017-05-11 14:50:29 +01:00
}
else
dlgFolder . Destroy ( ) ;
2017-05-12 04:10:43 +01:00
}
2017-05-11 14:50:29 +01:00
}
2017-05-12 04:10:43 +01:00
public void SaveAsFailed ( string text )
2017-05-11 14:50:29 +01:00
{
Application . Invoke ( delegate
{
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Error , ButtonsType . Ok , text ) ;
dlgMsg . Run ( ) ;
dlgMsg . Destroy ( ) ;
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
if ( thdSaveAs ! = null )
2017-05-11 14:50:29 +01:00
{
2017-05-12 04:10:43 +01:00
thdSaveAs . Abort ( ) ;
thdSaveAs = null ;
2017-05-11 14:50:29 +01:00
}
lblProgress . Visible = false ;
prgProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
prgProgress2 . Visible = false ;
treeOSes . Sensitive = true ;
btnAdd . Visible = true ;
btnRemove . Visible = true ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = true ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = true ;
btnHelp . Visible = true ;
btnSettings . Visible = true ;
btnStop . Visible = false ;
2017-05-12 04:10:43 +01:00
Workers . Failed - = SaveAsFailed ;
Workers . Finished - = SaveAsFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress - = UpdateProgress ;
Workers . UpdateProgress2 - = UpdateProgress2 ;
Context . path = null ;
} ) ;
}
2017-05-12 04:10:43 +01:00
public void SaveAsFinished ( )
2017-05-11 14:50:29 +01:00
{
Application . Invoke ( delegate
{
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
if ( thdSaveAs ! = null )
2017-05-11 14:50:29 +01:00
{
2017-05-12 04:10:43 +01:00
thdSaveAs . Abort ( ) ;
thdSaveAs = null ;
2017-05-11 14:50:29 +01:00
}
lblProgress . Visible = false ;
prgProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
prgProgress2 . Visible = false ;
treeOSes . Sensitive = true ;
btnAdd . Visible = true ;
btnRemove . Visible = true ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = true ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = true ;
btnHelp . Visible = true ;
btnSettings . Visible = true ;
btnStop . Visible = false ;
2017-05-12 04:10:43 +01:00
Workers . Failed - = SaveAsFailed ;
Workers . Finished - = SaveAsFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress - = UpdateProgress ;
2017-05-11 15:22:44 +01:00
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Info , ButtonsType . Ok ,
2017-05-12 04:10:43 +01:00
string . Format ( "Correctly saved to {0}" , Context . path ) ) ;
2017-05-11 15:22:44 +01:00
dlgMsg . Run ( ) ;
dlgMsg . Destroy ( ) ;
2017-05-11 14:50:29 +01:00
Context . path = null ;
} ) ;
}
2017-05-12 04:10:43 +01:00
protected void OnBtnHelpClicked ( object sender , EventArgs e )
{
dlgHelp _help = new dlgHelp ( ) ;
_help . Run ( ) ;
_help . Destroy ( ) ;
}
protected void OnBtnSettingsClicked ( object sender , EventArgs e )
{
dlgSettings _dlgSettings = new dlgSettings ( ) ;
_dlgSettings . Run ( ) ;
_dlgSettings . Destroy ( ) ;
}
protected void OnBtnQuitClicked ( object sender , EventArgs e )
{
OnBtnStopClicked ( sender , e ) ;
Application . Quit ( ) ;
}
protected void OnBtnStopClicked ( object sender , EventArgs e )
{
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
if ( thdPopulateOSes ! = null )
{
thdPopulateOSes . Abort ( ) ;
thdPopulateOSes = null ;
}
if ( thdCompressTo ! = null )
{
thdPopulateOSes . Abort ( ) ;
thdPopulateOSes = null ;
}
if ( thdSaveAs ! = null )
{
thdSaveAs . Abort ( ) ;
thdSaveAs = null ;
}
}
protected void OnDeleteEvent ( object sender , DeleteEventArgs e )
{
OnBtnStopClicked ( sender , e ) ;
}
protected void OnBtnCompressClicked ( object sender , EventArgs e )
2017-05-11 14:50:29 +01:00
{
TreeIter osIter ;
if ( treeOSes . Selection . GetSelected ( out osIter ) )
{
2017-05-12 04:10:43 +01:00
Context . dbInfo . id = ( long ) osView . GetValue ( osIter , 17 ) ;
2017-05-11 14:50:29 +01:00
2017-05-12 04:10:43 +01:00
FileChooserDialog dlgFolder = new FileChooserDialog ( "Compress to..." , this , FileChooserAction . Save ,
2017-05-11 14:50:29 +01:00
"Cancel" , ResponseType . Cancel , "Choose" , ResponseType . Accept ) ;
dlgFolder . SelectMultiple = false ;
if ( dlgFolder . Run ( ) = = ( int ) ResponseType . Accept )
{
2017-05-12 04:10:43 +01:00
Context . path = dlgFolder . Filename ;
2017-05-11 14:50:29 +01:00
2017-05-11 15:22:44 +01:00
dlgFolder . Destroy ( ) ;
2017-05-11 14:50:29 +01:00
lblProgress . Visible = true ;
prgProgress . Visible = true ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = true ;
prgProgress2 . Visible = true ;
2017-05-11 14:50:29 +01:00
treeOSes . Sensitive = false ;
btnAdd . Visible = false ;
btnRemove . Visible = false ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = false ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = false ;
btnHelp . Visible = false ;
btnSettings . Visible = false ;
btnStop . Visible = true ;
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
Workers . Failed + = CompressToFailed ;
Workers . Finished + = CompressToFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress + = UpdateProgress ;
2017-05-12 04:10:43 +01:00
Workers . UpdateProgress2 + = UpdateProgress2 ;
thdCompressTo = new Thread ( Workers . CompressTo ) ;
thdCompressTo . Start ( ) ;
2017-05-11 14:50:29 +01:00
}
else
dlgFolder . Destroy ( ) ;
2017-05-12 04:10:43 +01:00
}
2017-05-11 14:50:29 +01:00
}
2017-05-12 04:10:43 +01:00
public void CompressToFailed ( string text )
2017-05-11 14:50:29 +01:00
{
Application . Invoke ( delegate
{
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Error , ButtonsType . Ok , text ) ;
dlgMsg . Run ( ) ;
dlgMsg . Destroy ( ) ;
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
if ( thdCompressTo ! = null )
2017-05-11 14:50:29 +01:00
{
2017-05-12 04:10:43 +01:00
thdCompressTo . Abort ( ) ;
thdCompressTo = null ;
2017-05-11 14:50:29 +01:00
}
lblProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
prgProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
prgProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
treeOSes . Sensitive = true ;
btnAdd . Visible = true ;
btnRemove . Visible = true ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = true ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = true ;
btnHelp . Visible = true ;
btnSettings . Visible = true ;
btnStop . Visible = false ;
2017-05-12 04:10:43 +01:00
Workers . Failed - = CompressToFailed ;
Workers . Finished - = CompressToFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress - = UpdateProgress ;
2017-05-12 04:10:43 +01:00
Workers . UpdateProgress2 - = UpdateProgress2 ;
2017-05-11 14:50:29 +01:00
Context . path = null ;
} ) ;
}
2017-05-12 04:10:43 +01:00
public void CompressToFinished ( )
2017-05-11 14:50:29 +01:00
{
Application . Invoke ( delegate
{
if ( thdPulseProgress ! = null )
{
thdPulseProgress . Abort ( ) ;
thdPulseProgress = null ;
}
2017-05-12 04:10:43 +01:00
if ( thdCompressTo ! = null )
2017-05-11 14:50:29 +01:00
{
2017-05-12 04:10:43 +01:00
thdCompressTo . Abort ( ) ;
thdCompressTo = null ;
2017-05-11 14:50:29 +01:00
}
lblProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
lblProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
prgProgress . Visible = false ;
2017-05-12 04:10:43 +01:00
prgProgress2 . Visible = false ;
2017-05-11 14:50:29 +01:00
treeOSes . Sensitive = true ;
btnAdd . Visible = true ;
btnRemove . Visible = true ;
2017-05-12 04:10:43 +01:00
btnCompress . Visible = true ;
2017-05-11 14:50:29 +01:00
btnSave . Visible = true ;
btnHelp . Visible = true ;
btnSettings . Visible = true ;
btnStop . Visible = false ;
2017-05-12 04:10:43 +01:00
Workers . Failed - = CompressToFailed ;
Workers . Finished - = CompressToFinished ;
2017-05-11 14:50:29 +01:00
Workers . UpdateProgress - = UpdateProgress ;
2017-05-12 04:10:43 +01:00
Workers . UpdateProgress2 - = UpdateProgress2 ;
2017-05-11 14:50:29 +01:00
2017-05-11 15:22:44 +01:00
MessageDialog dlgMsg = new MessageDialog ( this , DialogFlags . Modal , MessageType . Info , ButtonsType . Ok ,
2017-05-12 04:10:43 +01:00
string . Format ( "Correctly compressed as {0}" , Context . path ) ) ;
2017-05-11 15:22:44 +01:00
dlgMsg . Run ( ) ;
dlgMsg . Destroy ( ) ;
2017-05-11 14:50:29 +01:00
Context . path = null ;
} ) ;
}
2017-05-11 14:49:17 +01:00
}
2017-05-11 14:50:29 +01:00
}