public SampleDataApiController(UiViewModel viewModel, IUiService uiService) { Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name); _viewModel = viewModel; _uiService = uiService; }
public GpsSelectionPageViewModel(IUiService uiService) : base(uiService) { Latitude = DefaultLatitude; Longitude = DefaultLongitude; DisplayName = "Location details"; }
public UiViewModel(IErrorRepository errorRepository, ILogMessageRepository logMessageRepository, IUiService uiService) { Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name); _errorRepository = errorRepository; _logMessageRepository = logMessageRepository; _uiService = uiService; }
public ManagePageViewModel(IUiService uiService) : base(uiService) { DisplayName = "Where Am I"; Waypoints savedWaypoints = null; Task.Run(() => savedWaypoints = _repository.LoadAsync().Result).Wait(); WaypointList = new ObservableCollection<Waypoint>(savedWaypoints.ToArray()); EditSelectedItemCommand = new DelegateCommand(OnEditSelectedItem); DeleteSelectedItemCommand = new DelegateCommand(OnDeleteSelectedItem); }
public NavigatePageViewModel(IUiService uiService) : base(uiService) { DisplayName = "Navigate to ..."; CurrentLocation = new Waypoint() { CreatedDate = DateTime.Now, Description = "bla bla", Id = -4, Position = new GPSPosition() { Latitude = 41, Longitude = 42 } }; }
public void SetUp() { _uiServiceStub = MockRepository.GenerateStub<IUiService>(); // see http://stackoverflow.com/questions/3444581/mocking-com-interfaces-using-rhino-mocks // Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add (typeof (TypeIdentifierAttribute)); _optionTasksStub = MockRepository.GenerateStub<IOptionTasks>(); _viewModel = new OptionsCollectionViewModel( new Contracts.GeneralOptions(), MockRepository.GenerateStub<IOutlookAccountPasswordProvider>(), new string[0], id => @"A:\bla", _uiServiceStub, _optionTasksStub); }
public OptionsCollectionViewModel ( GeneralOptions generalOptions, IOutlookAccountPasswordProvider outlookAccountPasswordProvider, IReadOnlyList<string> availableEventCategories, Func<Guid, string> profileDataDirectoryFactory, IUiService uiService, IOptionTasks optionTasks) { _optionTasks = optionTasks; _profileDataDirectoryFactory = profileDataDirectoryFactory; _uiService = uiService; if (generalOptions == null) throw new ArgumentNullException (nameof (generalOptions)); if (profileDataDirectoryFactory == null) throw new ArgumentNullException (nameof (profileDataDirectoryFactory)); if (optionTasks == null) throw new ArgumentNullException(nameof(optionTasks)); _generalOptions = generalOptions; _optionsViewModelFactory = new OptionsViewModelFactory ( this, outlookAccountPasswordProvider, availableEventCategories, optionTasks); AddCommand = new DelegateCommand (_ => Add()); AddMultipleCommand = new DelegateCommand (_ => AddMultiple()); CloseCommand = new DelegateCommand (shouldSaveNewOptions => Close((bool)shouldSaveNewOptions)); DeleteSelectedCommand = new DelegateCommandHandlingRequerySuggested (_ => DeleteSelected (), _ => CanDeleteSelected); CopySelectedCommand = new DelegateCommandHandlingRequerySuggested (_ => CopySelected (), _ => CanCopySelected); MoveSelectedUpCommand = new DelegateCommandHandlingRequerySuggested (_ => MoveSelectedUp (), _ => CanMoveSelectedUp); MoveSelectedDownCommand = new DelegateCommandHandlingRequerySuggested (_ => MoveSelectedDown (), _ => CanMoveSelectedDown); OpenProfileDataDirectoryCommand = new DelegateCommandHandlingRequerySuggested (_ => OpenProfileDataDirectory (), _ => CanOpenProfileDataDirectory); ExpandAllCommand = new DelegateCommandHandlingRequerySuggested (_ => ExpandAll (), _ => _options.Count > 0); CollapseAllCommand = new DelegateCommandHandlingRequerySuggested (_ => CollapseAll (), _ => _options.Count > 0); ExportAllCommand = new DelegateCommandHandlingRequerySuggested (_ => ExportAll (), _ => _options.Count > 0); ImportCommand = new DelegateCommandHandlingRequerySuggested (_ => Import (), _ => true); }
public MainPageViewModel(IUiService uiService, MenuBarViewModel menuBarViewModel) : base(uiService) { AddLocationsPopup = menuBarViewModel; IsAddLocationsPopupVisible = false; LoadAddLocationsPopupMenuItems(); DisplayName = "Where Am I"; WaypointsRepository repository = WaypointsRepositoryFactory.Create(); Waypoints waypoints = new Waypoints(); waypoints.Add(CreateWaypoint()); Waypoints savedWaypoints = null; Task.Run(() => savedWaypoints = repository.LoadAsync().Result).Wait(); //TODO: Delete!!! if (savedWaypoints.Count == 0) { savedWaypoints.PopulateWithMockData(); repository.SaveAsync(savedWaypoints); } WaypointList = new ObservableCollection<Waypoint>(savedWaypoints.ToArray()); var location = GetCurrentLocation(); if (location == null) { MessageDialog message = new MessageDialog("GPSLocationNotResolved"); Task.Run(() => message.ShowAsync()).Wait(); } else { CurrentLocationLatitude = location.Latitude; CurrentLocationLongitude = location.Longitude; } }
/// <summary> /// 文本框 /// </summary> /// <param name="service">组件服务</param> public static ITextBox TextBox(this IUiService service) { return(new TextBox()); }
public ComponentContainer(Application application, IGeneralOptionsDataAccess generalOptionsDataAccess, IComWrapperFactory comWrapperFactory, IExceptionHandlingStrategy exceptionHandlingStrategy) { if (application == null) { throw new ArgumentNullException(nameof(application)); } if (generalOptionsDataAccess == null) { throw new ArgumentNullException(nameof(generalOptionsDataAccess)); } if (comWrapperFactory == null) { throw new ArgumentNullException(nameof(comWrapperFactory)); } s_logger.Info("Startup..."); s_logger.Info($"Version: {Assembly.GetExecutingAssembly().GetName().Version}"); s_logger.Info($"Operating system: {Environment.OSVersion}"); Thread.CurrentThread.CurrentUICulture = new CultureInfo(GeneralOptionsDataAccess.CultureName); _profileTypeRegistry = ProfileTypeRegistry.Instance; if (GeneralOptionsDataAccess.WpfRenderModeSoftwareOnly) { RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; } _generalOptionsDataAccess = generalOptionsDataAccess; _synchronizationStatus = new SynchronizationStatus(); var generalOptions = _generalOptionsDataAccess.LoadOptions(); _daslFilterProvider = new DaslFilterProvider(generalOptions.IncludeCustomMessageClasses); SetWpfLocale(generalOptions.CultureName); ConfigureServicePointManager(generalOptions); ConfigureLogLevel(generalOptions.EnableDebugLog); _session = application.Session; _outlookAccountPasswordProvider = string.IsNullOrEmpty(_session.CurrentProfileName) ? NullOutlookAccountPasswordProvider.Instance : new OutlookAccountPasswordProvider(_session.CurrentProfileName, application.Version); _globalTimeZoneCache = new GlobalTimeZoneCache(); var applicationDataDirectoryBase = Path.Combine( Environment.GetFolderPath( generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer"); string optionsFilePath; (_applicationDataDirectory, optionsFilePath) = GetOrCreateDataDirectory(applicationDataDirectoryBase, _session.CurrentProfileName); _optionsDataAccess = new OptionsDataAccess(optionsFilePath); _uiService = new UiService(); var options = _optionsDataAccess.Load(); _permanentStatusesViewModel = new PermanentStatusesViewModel(_uiService, this, options); _permanentStatusesViewModel.OptionsRequesting += PermanentStatusesViewModel_OptionsRequesting; _queryFolderStrategyWrapper = new OutlookFolderStrategyWrapper(QueryOutlookFolderByRequestingItemStrategy.Instance); _totalProgressFactory = new TotalProgressFactory( _uiService, generalOptions.ShowProgressBar, generalOptions.ThresholdForProgressDisplay, ExceptionHandler.Instance); _outlookSession = new OutlookSession(_session); _synchronizerFactory = new SynchronizerFactory( GetProfileDataDirectory, _totalProgressFactory, _outlookSession, _daslFilterProvider, _outlookAccountPasswordProvider, _globalTimeZoneCache, _queryFolderStrategyWrapper, exceptionHandlingStrategy, comWrapperFactory, _optionsDataAccess, _profileTypeRegistry); _synchronizationReportRepository = CreateSynchronizationReportRepository(); UpdateGeneralOptionDependencies(generalOptions); _scheduler = new Scheduler( _synchronizerFactory, this, EnsureSynchronizationContext, new FolderChangeWatcherFactory( _session), _synchronizationStatus); EnsureCacheCompatibility(options); _availableVersionService = new AvailableVersionService(); _updateChecker = new UpdateChecker(_availableVersionService, () => _generalOptionsDataAccess.IgnoreUpdatesTilVersion); _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound; _updateChecker.IsEnabled = generalOptions.ShouldCheckForNewerVersions; _reportGarbageCollection = new ReportGarbageCollection(_synchronizationReportRepository, TimeSpan.FromDays(generalOptions.MaxReportAgeInDays)); _trayNotifier = generalOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance; try { using (var syncObjects = GenericComObjectWrapper.Create(_session.SyncObjects)) { if (syncObjects.Inner != null && syncObjects.Inner.Count > 0) { _syncObject = syncObjects.Inner[1]; if (generalOptions.TriggerSyncAfterSendReceive) { _syncObject.SyncEnd += SyncObject_SyncEnd; } } } } catch (COMException ex) { s_logger.Error("Can't access SyncObjects", ex); } _oneTimeTaskRunner = new OneTimeTaskRunner(_outlookSession); DDayICalWorkaround.DDayICalCustomization.InitializeNoThrow(); }
public WayPointsSelectionPageViewModel(IUiService uiService) : base(uiService) { DisplayName = "Waypoint Selection"; }
/// <summary> /// 文本框 /// </summary> /// <param name="service">组件服务</param> public static ITextBox TextBox <TModel>(this IUiService <TModel> service) { return(new TextBox()); }
/// <summary> /// 下拉列表 /// </summary> /// <param name="service">组件服务</param> public static ISelect Select <TModel>(this IUiService <TModel> service) { return(new Select()); }
/// <summary> /// 文本框 /// </summary> /// <param name="service">组件服务</param> public static Util.Ui.Components.ITextBox TextBox(this IUiService service) { return(new TextBox()); }
/// <summary> /// 滑动开关 /// </summary> /// <param name="service">组件服务</param> public static ISlideToggle SlideToggle <TModel>(this IUiService <TModel> service) { return(new SlideToggle()); }
/// <summary> /// 单选框 /// </summary> /// <param name="service">组件服务</param> public static IRadio Radio <TModel>(this IUiService <TModel> service) { return(new Radio()); }
/// <summary> /// 颜色选择器 /// </summary> /// <param name="service">组件服务</param> public static IColorPicker ColorPicker <TModel>(this IUiService <TModel> service) { return(new ColorPicker()); }
/// <summary> /// 富文本框编辑器 /// </summary> /// <param name="service">组件服务</param> public static IEditor Editor <TModel>(this IUiService <TModel> service) { return(new Editor()); }
public PermanentStatusesViewModel(IUiService uiService, ICalDavSynchronizerCommands commands, Contracts.Options[] options) { _commands = commands ?? throw new ArgumentNullException(nameof(commands)); _uiService = uiService ?? throw new ArgumentNullException(nameof(uiService)); _summaryChache.NotifyProfilesChanged(options); }
public FileBasedAlbumManager(IUiService uiService) { _uiService = uiService; }
public LocalizationManager(TrekplannerConfiguration configuration, IUiService uiService) { _configuration = configuration; _uiService = uiService; }
public ErrorsController(IUiService uiService) { Debug.WriteLine(GetType().FullName + "." + MethodBase.GetCurrentMethod().Name); _uiService = uiService; }
/// <summary> /// 链接 /// </summary> /// <param name="service">组件服务</param> public static IAnchor A <TModel>(this IUiService <TModel> service) { return(new Anchor()); }
public PermanentStatusesViewModel(IUiService uiService, ICalDavSynchronizerCommands commands) { _commands = commands ?? throw new ArgumentNullException(nameof(commands)); _uiService = uiService ?? throw new ArgumentNullException(nameof(uiService)); }
/// <summary> /// 图标 /// </summary> /// <param name="service">组件服务</param> public static IIcon Icon <TModel>(this IUiService <TModel> service) { return(new Icon()); }
public ComponentContainer(Application application) { s_logger.Info("Startup..."); if (GeneralOptionsDataAccess.WpfRenderModeSoftwareOnly) { RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly; } _generalOptionsDataAccess = new GeneralOptionsDataAccess(); _synchronizationStatus = new SynchronizationStatus(); var generalOptions = _generalOptionsDataAccess.LoadOptions(); _daslFilterProvider = new DaslFilterProvider(generalOptions.IncludeCustomMessageClasses); SetWpfLocale(); ConfigureServicePointManager(generalOptions); ConfigureLogLevel(generalOptions.EnableDebugLog); _session = application.Session; _outlookAccountPasswordProvider = string.IsNullOrEmpty(_session.CurrentProfileName) ? NullOutlookAccountPasswordProvider.Instance : new OutlookAccountPasswordProvider(_session.CurrentProfileName, application.Version); _globalTimeZoneCache = new GlobalTimeZoneCache(); EnsureSynchronizationContext(); _applicationDataDirectory = Path.Combine( Environment.GetFolderPath( generalOptions.StoreAppDataInRoamingFolder ? Environment.SpecialFolder.ApplicationData : Environment.SpecialFolder.LocalApplicationData), "CalDavSynchronizer"); _optionsDataAccess = new OptionsDataAccess( Path.Combine( _applicationDataDirectory, GetOrCreateConfigFileName(_applicationDataDirectory, _session.CurrentProfileName) )); _profileStatusesViewModel = new ProfileStatusesViewModel(this); _uiService = new UiService(_profileStatusesViewModel); _queryFolderStrategyWrapper = new OutlookFolderStrategyWrapper(QueryOutlookFolderByRequestingItemStrategy.Instance); _totalProgressFactory = new TotalProgressFactory( _uiService, generalOptions.ShowProgressBar, generalOptions.ThresholdForProgressDisplay, ExceptionHandler.Instance); _synchronizerFactory = new SynchronizerFactory( GetProfileDataDirectory, _totalProgressFactory, _session, _daslFilterProvider, _outlookAccountPasswordProvider, _globalTimeZoneCache, _queryFolderStrategyWrapper); _synchronizationReportRepository = CreateSynchronizationReportRepository(); UpdateGeneralOptionDependencies(generalOptions); _scheduler = new Scheduler( _synchronizerFactory, this, EnsureSynchronizationContext, new FolderChangeWatcherFactory( _session), _synchronizationStatus); var options = _optionsDataAccess.Load(); EnsureCacheCompatibility(options); _profileStatusesViewModel.EnsureProfilesDisplayed(options); _availableVersionService = new AvailableVersionService(); _updateChecker = new UpdateChecker(_availableVersionService, () => _generalOptionsDataAccess.IgnoreUpdatesTilVersion); _updateChecker.NewerVersionFound += UpdateChecker_NewerVersionFound; _updateChecker.IsEnabled = generalOptions.ShouldCheckForNewerVersions; _reportGarbageCollection = new ReportGarbageCollection(_synchronizationReportRepository, TimeSpan.FromDays(generalOptions.MaxReportAgeInDays)); _trayNotifier = generalOptions.EnableTrayIcon ? new TrayNotifier(this) : NullTrayNotifer.Instance; try { using (var syncObjects = GenericComObjectWrapper.Create(_session.SyncObjects)) { if (syncObjects.Inner != null && syncObjects.Inner.Count > 0) { _syncObject = syncObjects.Inner[1]; if (generalOptions.TriggerSyncAfterSendReceive) { _syncObject.SyncEnd += SyncObject_SyncEnd; } } } } catch (COMException ex) { s_logger.Error("Can't access SyncObjects", ex); } _categorySwitcher = new CategorySwitcher(_session, _daslFilterProvider, _queryFolderStrategyWrapper); }
/// <summary> /// 复选框 /// </summary> /// <param name="service">组件服务</param> public static ICheckBox CheckBox <TModel>(this IUiService <TModel> service) { return(new CheckBox()); }
public SelectProfileViewModel(IReadOnlyCollection <IProfileType> profileTypes, IUiService uiService) { if (profileTypes == null) { throw new ArgumentNullException(nameof(profileTypes)); } if (uiService == null) { throw new ArgumentNullException(nameof(uiService)); } _uiService = uiService; ProfileTypes = profileTypes.Select(p => new ProfileViewModel(p)).ToList(); ProfileTypes.First().IsSelected = true; OkCommand = new DelegateCommand(_ => Close(true)); CancelCommand = new DelegateCommand(_ => Close(false)); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsService"/> class. /// </summary> /// <param name="fileSystem">The file system.</param> /// <param name="uiService">The UI service.</param> public SettingsService(IFileSystem fileSystem, IUiService uiService) { this.FileSystem = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem)); this.UiService = uiService ?? throw new ArgumentNullException(nameof(uiService)); this.Settings = new Settings(); }
/// <summary> /// 按钮 /// </summary> /// <param name="service">组件服务</param> /// <param name="text">文本</param> public static IButton Button(this IUiService service, string text) { return(new Button().Text(text)); }
protected PageViewModelBase(IUiService uiService) { UiService = uiService; }
/// <summary> /// Initializes a new instance of the <see cref="BrowseAllForm"/> class. /// </summary> /// <param name="workspace">The workspace to use.</param> /// <param name="editorForm">The editor form.</param> /// <param name="uiService">UI service to use.</param> internal BrowseAllForm( INefsEditWorkspace workspace, EditorForm editorForm, IUiService uiService) { this.InitializeComponent(); this.EditorForm = editorForm ?? throw new ArgumentNullException(nameof(editorForm)); this.UiService = uiService ?? throw new ArgumentNullException(nameof(uiService)); this.Workspace = workspace ?? throw new ArgumentNullException(nameof(workspace)); this.Workspace.ArchiveOpened += this.OnWorkspaceArchiveOpened; this.Workspace.ArchiveClosed += this.OnWorkspaceArchiveClosed; this.Workspace.ArchiveSaved += this.OnWorkspaceArchiveSaved; this.Workspace.CommandExecuted += this.OnWorkspaceCommandExecuted; this.itemsListView.ListViewItemSorter = this.listViewItemSorter; // Create the columns we want var columns = new ColumnHeader[] { new ColumnHeader() { Name = "id", Text = "Id" }, new ColumnHeader() { Name = "filename", Text = "Filename", Width = 200 }, new ColumnHeader() { Name = "directoryId", Text = "Directory Id" }, new ColumnHeader() { Name = "compressedSize", Text = "Compressed Size" }, new ColumnHeader() { Name = "extractedSize", Text = "Extracted Size" }, }; var debugColumns = new ColumnHeader[] { new ColumnHeader() { Name = "pt1.0x00", Text = "Offset to Data [pt1.0x00]" }, new ColumnHeader() { Name = "pt1.0x08", Text = "Index Part 2 [pt1.0x08]" }, new ColumnHeader() { Name = "pt1.0x0c", Text = "Index Part 4 [pt1.0x0c]" }, new ColumnHeader() { Name = "pt1.0x10", Text = "Id [pt1.0x10]" }, new ColumnHeader() { Name = "pt2.0x00", Text = "Directory Id [pt2.0x00]" }, new ColumnHeader() { Name = "pt2.0x04", Text = "First Child [pt2.0x04]" }, new ColumnHeader() { Name = "pt2.0x08", Text = "Pt3 offset (filename strings) [pt2.0x08]" }, new ColumnHeader() { Name = "pt2.0x0c", Text = "Extracted size [pt2.0x0c]" }, new ColumnHeader() { Name = "pt2.0x10", Text = "Id [pt2.0x10]" }, new ColumnHeader() { Name = "pt6.0x00", Text = "Volume [pt6.0x00]" }, new ColumnHeader() { Name = "pt6.0x02", Text = "Flags [pt6.0x02]" }, new ColumnHeader() { Name = "pt6.0x03", Text = "Unknown [pt6.0x03]" }, new ColumnHeader() { Name = "pt7.0x00", Text = "Sibling Id [pt7.0x00]" }, new ColumnHeader() { Name = "pt7.0x04", Text = "Id [pt7.0x04]" }, }; this.itemsListView.ShowItemToolTips = true; this.itemsListView.Columns.AddRange(columns); this.itemsListView.Columns.AddRange(debugColumns); this.itemsListView.ColumnClick += this.ItemsListView_ColumnClick; }