/// <summary> /// Tests the availability of the FreeImage DLL and issues a warning /// to the user if the DLL is not available. /// </summary> private void TestDllAvailability() { using (Bovender.Unmanaged.DllManager dllManager = new Bovender.Unmanaged.DllManager()) { try { Logger.Info("TestDllAvailability: Testing freeimage.dll"); dllManager.LoadDll("freeimage.dll"); } catch (Exception e) { Logger.Warn("TestDllAvailability: Failed to load DLL"); Logger.Warn(e); Ribbon.IsGraphicExportEnabled = false; if (!XLToolbox.UserSettings.UserSettings.Default.SuppressDllWarning) { Logger.Warn("TestDllAvailability: Showing warning message"); SuppressibleNotificationAction a = new SuppressibleNotificationAction(); Bovender.Mvvm.Messaging.SuppressibleMessageContent mc = new Bovender.Mvvm.Messaging.SuppressibleMessageContent(); mc.OkButtonText = XLToolbox.Strings.OK; mc.SuppressMessageText = XLToolbox.Strings.DoNotShowThisMessageAgain; mc.Caption = XLToolbox.Strings.DllNotAvailableCaption; mc.Message = XLToolbox.Strings.DllNotAvailableMessage; a.InvokeWithContent(mc); XLToolbox.UserSettings.UserSettings.Default.SuppressDllWarning = mc.Suppress; } else { Logger.Warn("TestDllAvailability: Warning message is suppressed by user"); } } } }
private void BuildCollections() { string dir = Bovender.Unmanaged.Pinvoke.GetColorDirectory(); Logger.Info("BuildCollections: Dir: {0}", dir); if (String.IsNullOrEmpty(dir)) { Logger.Fatal("BuildCollections: No color profile directory!"); throw new InvalidOperationException( "Windows did not tell color profile directory"); } using (Bovender.Unmanaged.DllManager dllManager = new Bovender.Unmanaged.DllManager()) { ColorProfileViewModel vm; ColorProfileViewModelCollection coll; dllManager.LoadDll("lcms2.dll"); foreach (string fn in System.IO.Directory.EnumerateFiles(dir, "*" + Lcms.Constants.COLOR_PROFILE_EXTENSION)) { vm = ColorProfileViewModel.CreateFromFile(fn); if (vm != null) { if (!_profiles.TryGetValue(vm.ColorSpace, out coll)) { coll = new ColorProfileViewModelCollection(); _profiles.Add(vm.ColorSpace, coll); } coll.Add(vm); } } } OnPropertyChanged("Profiles"); }
private PresetsRepository() : base() { _dllManager = new Bovender.Unmanaged.DllManager("lcms2.dll"); Presets = new ObservableCollection <Preset>() { new Preset() }; }