public void StartToCleanFiles()
        {
            //m_timeElapsed = 0;
            //m_elapsedTimer.Start();
            m_iPhoneState = ManageiPhoneState.Clean;
            Dispatcher.Invoke(DispatcherPriority.Send, new Action(
                delegate()
                {
                    m_tbCount.Text = "0";
                    m_tbSize.Text = "0";
                    m_tbElapsed.Text = "00:00";
                }
                ));
            m_cleanTimer.Start();

            Console.WriteLine(m_totalSize + "--------------beginTotalSize");
            Console.WriteLine(m_totalCount + "--------------beginTotalCount");

            for(int i = 0;i < m_selectList.Count;i++)
            {
                m_IScanDeviceEx = m_IScanDeviceList[i];
                m_IScanDeviceEx.StartToClean();
                m_scanIndex = i;
                if (m_IScanDeviceEx.IsFinishScan())
                {
                    UInt64 size = 0;
                    int count = 0;
                    string fileSize = m_IScanDeviceEx.GetProcessInfo("fileSize");
                    string fileCount = m_IScanDeviceEx.GetProcessInfo("fileCount");
                    UInt64.TryParse(fileSize, out size);
                    Int32.TryParse(fileCount, out count);
                    Console.WriteLine(m_selectList[i].FileSize + "++++++++++++++++size");
                    Console.WriteLine(m_selectList[i].FileCount + "++++++++++++++++++count");
                    m_totalSize = m_totalSize - m_selectList[i].FileSize;
                    if (m_totalSize < 0)
                        m_totalSize = 0;
                    m_totalCount = m_totalCount - m_selectList[i].FileCount;
                    if (m_totalCount < 0)
                        m_totalCount = 0;
                    m_selectList[i].FileSize = size;
                    m_selectList[i].FileCount = count;
                    Console.WriteLine(m_totalSize + "--------------totalSize");
                    Console.WriteLine(m_totalCount + "--------------totalCount");

                    //Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                    //    delegate()
                    //    {
                    //        m_tbSize.Text = StringToSize(m_totalSize);
                    //        m_tbCount.Text = m_totalCount.ToString();
                    //    }
                    //    ));

                    this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                        {
                            m_tbSize.Text = StringToSize(m_totalSize);
                            m_tbCount.Text = m_totalCount.ToString();
                        }
                    );
                }                                
            }
            
            if(m_haveToBackUp == true)
            {
                m_IDeviceBackUpEx.DeepCleanFinish();
                Tips = "Restoring data. Please do not disconnect device in the process of restore.";
                BeginToRestore();
                m_timeElapsed = 0;
                m_elapsedTimer.Start();
                m_restoreTimer.Start();
            }
        }
        private void BeginToScanFiles()
        {
            m_IScanDeviceEx = new IScanDeviceEx(m_deviceID);
            m_IScanDeviceEx.InitScanDevice(); 
            //if (m_SelectScanList != null)
            //    m_SelectScanList.Clear();
            //m_SelectScanList = m_clearFileView.GetSelectFileList();
            m_totalCount = 0;
            m_totalSize = 0;
            m_scanTimer.Start();
//            m_detailView.StartTimer();
            string tips = "";
            string iconImage = "";
            if (m_SelectScanList.Count != 0)
            {
                ScanItemType itemType = new ScanItemType();
                for (int i = 0; i < m_SelectScanList.Count;i++ )
                {
                    if (m_isStopScan)
                        break;

                    m_scanIndex = i;
                    var file = m_SelectScanList[i];
                    Console.WriteLine(file.FileName + "-----------------");
                    switch (file.FileName)
                    {
                        case "Log files":
                            itemType = ScanItemType.CrashLogs;
                            tips = "Quick scan and clean up log files.";
                            iconImage = "Image/icon_Log_Files_top.png";
                            break;
                        case "Photo & Video cache files":
                            itemType = ScanItemType.PhotoCaches;
                            tips = "Quick scan and clean up photo & video cache files.";
                            iconImage = "Image/icon_Tips.png";
                            break;
                        case "iTunes sync cached files":
                            itemType = ScanItemType.RadioTemp;
                            tips = "Remove cache files generated in the process of iTunes sync.";
                            iconImage = "Image/icon_Tuneup.png";
                            break;
                        case "Download temp files":
                            itemType = ScanItemType.Downloads;
                            tips = "Clean up temp files created when download apps,files,etc.";
                            iconImage = "Image/icon_Erase_all_data.png";
                            break;
                        case "App generated junk files":
                            itemType = ScanItemType.AppCaches;
                            tips = "Clean up junk files created during the usage of apps.";
                            iconImage = "Image/icon_Deep_cleanup.png";
                            break;
                        case "User Storage junk files":
                            itemType = ScanItemType.UserStorage;
                            tips = "Clean up junk files saved in internal or external.";
                            iconImage = "Image/icon_Backup_Restore.png";
                            break;
                        case "Safari cache files":
                            itemType = ScanItemType.WebAppCookies;                 //DeepScan,需要另外处理
                            tips = "Empty Safari cache and all webpage preview image.";
                            iconImage = "Image/icon_Files_Manager.png";
                            break;
                        case "Safari history":
                            itemType = ScanItemType.SafariHistory;                  //DeepScan,需要另外处理
                            tips = "Clean up the Safari web browsing history.";
                            iconImage = "Image/icon_fix_ios_stuck.png";
                            break;
                        case "Safari Cookies":
                            itemType = ScanItemType.Cookies;                        //DeepScan,需要另外处理
                            tips = "Remove user's identify,login,etc.saved in Safari.";
                            iconImage = "Image/icon_iOS_Ads_Remover.png";
                            break;
                        case "Call history":
                            itemType = ScanItemType.CallingHistory;                 //DeepScan,需要另外处理
                            tips = "Clean up the call or FaceTime history.";
                            iconImage = "Image/icon_Speedup_clean.png";
                            break;
                        case "Message":
                            itemType = ScanItemType.MSM;                            //DeepScan,需要另外处理
                            tips = "Delete messages and correlative attached files in iMessage and SMS.";
                            iconImage = "Image/icon_Backup_Restore.png";
                            break;
                        case "iOS system junk files":
                            itemType = ScanItemType.SurplusFiles;                    //DeepScan,需要另外处理
                            tips = "Clean up iOS system files that have been discarded or ignored.";
                            iconImage = "Image/icon_Files_Manager.png";
                            break;
                        default:
                            break;
                    }
                    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                        delegate()
                        {
                            m_tbFileName.Text = file.FileName;
                            m_tbTips.Text = tips;
                            BitmapImage bitImage = new BitmapImage(new Uri(iconImage, UriKind.Relative));
                            m_iconImg.Source = bitImage;
                        }
                        ));

                    int hsdj = (int)itemType;
                    Console.WriteLine(hsdj.ToString() + "---------------dlkasd");

                    if (file.FileName.Equals("App generated junk files"))
                    {
                        for (int j = (int)itemType; j < (int)ScanItemType.AppTempFiles+1; j++)
                        {
                            if (m_isStopScan)
                                break;
                            ScanDevice(j);
                            //m_IScanDeviceEx.StartScan(j);
                            //if (m_IScanDeviceEx.IsFinishScan())
                            //{
                            //    UInt64 size = 0;
                            //    int count = 0;
                            //    string fileSize = m_IScanDeviceEx.GetProcessInfo("fileSize");
                            //    string fileCount = m_IScanDeviceEx.GetProcessInfo("fileCount");
                            //    UInt64.TryParse(fileSize, out size);
                            //    Int32.TryParse(fileCount, out count);
                            //    m_SelectScanList[i].FileSize += size;
                            //    m_SelectScanList[i].FileCount += count;
                            //    m_totalSize += size;
                            //    m_totalCount += count;
                            //    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                            //        delegate()
                            //        {
                            //            m_detailView.SetFileSizeAndCount(m_totalSize, m_totalCount);
                            //        }
                            //        ));

                            //}

                            
                        }
                    }
                    //else if (m_scanItemType >= (int)ScanItemType.CallingHistory && m_scanItemType <= (int)ScanItemType.SpeedUp)
                    //{
                    //    if(!m_iSBackUp)
                    //    {
                    //        m_backUpTimer.Start();
                    //        StartToBackUp();
                    //    }
                    //    else
                    //    {
                    //        ScanDevice(m_scanItemType);
                    //    }
                    //}
                    else {
                        ScanDevice( (int)itemType );
                        //m_IScanDeviceEx.StartScan((int)itemType);
                        ////int hsdj = (int)itemType;
                        ////Console.WriteLine(hsdj.ToString() + "---------------dlkasd");
                        //if (m_IScanDeviceEx.IsFinishScan())
                        //{
                        //    UInt64 size = 0;
                        //    int count = 0;
                        //    string fileSize = m_IScanDeviceEx.GetProcessInfo("fileSize");
                        //    string fileCount = m_IScanDeviceEx.GetProcessInfo("fileCount");
                        //    UInt64.TryParse(fileSize, out size);
                        //    Int32.TryParse(fileCount, out count);
                        //    m_SelectScanList[i].FileSize = size;
                        //    m_SelectScanList[i].FileCount = count;
                        //    m_totalSize += size;
                        //    m_totalCount += count;
                        //    Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
                        //        delegate()
                        //        {
                        //            m_detailView.SetFileSizeAndCount(m_totalSize, m_totalCount);
                        //        }
                        //        ));


                        //}
                    }


                }

            }

            //Dispatcher.Invoke(DispatcherPriority.Normal, new Action(
            //    delegate()
            //    {
            //        m_btnBack.IsEnabled = true;
            //        m_btnStopScan.IsEnabled = false;
            //        m_clearFileView.SetFileSize();
            //    }
            //    ));

            //m_scanTimer.Stop();
            //m_detailView.StopTimer();
        }
        private void BeginToScanFiles()
        {
            //m_IScanDeviceEx = new IScanDeviceEx(m_deviceID);
            //m_IScanDeviceEx.InitScanDevice();
            m_totalCount = 0;
            m_totalSize = 0;
            m_scanTimer.Start();
            m_iPhoneState = ManageiPhoneState.Scan;
            m_IScanDeviceList.Clear();
            bool initScan = false;
            
            if (m_selectList.Count != 0)
            {
                _365Care.ScanItemType itemType = new _365Care.ScanItemType();
                for (int i = 0; i < m_selectList.Count; i++)
                {
                    if (m_isStopScan)
                        break;

                    IScanDeviceEx IScanDeviceEx = new IScanDeviceEx(m_deviceID);
                    m_IScanDeviceEx = IScanDeviceEx;
                    if(initScan == false)
                    {
                        IScanDeviceEx.InitScanDevice();
                        initScan = true;
                    }
                    m_IScanDeviceList.Add(IScanDeviceEx);

                    m_scanIndex = i;
                    var file = m_selectList[i];
                    Console.WriteLine(file.FileName + "-----------------");
                    switch (file.FileName)
                    {
                        case "Log files":
                            itemType = _365Care.ScanItemType.CrashLogs;
                            Tips = "Log files";
                            break;
                        case "Photo & Video caches":
                            itemType = _365Care.ScanItemType.PhotoCaches;
                            Tips = "Photo & Video caches";
                            break;
                        case "iTunes radio caches":
                            itemType = _365Care.ScanItemType.RadioTemp;
                            Tips = "iTunes radio caches";
                            break;
                        case "Download temp files":
                            itemType = _365Care.ScanItemType.Downloads;
                            Tips = "Download temp files";
                            break;
                        case "App generated junk files":
                            itemType = _365Care.ScanItemType.AppCaches;
                            Tips = "App generated junk files";
                            break;
                        case "User Storage junk files":
                            itemType = _365Care.ScanItemType.UserStorage;
                            Tips = "User Storage junk files";
                            break;
                        case "Safari cache files":
                            itemType = _365Care.ScanItemType.WebAppCookies;
                            Tips = "Safari cache files";
                            break;
                        case "Safari history":
                            itemType = _365Care.ScanItemType.SafariHistory;
                            Tips = "Safari history";
                            break;
                        case "Safari Cookies":
                            itemType = _365Care.ScanItemType.Cookies;
                            Tips = "Safari Cookies";
                            break;
                        case "Call history":
                            itemType = _365Care.ScanItemType.CallingHistory;
                            Tips = "Call history";
                            break;
                        case "Message":
                            itemType = _365Care.ScanItemType.MSM;
                            Tips = "Message";
                            break;
                        case "iOS system junk files":
                            itemType = _365Care.ScanItemType.SurplusFiles;
                            Tips = "iOS system junk files";
                            break;
                        case "iOS notifications":
                            itemType = _365Care.ScanItemType.Notifications;
                            Tips = "iOS notifications";
                            break;
                        case "Active apps":
                            itemType = _365Care.ScanItemType.BackgroundRunningApps;
                            Tips = "Active apps";
                            break;
                        case "App residual files":
                            itemType = _365Care.ScanItemType.AppRemainFiles;
                            Tips = "App residual files";
                            break;
                        case "Webmail caches":
                            itemType = _365Care.ScanItemType.WebmailCaches;
                            Tips = "Webmail caches";
                            break;
                        case "iOS tune-up":
                            itemType = _365Care.ScanItemType.SpeedUp;
                            Tips = "iOS tune-up";
                            break;
                        default:
                            break;
                    }

                    //if (file.FileName.Equals("App generated junk files"))
                    //{
                    //    for (int j = (int)itemType; j < (int)_365Care.ScanItemType.AppTempFiles + 1; j++)
                    //    {
                    //        if (m_isStopScan)
                    //            break;
                    //        ScanDevice(j);
                    //    }
                    //}
                    //else if(file.FileName.Equals("iOS tune-up"))
                    //{
                    //    continue;
                    //}
                    //else
                    //{
                    //    ScanDevice((int)itemType);
                    //}
                    ScanDevice((int)itemType);

                }

            }

        }