예제 #1
0
 public AdbFileModel(TInfo info, MInfoType infoType) : base(info, infoType)
 {
     if (MInfoTypeHelper.GetMInfoTypeBox(infoType) != MInfoTypeBox.AdbFile)
     {
         throw new ArgumentException(nameof(infoType));
     }
 }
예제 #2
0
        public static IEnumerable <TInfoModel> FromAdbInfoesToInfoModels <TInfoModel, TInfo>(IEnumerable <TInfo> infoes, MInfoType infoType)
            where TInfoModel : InfoModel
            where TInfo : IInfo
        {
            var _infoes = new List <TInfoModel>();

            try {
                if (MInfoTypeHelper.GetMInfoTypeBox(infoType) == MInfoTypeBox.AdbFile)
                {
                    switch (infoType)
                    {
                    case MInfoType.Audio:
                        return(infoes.Select(p => new AdbFileAudioModel(p as Audio) as TInfoModel));

                    case MInfoType.Video:
                        return(infoes.Select(p => new AdbFileVideoModel(p as Video) as TInfoModel));

                    case MInfoType.Image:
                        return(infoes.Select(p => new AdbFileImageModel(p as Image) as TInfoModel));
                    }
                }
                else
                {
                    switch (infoType)
                    {
                    case MInfoType.Calllog:
                        return(infoes.Select(p => new AdbCalllogModel(p as CallLog) as TInfoModel));

                    case MInfoType.GPS:
                        return(infoes.Select(p => new AdbGpsModel(p as Gps) as TInfoModel));

                    case MInfoType.Package:
                        return(infoes.Select(p => new AdbPackageModel(p as Package) as TInfoModel));

                    case MInfoType.Contact:
                        return(infoes.Select(p => new AdbContactModel(p as Contact) as TInfoModel));

                    case MInfoType.Sms:
                        return(infoes.Select(p => new AdbSmsModel(p as Sms, null) as TInfoModel));
                    }
                }
            }
            catch (Exception ex) {
                Logger.WriteLine($"{nameof(AdbModelHelper)}->{nameof(FromAdbInfoesToInfoModels)}:{ex.Message}");
            }
            return(_infoes);
        }
예제 #3
0
        public AdbGridViewModel(IDefaultPhoneInfoContainer container)
        {
            this.Container   = container;
            SelectedTabModel = InfoDetailTabModel;

            TabViewModels.Add(InfoDetailTabModel);
            SelectedTabModel = InfoDetailTabModel;

            if (MInfoTypeHelper.GetMInfoTypeBox(container.InfoType) == MInfoTypeBox.AdbFile)
            {
                TabViewModels.Add(FileHexTabViewModel);
                if (container.InfoType == MInfoType.Image)
                {
                    TabViewModels.Add(AdbPreviewViewModel);
                }
            }
        }
        public AdbInfoesCheckedViewModel() : base(1)
        {
            var mobileInfoNode = new AdbTreeUnit(LanguageService.FindResourceString("PhoneInfoAquiredItems"));
            var mobileFileNode = new AdbTreeUnit(LanguageService.FindResourceString("PhoneFileAquiredItems"));

            Action <AdbTreeUnit, MInfoType> addInfoAct = (node, tp) => {
                //对于所有文件项,将进行的特殊处理;
                if (tp == MInfoType.AllFiles)
                {
                    var child = new AdbAllFileTreeUnit(MInfoTypeHelper.GetInfoTypeWord(tp))
                    {
                        Level = 1
                    };
                    child.IsChecked = false;
                    node.Children.Add(child);
                    child.CheckStateChanged += (sender, e) => {
                        //若选中所有文件,将其他文件进行选中处理;
                        if (e ?? false)
                        {
                            foreach (var item in node.Children)
                            {
                                if (item != child)
                                {
                                    //item.IsChecked = true;
                                    //item.IsEnabled = false;
                                }
                            }
                        }
                        else
                        {
                            foreach (var item in node.Children)
                            {
                                item.IsEnabled = true;
                            }
                        }
                    };
                }
                else
                {
                    var child = new AdbInfoTreeUnit <IInfo>(tp)
                    {
                        Level = 1
                    };
                    node.Children.Add(child);
                    child.CheckStateChanged += (sender, e) => {
                        if (e != null)
                        {
                            if (e == node.IsChecked)
                            {
                                return;
                            }
                            if (node.Children.FirstOrDefault(p => p.IsChecked != e.Value) != null)
                            {
                                node.IsChecked = null;
                            }
                            else
                            {
                                node.IsChecked = e;
                            }
                        }
                    };
                }
            };

            foreach (var tp in Enum.GetValues(typeof(MInfoType)))
            {
                if ((MInfoType)tp == MInfoType.BackUp)
                {
                    var unit = new AdbBackUpFilesTreeUnit();
                    mobileFileNode.Children.Add(unit);
                }
                else
                {
                    switch (MInfoTypeHelper.GetMInfoTypeBox((MInfoType)tp))
                    {
                    case MInfoTypeBox.AdbFile:
                        addInfoAct(mobileFileNode, (MInfoType)tp);
                        break;

                    case MInfoTypeBox.AdbInfo:
                        addInfoAct(mobileInfoNode, (MInfoType)tp);
                        break;
                    }
                }
            }

            AdbUnits.Add(mobileInfoNode);
            AdbUnits.Add(mobileFileNode);
        }
예제 #5
0
 public AdbInfoTreeUnit(MInfoType tp) : base(MInfoTypeHelper.GetInfoTypeWord(tp))
 {
     this.MInfoType = tp;
 }
예제 #6
0
 public AdbBackUpFilesTreeUnit(string relPath = null) :
     base(MInfoTypeHelper.GetInfoTypeWord(MInfoType.BackUp))
 {
     this.Direct = relPath;
     this.Level  = 1;
 }