Esempio n. 1
0
 public static NormalIcon Instance()
 {
     if (instance == null)
     {
         instance = new NormalIcon();
     }
     return(instance);
 }
Esempio n. 2
0
        public static BitmapSource GetBitmapSource(bool isSmallIcon)
        {
            IntPtr hbitmap;

            if (isSmallIcon)
            {
                hbitmap = SmallIcon.ToBitmap().GetHbitmap();
            }
            else
            {
                hbitmap = NormalIcon.ToBitmap().GetHbitmap();
            }
            return(System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hbitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()));
        }
        public ViewDownloadSetterViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;

            #region 属性初始化

            Title = DictionaryResource.GetString("DownloadSetter");

            CloudDownloadIcon      = NormalIcon.Instance().CloudDownload;
            CloudDownloadIcon.Fill = DictionaryResource.GetColor("ColorPrimary");

            FolderIcon      = NormalIcon.Instance().Folder;
            FolderIcon.Fill = DictionaryResource.GetColor("ColorPrimary");

            // 下载内容
            VideoContentSettings videoContent = SettingsManager.GetInstance().GetVideoContent();

            DownloadAudio    = videoContent.DownloadAudio;
            DownloadVideo    = videoContent.DownloadVideo;
            DownloadDanmaku  = videoContent.DownloadDanmaku;
            DownloadSubtitle = videoContent.DownloadSubtitle;
            DownloadCover    = videoContent.DownloadCover;

            if (DownloadAudio && DownloadVideo && DownloadDanmaku && DownloadSubtitle && DownloadCover)
            {
                DownloadAll = true;
            }
            else
            {
                DownloadAll = false;
            }

            // 历史下载目录
            DirectoryList = SettingsManager.GetInstance().GetHistoryVideoRootPaths();
            string directory = SettingsManager.GetInstance().GetSaveVideoRootPath();
            if (!DirectoryList.Contains(directory))
            {
                ListHelper.InsertUnique(DirectoryList, directory, 0);
            }
            Directory = directory;

            // 是否使用默认下载目录
            IsDefaultDownloadDirectory = SettingsManager.GetInstance().IsUseSaveVideoRootPath() == AllowStatus.YES;

            #endregion
        }