public PushDialog ( List |
||
files | List |
|
destPath | string | |
return | DialogResult |
public void Push( System.IO.FileInfo file, string remote ) { var transfer = new TransferDialog ( ); transfer.PushDialog ( file, remote); }
public void Push( List<System.IO.FileInfo> files, string destPath ) { var transfer = new TransferDialog ( ); transfer.PushDialog ( files, destPath ); }
private void applyROMUpdateToolStripMenuItem_Click( object sender, EventArgs e ) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog ( ); ofd.Title = "Select ROM Update .zip"; //ofd.RestoreDirectory = true; ofd.Multiselect = false; //ofd.InitialDirectory = Environment.GetFolderPath ( Environment.SpecialFolder.Desktop ); ofd.Filter = "Zip Files|*.zip"; ofd.FilterIndex = 0; if ( ofd.ShowDialog ( this ) == DialogResult.OK ) { var transfer = new TransferDialog ( ); if ( transfer.PushDialog ( new System.IO.FileInfo ( ofd.FileName ), "/sdcard/update.zip" ) == DialogResult.OK ) { TaskDialog.ShowTaskDialogBox ( "Apply Update?", "Do you want to apply the uploaded update now?", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Reboot device to apply update now|Reboot in recovery but do not apply|Do not apply update now", TaskDialogButtons.None, SysIcons.Question, SysIcons.Information ); if ( TaskDialog.CommandButtonResult == 0 ) { // apply now CommandRunner.Instance.ApplyUpdate ( ); } else if ( TaskDialog.CommandButtonResult == 1 ) { CommandRunner.Instance.RebootRecovery ( ); } } else { if ( transfer.TransferException != null ) { // was there an error while transfering? TaskDialog.MessageBox ( "Transfer Error", transfer.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error ); } } } }
private void copyToDeviceToolStripButton_Click( object sender, EventArgs e ) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog ( ); ofd.Title = "Select files to copy"; ofd.Filter = "All Files (*.*)|*.*"; ofd.FilterIndex = 0; ofd.CheckFileExists = true; ofd.Multiselect = true; //ofd.InitialDirectory = Environment.GetFolderPath ( Environment.SpecialFolder.Desktop ); if ( ofd.ShowDialog ( this ) == DialogResult.OK ) { if ( ofd.FileNames != null && ofd.FileNames.Length > 0 ) { List<System.IO.FileInfo> files = new List<System.IO.FileInfo> ( ); foreach ( var item in ofd.FileNames ) { files.Add ( new System.IO.FileInfo ( item ) ); } var tf = new TransferDialog ( ); if ( tf.PushDialog ( files, this.CurrentDirectory.FullName ) != DialogResult.OK ) { if ( tf.TransferException != null ) { // was there an error while transfering? TaskDialog.MessageBox ( "Transfer Error", tf.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error ); } } else { NavigateToPath ( this.CurrentDirectory ); } } } }
private void flashRecoveryImageToolStripMenuItem_Click( object sender, EventArgs e ) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog ( ); ofd.Title = "Select Recovery Image"; ofd.Filter = "Recovery Images|*.img|All Files (*.*)|*.*"; ofd.FilterIndex = 0; //ofd.InitialDirectory = Environment.GetFolderPath ( Environment.SpecialFolder.Desktop ); //ofd.RestoreDirectory = true; ofd.Multiselect = false; if ( ofd.ShowDialog ( this ) == DialogResult.OK ) { string recoveryImage = string.Format ( "/sdcard/{0}", System.IO.Path.GetFileName ( ofd.FileName ) ); var tf = new TransferDialog ( ); if ( tf.PushDialog ( new System.IO.FileInfo ( ofd.FileName ), recoveryImage ) != DialogResult.OK ) { TaskDialog.ShowTaskDialogBox ( "Flash Recovery Image?", "Recovery image has been transfered to device.", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, "Flash image now|Do not do not flash image now", TaskDialogButtons.None, SysIcons.Question, SysIcons.Information ); if ( TaskDialog.CommandButtonResult == 0 ) { // apply now try { CommandRunner.Instance.FlashImage ( recoveryImage ); TaskDialog.MessageBox ( "Flash Complete", "The recovery image was successfully flashed to the device.", string.Empty, TaskDialogButtons.OK, SysIcons.Information ); } catch ( Exception ex ) { TaskDialog.MessageBox ( "Flash Error", ex.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error ); } } } else { if ( tf.TransferException != null ) { // was there an error while transfering? TaskDialog.MessageBox ( "Transfer Error", tf.TransferException.Message, string.Empty, TaskDialogButtons.OK, SysIcons.Error ); } } } }