コード例 #1
0
        public DisplayAppSettingsVM(TextEditorSettingsVM textEditorSettingsVM, FileTreeViewSettings fileTreeViewSettings, FileTabManagerSettings fileTabManagerSettings)
        {
            this.TextEditorSettings     = textEditorSettingsVM;
            this.FileTreeViewSettings   = fileTreeViewSettings;
            this.FileTabManagerSettings = fileTabManagerSettings;
            this.fontFamilies           = null;
            this.fontFamilyVM           = new FontFamilyVM(textEditorSettingsVM.FontFamily);
            Task.Factory.StartNew(() =>
                                  Fonts.SystemFontFamilies.Where(a => !FontUtilities.IsSymbol(a)).OrderBy(a => a.Source.ToUpperInvariant()).Select(a => new FontFamilyVM(a)).ToArray()
                                  )
            .ContinueWith(t => {
                var ex = t.Exception;
                if (!t.IsCanceled && !t.IsFaulted)
                {
                    FontFamilies = t.Result;
                }
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            var defObjs = typeof(MemberKind).GetEnumValues().Cast <MemberKind>().ToArray();

            this.memberKindVMs = new MemberKindVM[defObjs.Length];
            for (int i = 0; i < defObjs.Length; i++)
            {
                this.memberKindVMs[i] = new MemberKindVM(defObjs[i], ToString(defObjs[i]));
            }
            this.memberKindVMs2 = this.memberKindVMs.ToArray();

            this.MemberKind0 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind0);
            this.MemberKind1 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind1);
            this.MemberKind2 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind2);
            this.MemberKind3 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind3);
            this.MemberKind4 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind4);
        }
コード例 #2
0
ファイル: DisplaySettingsTab.cs プロジェクト: lovebanyi/dnSpy
        public DisplayAppSettingsVM(TextEditorSettings textEditorSettings, FileTreeViewSettings fileTreeViewSettings, FileTabManagerSettings fileTabManagerSettings)
        {
            this.textEditorSettings = textEditorSettings;
            this.fileTreeViewSettings = fileTreeViewSettings;
            this.fileTabManagerSettings = fileTabManagerSettings;
            this.fontFamilies = null;
            this.fontFamilyVM = new FontFamilyVM(textEditorSettings.FontFamily);
            Task.Factory.StartNew(() => {
                AppCulture.InitializeCulture();
                return Fonts.SystemFontFamilies.Where(a => !FontUtils.IsSymbol(a)).OrderBy(a => a.Source.ToUpperInvariant()).Select(a => new FontFamilyVM(a)).ToArray();
            })
            .ContinueWith(t => {
                var ex = t.Exception;
                if (!t.IsCanceled && !t.IsFaulted)
                    FontFamilies = t.Result;
            }, CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            var defObjs = typeof(MemberKind).GetEnumValues().Cast<MemberKind>().ToArray();
            this.memberKindVMs = new MemberKindVM[defObjs.Length];
            for (int i = 0; i < defObjs.Length; i++)
                this.memberKindVMs[i] = new MemberKindVM(defObjs[i], ToString(defObjs[i]));
            this.memberKindVMs2 = this.memberKindVMs.ToArray();

            this.MemberKind0 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind0);
            this.MemberKind1 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind1);
            this.MemberKind2 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind2);
            this.MemberKind3 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind3);
            this.MemberKind4 = this.memberKindVMs.First(a => a.Object == fileTreeViewSettings.MemberKind4);
        }