Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        void SetMemberKind(int index, MemberKindVM newValue)
        {
            Debug.Assert(newValue != null);
            if (newValue == null)
            {
                throw new ArgumentNullException(nameof(newValue));
            }
            if (memberKindVMs[index] == newValue)
            {
                return;
            }

            int otherIndex = Array.IndexOf(memberKindVMs, newValue);

            Debug.Assert(otherIndex >= 0);
            if (otherIndex >= 0)
            {
                memberKindVMs[otherIndex] = memberKindVMs[index];
                memberKindVMs[index]      = newValue;

                OnPropertyChanged(string.Format("MemberKind{0}", otherIndex));
            }
            OnPropertyChanged(string.Format("MemberKind{0}", index));
        }
Ejemplo n.º 3
0
        void SetMemberKind(int index, MemberKindVM newValue)
        {
            Debug.Assert(newValue != null);
            if (newValue == null)
                throw new ArgumentNullException();
            if (memberKindVMs[index] == newValue)
                return;

            int otherIndex = Array.IndexOf(memberKindVMs, newValue);
            Debug.Assert(otherIndex >= 0);
            if (otherIndex >= 0) {
                memberKindVMs[otherIndex] = memberKindVMs[index];
                memberKindVMs[index] = newValue;

                OnPropertyChanged(string.Format("MemberKind{0}", otherIndex));
            }
            OnPropertyChanged(string.Format("MemberKind{0}", index));
        }
Ejemplo n.º 4
0
		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(() =>
				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);
		}