public MainViewModelTests() { _mockedFileSystem = new MockFileSystem(); var commonsMock = new Mock <ICommons>(); commonsMock.SetupGet(x => x.CurrentLanguage).Returns(() => "English"); commonsMock.SetupGet(x => x.CurrentLanguageCode).Returns(() => "eng"); commonsMock.SetupGet(x => x.LanguageCodeMap).Returns(() => new Dictionary <string, string>()); _mockedCommons = commonsMock.Object; var mockedLocalizationHelper = new Mock <ILocalizationHelper>(); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>())).Returns <string>(x => x); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>(), It.IsAny <string>())).Returns((string value, string langauge) => value); _mockedLocalizationHelper = mockedLocalizationHelper.Object; Localization.Localization.Init(_mockedCommons); _mockedAppSettings = new Mock <IAppSettings>().Object; var annoCanvasMock = new Mock <IAnnoCanvas>(); annoCanvasMock.SetupAllProperties(); //The QuadTree does not have a default constructor, so we need to explicitly set up the property annoCanvasMock.Setup(x => x.PlacedObjects).Returns(new Core.DataStructures.QuadTree <LayoutObject>(new Rect(-100, -100, 200, 200))); _mockedAnnoCanvas = annoCanvasMock.Object; _inMemoryRecentFilesHelper = new RecentFilesHelper(new RecentFilesInMemorySerializer(), new MockFileSystem()); _mockedMessageBoxService = new Mock <IMessageBoxService>().Object; _mockedUpdateHelper = new Mock <IUpdateHelper>().Object; _mockedCellGrouper = Mock.Of <IAdjacentCellGrouper>(); }
} //= "Add yourself some time to cover both the person in the room and yourself."; public SessionRouter(IUpdateHelper updateHelper, IMenuLoader menuLoader, ILogger <SessionRouter> logger, IRoomService room, IUsersService users, IBotService botService, IOptions <BotConfiguration> config, ILockTrackerService lockTrackerService, ILogHelper logHelper, INotificationRouter notificationRouter, ILocalizationHelper localizationHelper) { _menuLoader = menuLoader; _config = config; _logHelper = logHelper; _updateHelper = updateHelper; _notificationRouter = notificationRouter; _localizationHelper = localizationHelper; _users = users; _logger = logger; _room = room; _botService = botService; _lockTrackerService = lockTrackerService; CommandNotRecognized = _localizationHelper.GetLocalizedString(StringToLocalize.CommandNotRecognized); NumberOverLimit = _localizationHelper.GetLocalizedString(StringToLocalize.NumberOverLimit); NumberNotParsed = _localizationHelper.GetLocalizedString(StringToLocalize.NumberNotParsed); doorIsLockedInstruction = _localizationHelper.GetLocalizedString(StringToLocalize.doorIsLockedInstruction); }
/// <summary> /// only used for databinding /// </summary> public BuildingSettingsViewModel(IAppSettings appSettingsToUse, IMessageBoxService messageBoxServiceToUse, ILocalizationHelper localizationHelperToUse) { _appSettings = appSettingsToUse; _messageBoxService = messageBoxServiceToUse; _localizationHelper = localizationHelperToUse; ApplyColorToSelectionCommand = new RelayCommand(ApplyColorToSelection, CanApplyColorToSelection); ApplyPredefinedColorToSelectionCommand = new RelayCommand(ApplyPredefinedColorToSelection, CanApplyPredefinedColorToSelection); UseColorInLayoutCommand = new RelayCommand(UseColorInLayout, CanUseColorInLayout); SelectedColor = Colors.Red; BuildingHeight = 4; BuildingWidth = 4; BuildingTemplate = string.Empty; BuildingName = string.Empty; BuildingIdentifier = string.Empty; BuildingRadius = 0; BuildingInfluenceRange = 0; IsEnableLabelChecked = false; IsBorderlessChecked = false; IsRoadChecked = false; ColorsInLayout = new ObservableCollection <SerializableColor>(); BuildingInfluences = new ObservableCollection <BuildingInfluence>(); InitBuildingInfluences(); SelectedBuildingInfluence = BuildingInfluences.SingleOrDefault(x => x.Type == BuildingInfluenceType.None); }
/// <summary> /// 初始化本地化管理器的新实例。 /// </summary> public LocalizationManager() { m_Dictionary = new Dictionary <string, string>(StringComparer.Ordinal); m_DataProvider = new DataProvider <ILocalizationManager>(this); m_LocalizationHelper = null; m_Language = Language.Unspecified; }
public HotkeyCommandManager(ILocalizationHelper localizationHelperToUse) { hotkeys = new Dictionary <string, Hotkey>(); _observableCollection = new ObservableCollection <Hotkey>(); ObservableCollection = _observableCollection; _localizationHelper = localizationHelperToUse; }
} //"Command wasn't recognized. Please try again."; public SimpleSessionRouter(IUpdateHelper updateHelper, IMenuLoader menuLoader, IRoomService room, IUsersService users, IBotService botService, ILockTrackerService lockTrackerService, ILogHelper logHelper, INotificationRouter notificationRouter, ILocalizationHelper localizationHelper) { _menuLoader = menuLoader; _logHelper = logHelper; _updateHelper = updateHelper; _notificationRouter = notificationRouter; _users = users; _room = room; _botService = botService; _lockTrackerService = lockTrackerService; _localizationHelper = localizationHelper; CommandNotRecognized = _localizationHelper.GetLocalizedString(StringToLocalize.CommandNotRecognized); }
/// <summary> /// Primary constructor. /// </summary> /// <param name="persistence"> /// The entity persistence. /// </param> /// <param name="tree"> /// The tree controller. /// </param> /// <param name="helper"> /// The folder helper. /// </param> public FormHelper(IEntityPersistence persistence, TreeController tree, FolderHelper helper, ILocalizationHelper localizationHelper) { Persistence = persistence; Tree = tree; Helper = helper; LocalizationHelper = localizationHelper; }
public RoomService(IMenuLoader menuLoader, IUsersService usersService, ILockTrackerService lockTrackerService, IRoomQueue roomQueue, ILogHelper LogHelper, INotificationRouter notificationRouter, ILocalizationHelper localizationHelper) { //LogHelper = new LogHelper(); _menuLoader = menuLoader; _usersService = usersService; _lockTrackerService = lockTrackerService; _roomQueue = roomQueue; _LogHelper = LogHelper; _notificationRouter = notificationRouter; _localizationHelper = localizationHelper; IsBusy = false; _LogHelper.Log("HJ64K54J45", "Room instance created", LogLevel.Information); QueueList = _roomQueue.QueueList;//new ObservableCollection<QueueSlot>(); QueueList.CollectionChanged += QueueChangeHandler; _lockTrackerService.PropertyChanged += _lockTrackerService_PropertyChanged; roomCancellationTokenSource = new CancellationTokenSource(); inBetweenCancellationTokenSource = new CancellationTokenSource(); }
private void IterateControls(ControlCollection controls, ArrayList affectedControls, ILocalizationHelper localization) { foreach (Control control in controls) { ProcessControl(control, affectedControls, true, localization); } }
protected LedDeviceViewModel(IEventAggregator aggregator, ILocalizationHelper loc, ISettingsService settingsService, IEventListViewModel eventListViewModel, ILedViewModelFactory ledFactory) { EventAggregator = aggregator; Loc = loc; SettingsService = settingsService; EventListViewModel = eventListViewModel; LedFactory = ledFactory; EventAggregator.SubscribeOnUIThread(this); }
/// <summary> /// 设置本地化辅助器。 /// </summary> /// <param name="localizationHelper">本地化辅助器。</param> public void SetLocalizationHelper(ILocalizationHelper localizationHelper) { if (localizationHelper == null) { throw new GameFrameworkException("Localization helper is invalid."); } m_LocalizationHelper = localizationHelper; }
public TopChangeInfoJson(TopChangeInfo topChangeInfo, ILocalizationHelper localization, int pageSize) : this() { TotalCount = topChangeInfo.TotalCount; var noChangeString = localization.GetString("NoChange"); foreach (var topChangeItemInfo in topChangeInfo.Items) { var topChangeItemInfoJson = new TopChangeItemInfoJson { ProductId = topChangeItemInfo.ProductId, ProductName = topChangeItemInfo.ProductName, ProductUrl = string.Format("/DesktopModules/Hotcakes/Core/Admin/catalog/Products_Performance.aspx?id={0}", topChangeItemInfo.ProductId) }; topChangeItemInfoJson.BouncesChange = noChangeString; topChangeItemInfoJson.AbandomentsChange = noChangeString; topChangeItemInfoJson.PurchasesChange = noChangeString; topChangeItemInfoJson.Change = noChangeString; if (Math.Abs(topChangeItemInfo.BouncesChange) >= 0.01m) { topChangeItemInfoJson.BouncesChange = Math.Abs(topChangeItemInfo.BouncesChange).ToString("p0"); topChangeItemInfoJson.IsBouncesChangeGrowing = topChangeItemInfo.BouncesChange > 0; } if (Math.Abs(topChangeItemInfo.AbandomentsChange) >= 0.01m) { topChangeItemInfoJson.AbandomentsChange = Math.Abs(topChangeItemInfo.AbandomentsChange).ToString("p0"); topChangeItemInfoJson.IsAbandomentsChangeGrowing = topChangeItemInfo.AbandomentsChange > 0; } if (Math.Abs(topChangeItemInfo.PurchasesChange) >= 0.01m) { topChangeItemInfoJson.PurchasesChange = Math.Abs(topChangeItemInfo.PurchasesChange).ToString("p0"); topChangeItemInfoJson.IsPurchasesChangeGrowing = topChangeItemInfo.PurchasesChange > 0; } if (Math.Abs(topChangeItemInfo.Change) >= 0.01m) { topChangeItemInfoJson.Change = Math.Abs(topChangeItemInfo.Change).ToString("p0"); topChangeItemInfoJson.IsChangeGrowing = topChangeItemInfo.Change > 0; } Items.Add(topChangeItemInfoJson); } while (Items.Count < pageSize) { Items.Add(new TopChangeItemInfoJson()); } }
/// <summary> /// Initializes a new instance of <see cref="AnnoDesigner.UpdateHelper"./> /// </summary> /// <param name="basePathToUse">The path the directory of the application.</param> /// <remarks> /// example to get the basePath: <c>string basePath = AppDomain.CurrentDomain.BaseDirectory;</c> /// </remarks> public UpdateHelper(string basePathToUse, IAppSettings appSettingsToUse, IMessageBoxService messageBoxServiceToUse, ILocalizationHelper localizationHelperToUse) { _basePath = basePathToUse; _appSettings = appSettingsToUse; _messageBoxService = messageBoxServiceToUse; _localizationHelper = localizationHelperToUse; }
public TextMenuLoader(IBotService botService, IOptions <BotConfiguration> config, IUsersService users, ILocalizationHelper localizationHelper) { _users = users; _botService = botService; _config = config; _localizationHelper = localizationHelper; }
/// <summary> /// Initializes a new instance of the <see cref="FormulateTreeController"/> class. /// </summary> /// <param name="entityPersistence"> /// The entity persistence. /// </param> /// <param name="localizationHelper"> /// The localization helper. /// </param> public FormulateTreeController(IEntityPersistence entityPersistence, ILocalizationHelper localizationHelper) { Persistence = entityPersistence; LocalizationHelper = localizationHelper; FolderHelper = new FolderHelper(Persistence, this, LocalizationHelper); FormHelper = new FormHelper(Persistence, this, FolderHelper, LocalizationHelper); LayoutHelper = new LayoutHelper(this, FolderHelper, LocalizationHelper); ValidationHelper = new ValidationHelper(this, FolderHelper, LocalizationHelper); DataValueHelper = new DataValueHelper(this, FolderHelper, LocalizationHelper); ConfiguredFormHelper = new ConfiguredFormHelper(this, LocalizationHelper); }
static PresetsTreeViewModelTests() { _subsetFromPresetsFile = InitSubsetFromPresetsFile(); _subsetForFiltering = InitSubsetForFiltering(); var mockedLocalizationHelper = new Mock <ILocalizationHelper>(); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>())).Returns <string>(x => x); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>(), It.IsAny <string>())).Returns((string value, string langauge) => value); _mockedTreeLocalization = mockedLocalizationHelper.Object; }
public DeviceListViewModel(IEventAggregator aggregator, ILocalizationHelper loc, ISettingsService settingsService, IBlinkStickViewModelFactory blinkStickViewModelFactory, IMessageFactory messageFactory) { _eventAggregator = aggregator; _loc = loc; _settingsService = settingsService; _blinkStickViewModelFactory = blinkStickViewModelFactory; _messageFactory = messageFactory; _eventAggregator.SubscribeOnUIThread(this); }
/// <summary> /// 初始化本地化管理器的新实例。 /// </summary> public LocalizationManager() { m_Dictionary = new Dictionary <string, string>(); m_LoadAssetCallbacks = new LoadAssetCallbacks(LoadDictionarySuccessCallback, LoadDictionaryFailureCallback, LoadDictionaryUpdateCallback, LoadDictionaryDependencyAssetCallback); m_ResourceManager = null; m_LocalizationHelper = null; m_Language = Language.Unspecified; m_LoadDictionarySuccessEventHandler = null; m_LoadDictionaryFailureEventHandler = null; m_LoadDictionaryUpdateEventHandler = null; m_LoadDictionaryDependencyAssetEventHandler = null; }
static App() { _commons = Commons.Instance; _appSettings = AppSettings.Instance; _messageBoxService = new MessageBoxService(); Localization.Localization.Init(_commons); _localizationHelper = Localization.Localization.Instance; _updateHelper = new UpdateHelper(ApplicationPath, _appSettings, _messageBoxService, _localizationHelper); _fileSystem = new FileSystem(); }
public PresetsTreeViewModel(ILocalizationHelper localizationHelperToUse) { _localizationHelper = localizationHelperToUse; Items = new ObservableCollection <GenericTreeItem>(); FilteredItems = CollectionViewSource.GetDefaultView(Items); DoubleClickCommand = new RelayCommand(DoubleClick, null); //SelectedItemChangedCommand = new RelayCommand(SelectedItemChanged, null); ReturnKeyPressedCommand = new RelayCommand(ReturnKeyPressed, null); BuildingPresetsVersion = string.Empty; FilterGameVersion = CoreConstants.GameVersion.All; FilterText = string.Empty; }
public ManageKeybindingsViewModel(HotkeyCommandManager hotkeyCommandManager, ICommons commons, IMessageBoxService messageBoxServiceToUse, ILocalizationHelper localizationHelperToUse) { HotkeyCommandManager = hotkeyCommandManager; _messageBoxService = messageBoxServiceToUse; _localizationHelper = localizationHelperToUse; EditCommand = new RelayCommand <Hotkey>(ExecuteRebind); ResetHotkeysCommand = new RelayCommand(ExecuteResetHotkeys); this.commons = commons; this.commons.SelectedLanguageChanged += Instance_SelectedLanguageChanged; UpdateRebindButtonText(); }
public static void LocalizeRadGrid(RadGrid radGrid, ILocalizationHelper localization) { foreach (GridColumn column in radGrid.Columns) { var headerText = localization.GetString(column.UniqueName + ".HeaderText"); if (!string.IsNullOrEmpty(headerText)) { column.HeaderText = headerText; } var footerText = localization.GetString(column.UniqueName + ".FooterText"); if (!string.IsNullOrEmpty(footerText)) { column.FooterText = footerText; } } }
public static void LocalizeDataGrid(DataGrid dataGrid, ILocalizationHelper localization) { foreach (DataGridColumn column in dataGrid.Columns) { var headerText = localization.GetString(column.HeaderText + ".HeaderText"); if (!string.IsNullOrEmpty(headerText)) { column.HeaderText = headerText; } var footerText = localization.GetString(column.FooterText + ".FooterText"); if (!string.IsNullOrEmpty(footerText)) { column.FooterText = footerText; } } }
public static void LocalizeGridView(GridView gridView, ILocalizationHelper localization) { foreach (DataControlField column in gridView.Columns) { var headerText = localization.GetString(column.HeaderText + ".HeaderText"); if (!string.IsNullOrEmpty(headerText)) { column.HeaderText = headerText; } var footerText = localization.GetString(column.FooterText + ".FooterText"); if (!string.IsNullOrEmpty(footerText)) { column.FooterText = footerText; } } }
public UpdateSettingsViewModel(ICommons commonsToUse, IAppSettings appSettingsToUse, IMessageBoxService messageBoxServiceToUse, IUpdateHelper updateHelperToUse, ILocalizationHelper localizationHelperToUse) { _commons = commonsToUse; _appSettings = appSettingsToUse; _messageBoxService = messageBoxServiceToUse; _updateHelper = updateHelperToUse; _localizationHelper = localizationHelperToUse; CheckForUpdatesCommand = new RelayCommand(ExecuteCheckForUpdates); OpenReleasesCommand = new RelayCommand(ExecuteOpenReleases); DownloadPresetsCommand = new RelayCommand(ExecuteDownloadPresets); }
public StatisticsViewModel(ILocalizationHelper localizationHelperToUse, ICommons commonsToUse) { _localizationHelper = localizationHelperToUse; _commons = commonsToUse; UsedArea = "12x4"; UsedTiles = 308; MinTiles = 48; Efficiency = "16%"; AreStatisticsAvailable = true; ShowBuildingList = true; Buildings = new ObservableCollection <StatisticsBuilding>(); SelectedBuildings = new ObservableCollection <StatisticsBuilding>(); _statisticsCalculationHelper = new StatisticsCalculationHelper(); _cachedPresetsBuilding = new Dictionary <string, BuildingInfo>(50); }
public ButtonMenuLoader(IBotService botService, IOptions <BotConfiguration> config, IUsersService users, ILockTrackerService lockTrackerService, IRoomQueue roomQueue, ILogHelper logHelper, INotificationRouter notificationRouter, ILocalizationHelper localizationHelper) { _botService = botService; _config = config; _users = users; _lockTrackerService = lockTrackerService; _roomQueue = roomQueue; _logHelper = logHelper; _notificationRouter = notificationRouter; _localizationHelper = localizationHelper; }
public SimpleRoom( ILockTrackerService lockTrackerService, IRoomQueue roomQueue, ILogHelper LogHelper, INotificationRouter notificationRouter, ILocalizationHelper localizationHelper) { _roomQueue = roomQueue; SubscribedUsers = _roomQueue.QueueList; IsBusy = false; _lockTrackerService = lockTrackerService; _LogHelper = LogHelper; _notificationRouter = notificationRouter; _localizationHelper = localizationHelper; _lockTrackerService.PropertyChanged += _lockTrackerService_PropertyChanged; }
public BuildingSettingsViewModelTests() { var commonsMock = new Mock <ICommons>(); commonsMock.SetupGet(x => x.CurrentLanguage).Returns(() => "English"); commonsMock.SetupGet(x => x.CurrentLanguageCode).Returns(() => "eng"); _mockedCommons = commonsMock.Object; var mockedLocalizationHelper = new Mock <ILocalizationHelper>(); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>())).Returns <string>(x => x); mockedLocalizationHelper.Setup(x => x.GetLocalization(It.IsAny <string>(), It.IsAny <string>())).Returns((string value, string langauge) => value); _mockedLocalization = mockedLocalizationHelper.Object; Localization.Localization.Init(commonsMock.Object); _mockedAppSettings = new Mock <IAppSettings>().Object; _mockedMessageBoxService = new Mock <IMessageBoxService>().Object; }
public SalesInfoJson(SalesInfo info, ILocalizationHelper localization) { ChartLabels = info.ChartLabels; ChartData = info.ChartData; OrdersCount = info.OrdersCount; OrdersCompleted = info.OrdersCompleted; OrdersAbandonedPercent = info.OrdersAbandonedPercent; OrdersTotalSum = Money.GetFriendlyAmount(info.OrdersTotalSum, CultureInfo.CurrentUICulture); OrdersSuccessfulTransactions = info.OrdersSuccessfulTransactions; var noChangeString = localization.GetString("NoChange"); var salesByDeviceComparisonString = localization.GetString("SalesByDeviceComparison"); var ci = CultureInfo.CurrentUICulture; SalesByDesktopCount = info.SalesByDesktopCount; SalesByDesktopComparison = noChangeString; if (Math.Abs(info.SalesByDesktopPercent - info.SalesByDesktopPercentPrev) > 0.01m) { SalesByDesktopGrowing = info.SalesByDesktopPercent > info.SalesByDesktopPercentPrev; SalesByDesktopComparison = string.Format(salesByDeviceComparisonString, info.SalesByDesktopPercent, info.SalesByDesktopPercentPrev); } SalesByTabletCount = info.SalesByTabletCount; SalesByTabletComparison = noChangeString; if (Math.Abs(info.SalesByTabletPercent - info.SalesByTabletPercentPrev) > 0.01m) { SalesByTabletGrowing = info.SalesByTabletPercent > info.SalesByTabletPercentPrev; SalesByTabletComparison = string.Format(salesByDeviceComparisonString, info.SalesByTabletPercent, info.SalesByTabletPercentPrev); } SalesByPhoneCount = info.SalesByPhoneCount; SalesByPhoneComparison = noChangeString; if (Math.Abs(info.SalesByPhonePercent - info.SalesByPhonePercentPrev) > 0.01m) { SalesByPhoneGrowing = info.SalesByPhonePercent > info.SalesByPhonePercentPrev; SalesByPhoneComparison = string.Format(salesByDeviceComparisonString, info.SalesByPhonePercent, info.SalesByPhonePercentPrev); } }