Esempio n. 1
0
 public void EntryPoint()
 {
     using (ui)
     {
         ui.Show();
         Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
         fileDialog.Reset();
         fileDialog.Title         = this.RxGetClassText("title");
         fileDialog.Filter        = this.RxGetClassText("filter");
         fileDialog.Multiselect   = true;
         executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text);
         ui.WriteLineToDetails(this.RxGetClassText("waiting"));
         if (fileDialog.ShowDialog() != true)
         {
             ui.EShutdown();
         }
         List <FileInfo> files = new List <FileInfo>();
         foreach (string fileName in fileDialog.FileNames)
         {
             files.Add(new FileInfo(fileName));
         }
         var result = Install(files);
         if (result.Item3 == 0)
         {
             ui.Finish(StatusMessages.PossibleSuccess);
         }
         else
         {
             ui.Finish(StatusMessages.Failed);
         }
     }
 }
Esempio n. 2
0
        public void EntryPoint(ILeafUI _ui, IDevice device, ICommandExecutor _executor)
        {
            using var ui       = _ui;
            using var executor = _executor;
            var text = ClassTextReaderCache.Acquire <EFilePusher>();

            ui.Show();
            bool?  dialogResult = null;
            string selectedFile = null;

            ui.RunOnUIThread(() =>
            {
                Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
                fileDialog.Reset();
                fileDialog.Title       = text["title"];
                fileDialog.Filter      = text["filter"];
                fileDialog.Multiselect = false;
                dialogResult           = fileDialog.ShowDialog();
                selectedFile           = fileDialog.FileName;
            });

            if (dialogResult != true)
            {
                ui.EShutdown();
            }
            FileInfo fileInfo = new FileInfo(selectedFile);

            executor.OutputReceived += (s, e) => ui.WriteLineToDetails(e.Text);
            var result = executor.Adb(device, $"push \"{fileInfo.FullName}\" \"/sdcard/{fileInfo.Name}\"");

            ui.Finish(result.ExitCode == 0 ? StatusMessages.Success : StatusMessages.Failed);
        }
Esempio n. 3
0
 public void EntryPoint()
 {
     using (UI)
     {
         UI.Title = this.GetName();
         UI.Icon  = this.GetIconBytes();
         UI.Show();
         Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
         fileDialog.Reset();
         fileDialog.Title       = Text["title"];
         fileDialog.Filter      = Text["filter"];
         fileDialog.Multiselect = true;
         UI.WriteLine(Text["waiting"]);
         if (fileDialog.ShowDialog() != true)
         {
             UI.EShutdown();
         }
         List <FileInfo> files = new List <FileInfo>();
         foreach (string fileName in fileDialog.FileNames)
         {
             files.Add(new FileInfo(fileName));
         }
         Install(files);
         UI.Finish(0);
     }
 }
Esempio n. 4
0
 public void EntryPoint(ILeafUI ui, IDevice device, IClassTextDictionary text)
 {
     using (ui)
     {
         ui.Title = this.GetName();
         ui.Show();
         bool?  dialogResult = null;
         string seleFile     = null;
         ui.RunOnUIThread(() =>
         {
             Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
             fileDialog.Reset();
             fileDialog.Title       = text["title"];
             fileDialog.Filter      = text["filter"];
             fileDialog.Multiselect = false;
             dialogResult           = fileDialog.ShowDialog();
             seleFile = fileDialog.FileName;
         });
         if (dialogResult != true)
         {
             ui.EShutdown();
         }
         FileInfo        fileInfo = new FileInfo(seleFile);
         CommandExecutor executor = new CommandExecutor();
         executor.OutputReceived += (s, e) => ui.WriteLine(e.Text);
         var result = executor.Adb(device, $"push \"{fileInfo.FullName}\" \"/sdcard/{fileInfo.Name}\"");
         ui.Finish(result.ExitCode);
     }
 }
Esempio n. 5
0
 protected override int VisualMain()
 {
     Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
     fileDialog.Reset();
     fileDialog.Title       = Res("EApkInstallerSelectingTitle");
     fileDialog.Filter      = Res("EApkInstallerSelectingFilter");
     fileDialog.Multiselect = true;
     WriteLineAndSetTip(MsgWaitingForUser);
     if (fileDialog.ShowDialog() == true)
     {
         WriteLineAndSetTip(MsgRunning);
         List <FileInfo> files = new List <FileInfo>();
         foreach (string fileName in fileDialog.FileNames)
         {
             files.Add(new FileInfo(fileName));
         }
         Install(files);
     }
     else
     {
         FinishedTip = MsgCancelledByUser;
         return(ERR);
     }
     return(exitCodeOnInstalling);
 }
Esempio n. 6
0
        public void InstallApk(DeviceBasicInfo targetDevice)
        {
            Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
            fileDialog.Reset();
            fileDialog.Title       = App.Current.Resources["SelecteAFile"].ToString();
            fileDialog.Filter      = "安卓安装包ApkFile(*.apk)|*.apk";
            fileDialog.Multiselect = true;

            if (fileDialog.ShowDialog() == true)
            {
                ApkInstaller    installer = new ApkInstaller();
                List <FileInfo> files     = new List <FileInfo>();
                foreach (string fileName in fileDialog.FileNames)
                {
                    files.Add(new FileInfo(fileName));
                }
                var args = new ApkInstallerArgs()
                {
                    DevBasicInfo = targetDevice,
                    Files        = files,
                };
                installer.Init(args);
                new ApkInstallingWindow(installer, files).ShowDialog();
            }
            else
            {
                return;
            }
        }
Esempio n. 7
0
 public void PushFile(DeviceBasicInfo targetDeivce)
 {
     Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
     fileDialog.Reset();
     fileDialog.Title       = App.Current.Resources["SelecteAFile"].ToString();
     fileDialog.Filter      = "刷机包/压缩包文件(*.zip)|*.zip|镜像文件(*.img)|*.img|全部文件(*.*)|*.*";
     fileDialog.Multiselect = false;
     if (fileDialog.ShowDialog() == true)
     {
         var args = new FilePusherArgs()
         {
             DevBasicInfo = targetDeivce,
             SourceFile   = fileDialog.FileName,
         };
         var pusher = new FilePusher();
         pusher.Init(args);
         pusher.MustTiggerAnyFinishedEvent = true;
         pusher.RunAsync();
         new FileSendingWindow(pusher).ShowDialog();
     }
     else
     {
         return;
     }
 }
Esempio n. 8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog
            {
                FileName    = "",
                Title       = "Select Files to Rename..",
                Filter      = " All Files... (*.*)|*.*",
                Multiselect = true
            };

            string concatenatedFilenames = "";

            if (dialog.ShowDialog() == true)
            {
                filenames.Clear();
                foreach (string filename in dialog.FileNames)
                {
                    concatenatedFilenames += filename + "\n";
                    filenames.Add(filename);
                }

                FileListTextBlock.Text = concatenatedFilenames;
                dialog.Reset();
            }
        }
Esempio n. 9
0
        /* 파일 메뉴(File Menu) -> 열기(Open) */
        private void ActionMenuOpen(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.DefaultExt = ".jpeg";
            dlg.Filter     = "Image Files|*.jpeg;*.jpg;*.gif;*.bmp;*.png";

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                menu_analyze.IsEnabled = true;
                menu_close.IsEnabled   = true;
                menu_similar.IsEnabled = true;
                menu_contour.IsEnabled = true;
                mMainImage             = new BitmapImage();
                mMainImage.BeginInit();
                mMainImage.UriSource = new Uri(dlg.FileName);
                mMainImage.EndInit();
                image.Source  = mMainImage;
                mWidthOrigin  = mMainImage.Width;
                mHeightOrigin = mMainImage.Height + Constants.OPTIMIZER_UD_MARGIN;
                ActionMenuWindowOptimize();
                mIsChangedImage = true;
                MyLog.LogManager.Log("Main-이미지 불러옴");
            }
            dlg.Reset();
        }
        private void ExecuteBrowsePoolData()
        {
            _browseDialog.Reset();
            _browseDialog.DefaultExt      = ".txt";
            _browseDialog.Filter          = "txt file |*.txt";
            _browseDialog.CheckPathExists = false;
            Nullable <bool> result = _browseDialog.ShowDialog();

            if (true == result)
            {
                this.TaskFileName   = _browseDialog.FileName;
                EnableGetTaskButton = true;
            }
        }
Esempio n. 11
0
 private void ButtonPushFileToSdcard_Click(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
     fileDialog.Reset();
     fileDialog.Title       = App.Current.Resources["SelecteAFile"].ToString();
     fileDialog.Filter      = "刷机包/压缩包文件(*.zip)|*.zip|镜像文件(*.img)|*.img|全部文件(*.*)|*.*";
     fileDialog.Multiselect = false;
     if (fileDialog.ShowDialog() == true)
     {
         var args = new FilePusherArgs()
         {
             DevBasicInfo = _currentDevInfo,
             SourceFile   = fileDialog.FileName,
         };
         var pusher = new FilePusher();
         pusher.RunAsync(args);
         new FileSendingWindow(pusher).ShowDialog();
     }
 }
Esempio n. 12
0
 public void FlashBoot(DeviceBasicInfo targetDevice)
 {
     Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
     fileDialog.Reset();
     fileDialog.Title       = App.Current.Resources["SelecteAFile"].ToString();
     fileDialog.Filter      = "镜像文件(*.img)|*.img";
     fileDialog.Multiselect = false;
     if (fileDialog.ShowDialog() == true)
     {
         var flasherArgs = new DeviceImageFlasherArgs()
         {
             DevBasicInfo = targetDevice,
             ImageType    = DeviceImage.Boot,
             SourceFile   = fileDialog.FileName,
         };
         DeviceImageFlasher flasher = new DeviceImageFlasher();
         flasher.Init(flasherArgs);
         flasher.RunAsync();
         BoxHelper.ShowLoadingDialog(flasher);
     }
 }
Esempio n. 13
0
        /* 파일 메뉴(File Menu) -> 열기(Open) */
        private void Open_click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.DefaultExt = ".jpeg";
            dlg.Filter     = "JPEG/JPG Files (*.jpeg, *.jpg)|*.jpeg;*.jpg|GIF Files (*.gif)|*.gif|Bitmap Files (*.bmp)|*.bmp|PNG Files (*.png)|*.png";

            Nullable <bool> result = dlg.ShowDialog();

            if (result == true)
            {
                menu_analyze.IsEnabled = true;
                menu_close.IsEnabled   = true;
                mainImage = new BitmapImage();
                mainImage.BeginInit();
                mainImage.UriSource = new Uri(dlg.FileName);
                mainImage.EndInit();
                image.Source  = mainImage;
                width_backup  = mainImage.Width;
                height_backup = mainImage.Height;
                Window_Optimizer();
                change_image = true;
            }
            dlg.Reset();
        }
Esempio n. 14
0
        protected override int VisualMain()
        {
            new Thread(ReadingLoop).Start();
            bool?  dialogResult = null;
            string seleFile     = null;

            App.RunOnUIThread(() =>
            {
                Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
                fileDialog.Reset();
                fileDialog.Title       = Res("EFilePusherSelectingTitle");
                fileDialog.Filter      = Res("EFilePusherSelectingFilter");
                fileDialog.Multiselect = false;
                dialogResult           = fileDialog.ShowDialog();
                seleFile = fileDialog.FileName;
            });
            FileInfo fileInfo = new FileInfo(seleFile);

            if (dialogResult != true)
            {
                return(ERR_CANCELED_BY_USER);
            }
            try
            {
                return(GetDeviceAdbCommand($"push \"{fileInfo.FullName}\" \"/sdcard/{fileInfo.Name}\"")
                       .To(OutputPrinter)
                       .Execute()
                       .ExitCode);
            }
            catch (Exception ex)
            {
                Logger.Warn("file pushing failed", ex);
                WriteLineAndSetTip(Res("EFilePusherFailed"));
                return(ERR);
            }
        }
Esempio n. 15
0
 /// <summary>
 /// すべての値を初期化します.
 /// </summary>
 public void Reset()
 {
     dialog.Reset();
 }
Esempio n. 16
0
 public void Reset()
 {
     fileDialog.Reset();
 }