Example #1
0
 /**<summary>检查连接状态</summary>**/
 private bool Check()
 {
     if (!Adb.CheckPath())
     {
         Stop();
         MessageBox.Show($"\"{Adb.CurrentDevice.Model}\" {Properties.Resources.ConnectFailed}",
                         Properties.Resources.Error,
                         MessageBoxButton.OK,
                         MessageBoxImage.Error);
         Close();
     }
     return(true);
 }
Example #2
0
        /**<summary>新建</summary>**/
        private void Preview_Create(string file_name, string type)
        {
            if (!FileNameCol.IsReadOnly)
            {
                return;
            }
            AddStatus(Properties.Resources.Creating);
            FileList.Focus();
            /* 避免文件名冲突, 添加前缀 */
            while (Adb.CheckPath($"{Adb.Path}{file_name}"))
            {
                file_name = $"{Properties.Resources.New}{file_name}";
            }
            var new_file = new AFile {
                Name = file_name, Type = type
            };

            FileListData.Add(new_file);
            IsNewFile = true;
            BeginRename(new_file);
        }
        private void OpenDevice()
        {
            if (CurrentDevice == null || Opening)
            {
                return;
            }
            Opening = true;

            Dictionary <string, Configure.DeviceProp> DevicesProp = Configure.Configurer.conf.Device;

            Configure.DeviceProp DeviceProp;
            if (!DevicesProp.ContainsKey(CurrentDevice.UsbSerialNum))
            {
                DevicesProp.Add(CurrentDevice.UsbSerialNum, new Configure.DeviceProp {
                    Mod = CurrentDevice.Model
                });
            }
            DeviceProp = DevicesProp[CurrentDevice.UsbSerialNum];
            if (!DeviceProp.Mod.Equals(CurrentDevice.Model))
            {
                DeviceProp.Mod  = CurrentDevice.Model;
                DeviceProp.Path = "/";
            }
            Adb.ChangeDevice(CurrentDevice, DeviceProp.Path);

            if (Adb.CheckPath())
            {
                new FileManager().Show();
                Close();
            }
            else
            {
                MessageBox.Show(Properties.Resources.ConnectFailed,
                                Properties.Resources.Error,
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                Reflush();
            }
            Opening = false;
        }