Ejemplo n.º 1
0
        public AccountsViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            UserContext userContext)
        {
            logger.Log("AccountsViewModel.AccountsViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _regionManager = regionManager;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            this.UserContext = userContext;

            _tradingService.OpenNewAccountCompleted += new EventHandler<OpenNewAccountCompletedEventArgs>(OpenNewAccountCallback);
            _tradingService.ChangeAccountNameCompleted += new EventHandler<AsyncCompletedEventArgs>(ChangeAccountNameCallback);
            CreateAccountCommand = new DelegateCommand<object>(this.CreateAccountExecute);
            EditAccountCommand = new DelegateCommand<object>(this.EditAccountExecute);
            UpdateAccountsCommand = new DelegateCommand<object>(this.UpdateAccountsExecute);
            SelectAccountCommand = new DelegateCommand<object>(this.SelectAccountExecute);

            SubscribeToEvents();
        }
 public ClientsViewModel(IEventAggregator aggregator, IRegionManager regionManager,
     IConnectionManager connectionManager, IInteractionService interactionService, ILoggerFacade loggerFacade) :
         base(aggregator, regionManager, connectionManager, interactionService, loggerFacade)
 {
     //aggregator.GetEvent<BootstrappingCompleteUiEvent>().Subscribe(BootstrappCompletedHandler);
     AdditionalRoomsValues = new ObservableCollection<string> {"Yes", "No"};
 }
        public ReservationDashBoardViewModel(IUnityContainer container, ILoggerFacade logger, IReservationManager reservationManager, ITableManager tableManager, IMessageBoxService messageBoxService, IDialogBoxService dialogBoxService)
        {
            this._logger = logger;
            this._container = container;
            this._reservationManager = reservationManager;
            this._tableManager = tableManager;
            this._messageBoxService = messageBoxService;
            this._dialogBoxService = dialogBoxService;
            this._reservationHours = new ObservableCollection<ReservationHour>();
            this._reservations = new MappedValueCollection();


            this.AddCommand = new DelegateCommand(this.OnAddCommand, () => { return this._noOfPersons > 0; });
            this.BrowseCommand = new DelegateCommand(this.OnBrowseCommand);
            this.ImportCommand = new DelegateCommand(this.OnImportCommand, () => { return !string.IsNullOrEmpty(this._tableXMLFile); });

            this._tables = this._tableManager.GetAll();
            
            // Assumption : Reservation duration is between 10 Am and 10 Pm
            this._minFromHour = 10;
            this._maxFromHour = 22;

            for (int hour = this._minFromHour; hour <= this._maxFromHour; hour++)
            {
                this._reservationHours.Add(new ReservationHour(hour));
            }

            this.FromHour = this._minFromHour;

            TableReservation.Common.ReservationsUpdatedEvent.Instance.Subscribe(this.ReservationsUpdated);
            this.ReservationsUpdated(Guid.NewGuid());
        }
Ejemplo n.º 4
0
 public MefModuleManager(
     IModuleInitializer moduleInitializer,
     IModuleCatalog moduleCatalog,
     ILoggerFacade loggerFacade)
     : base(moduleInitializer, moduleCatalog, loggerFacade)
 {
 }
Ejemplo n.º 5
0
        public TransferViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            Bullsfirst.InterfaceOut.Oms.MarketDataServiceReference.IMarketDataServiceAsync marketDataService,
            UserContext userContext,
            ReferenceData referenceData)
        {
            logger.Log("TransferViewModel.TransferViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _regionManager = regionManager;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            _marketDataService = marketDataService;
            this.UserContext = userContext;
            this.ReferenceData = referenceData;

            _tradingService.TransferCashCompleted += new EventHandler<AsyncCompletedEventArgs>(TransferCallback);
            _tradingService.TransferSecuritiesCompleted += new EventHandler<AsyncCompletedEventArgs>(TransferCallback);
            _tradingService.AddExternalAccountCompleted += new EventHandler<AddExternalAccountCompletedEventArgs>(AddExternalAccountCallback);
            _marketDataService.GetMarketPriceCompleted +=
                new EventHandler<InterfaceOut.Oms.MarketDataServiceReference.GetMarketPriceCompletedEventArgs>(GetMarketPriceCallback);
            TransferCommand = new DelegateCommand<object>(this.TransferExecute, this.CanTransferExecute);
            AddExternalAccountCommand = new DelegateCommand<object>(this.AddExternalAccountExecute);
            this.PropertyChanged += this.OnPropertyChanged;
            this.ValidateAll();

            SubscribeToEvents();
        }
Ejemplo n.º 6
0
        protected PrismUnityApplication(ILoggerFacade logger, IUnityContainer container) : base(logger)
        {
            if (container == null)
                throw new InvalidOperationException("Unity container is null");

            Container = container;
        }
Ejemplo n.º 7
0
        public OrdersViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            UserContext userContext,
            ReferenceData referenceData)
        {
            logger.Log("PositionsViewModel.PositionsViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            this.UserContext = userContext;
            this.Orders = new ObservableCollection<Order>();
            this.ReferenceData = referenceData;

            this.UpdateOrdersCommand = new DelegateCommand<object>(this.UpdateOrdersExecute);
            this.ResetFilterCommand = new DelegateCommand<object>(this.ResetFilterExecute);
            this.CancelOrderCommand = new DelegateCommand<object>(this.CancelOrderExecute);

            _tradingService.GetOrdersCompleted +=
                new EventHandler<GetOrdersCompletedEventArgs>(GetOrdersCallback);
            _tradingService.CancelOrderCompleted +=
                new EventHandler<AsyncCompletedEventArgs>(CancelOrderCallback);
            this.UserContext.PropertyChanged +=
                new PropertyChangedEventHandler(OnUserContextPropertyChanged);

            ResetFilter();
            SubscribeToEvents();
        }
Ejemplo n.º 8
0
 public ReservationModule(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator, ILoggerFacade logger)
 {
     this._container = container;
     this._regionManager = regionManager;
     this._eventAggregator = eventAggregator;
     this._logger = logger;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RosterViewModel"/> class.
        /// </summary>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="rosterService">The roster service.</param>
        public RosterViewModel(IEventAggregator eventAggregator, ILoggerFacade logger, RosterService rosterService)
        {
            this.RosterService = rosterService;
            this.RegisterHandlers();

            logger.Log("RosterViewModel Initialized", Category.Debug, Priority.None);
        }
 public DataRepositoryObjectViewModel( IDataRepository dataRepository, IRegionManager regionManager, IInteractionService interactionService, ILoggerFacade logger )
     : base(regionManager, interactionService, logger)
 {
     Model = null;
      InTransaction = false;
      this.DataRepository = dataRepository;
 }
Ejemplo n.º 11
0
 public FoodItemViewModel( IDataRepository dataRepository, IRegionManager regionManager, IInteractionService interactionService, ILoggerFacade logger )
     : base(dataRepository, regionManager, interactionService, logger)
 {
     FoodGroupsPerServing = new ObservableCollection<ServingViewModel<FoodGroup>>();
      ValidFoodGroups = new AllFoodGroupsViewModel( dataRepository );
      Title = DisplayStrings.NewFoodItemTitle;
 }
Ejemplo n.º 12
0
 public CustomerListViewModel(IUnityContainer container)
 {
   this.container = container;
   this.logger = this.container.Resolve<ILoggerFacade>();
   this.eventAggregator = this.container.Resolve<IEventAggregator>();
   this.modelService = this.container.Resolve<IModelService>();
 }
Ejemplo n.º 13
0
 public BaseIOViewModel(SelectedSettings settings, string portName, ILoggerFacade logger)
 {
     this.logger = logger;
     this.settings = settings;
     this.portName = portName;
     StopCommand = new DelegateCommand(OnStop);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="VMBase" /> class.
 /// </summary>
 /// <param name="aggregator">The aggregator.</param>
 /// <param name="regionManager">The region manager.</param>
 /// <param name="connectionManager"></param>
 /// <param name="interactionService"></param>
 /// <param name="loggerFacade"></param>
 /// <exception cref="System.ArgumentNullException">
 ///     Any parameter
 /// </exception>
 public ApplicationMenuViewModel(IEventAggregator aggregator, IRegionManager regionManager,
     IConnectionManager connectionManager,
     IInteractionService interactionService, ILoggerFacade loggerFacade)
     : base(aggregator, regionManager, connectionManager, interactionService, loggerFacade)
 {
     EventAggregator.GetEvent<UserAuthCompletedEvent>().Subscribe(OnUserAuth);
 }
Ejemplo n.º 15
0
 public static ILoggerFacade InitLog4Net(string logName)
 {
     if (m_logger == null) {
         m_logger = new Log4NetLogger(logName);
     }
     return m_logger;
 }
Ejemplo n.º 16
0
 public StatusBarViewModel(IEventAggregator eventAggregator, ILoggerFacade logger)
 {
     this.eventAggregator = eventAggregator;
     this.logger = logger;
     this.eventAggregator.GetEvent<SelectedSettingsEvent>().Subscribe(OnChangeSelectedSettings);
     this.eventAggregator.GetEvent<SettingsExceptionEvent>().Subscribe(OnSettingsException);
 }
		public SortedModuleInitializer(IUnityContainer Container, ILoggerFacade Logger)
		{
			_logger = Logger;
			defaultInitializer = Container.Resolve<IModuleInitializer>("defaultModuleInitializer");
			moduleConfigs = LoadModuleConfig();
			Container.RegisterInstance<IModuleConfigs>("ModuleConfigs", moduleConfigs);
		}
Ejemplo n.º 18
0
        public ModuleBModule(IRegionManager regionManager, ILoggerFacade logger)
        {
            _regionManager = regionManager;
            _logger = logger;

            _logger.Log("ModuleBModule.ctor() [done]", Category.Debug, Priority.Low);
        }
Ejemplo n.º 19
0
 public TableManager(ILoggerFacade logger, ITableDataService tableDataService)
 {
     this._logger = logger;
     this._tableDataService = tableDataService;
     this._tableDataService.Serializer = new XmlSerializer(typeof(Table));
     this._tableCollection = new ObservableCollection<Table>();
 }
Ejemplo n.º 20
0
 public LocationInputViewModel(CompositionContainer container, ILoggerFacade loggerFacade, IEventAggregator eventAggregator)
 {
     this.Street = string.Empty;
     this.Number = string.Empty;
     this.City = string.Empty;
     this.PostCode = string.Empty;
     this.OkCommand = new DelegateCommand<object>(
     this.OnOKClicked, this.CanOKClicked);
     this.CancelCommand = new DelegateCommand<object>(
     this.OnCancelClicked, this.CanCancelClicked);
     this.MoveDownStopCommand = new DelegateCommand<object>(
     this.OnMoveDownCommand, this.CanMoveDownCommand);
     this.MoveUpStopCommand = new DelegateCommand<object>(
     this.OnMoveUpCommand, this.CanMoveUpCommand);
     this.DeleteStopCommand = new DelegateCommand<object>(
     this.OnDeleteStopCommand, this.CanDeleteStopCommand);
     this._container = container;
     this._loggerFacade = loggerFacade;
     this.eventAggregator = eventAggregator;
     mainTabEvent = eventAggregator.GetEvent<CompositePresentationEvent<MainTabInfo>>();
     _notificationErrorInteraction = new InteractionRequest<Notification>();
     this.LocationSelectedCommand = new DelegateCommand<object>(
     this.OnLocationSelected, this.CanLocationSelected);
     this.StopSelectedCommand = new DelegateCommand<object>(
     this.OnStopSelected, this.CanStopSelected);
     this.LocationsSelected = new ObservableCollection<GeoLocatorDetail>();
     this.LocationResults = new ObservableCollection<GeoLocatorDetail>();
     this.RouteDirections = new ObservableCollection<string>();
     this.SelectionVisibility = Visibility.Visible;
     this.StopsVisibility = Visibility.Collapsed;
     this.RouteDirectionsVisibility = Visibility.Collapsed;
 }
Ejemplo n.º 21
0
 public ReservationManager(ILoggerFacade logger, IReservationDataService reservationDataService)
 {
     this._logger = logger;
     this._reservationDataService = reservationDataService;
     this._reservationDataService.Serializer = new XmlSerializer(typeof(Reservation));
     this._reservationCollection = new ObservableCollection<Reservation>();
 }
Ejemplo n.º 22
0
 public DeleteWaypointDlgViewModel(IEventAggregator evtAggregator, ILoggerFacade logger)
 {
     _evtAggregator = evtAggregator;
     _logger = logger;
     _closeCommand = new DelegateCommand<FrameworkElement>(HandleCloseCmd);
     _deleteWpCommand = new DelegateCommand<FrameworkElement>(HandleDeleteCmd);
 }
Ejemplo n.º 23
0
        protected BaseViewModel(ILoggerFacade logger)
        {
            Requires.NotNull(logger, "logger");
            _logger = logger;

            Disposed = false;
        }
        public TransactionHistoryViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            UserContext userContext)
        {
            logger.Log("TransactionHistoryViewModel.TransactionHistoryViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            this.UserContext = userContext;
            this.Transactions = new ObservableCollection<TransactionSummary>();

            this.UpdateTransactionsCommand = new DelegateCommand<object>(this.UpdateTransactionsExecute);
            this.ResetFilterCommand = new DelegateCommand<object>(this.ResetFilterExecute);

            _tradingService.GetTransactionSummariesCompleted +=
                new EventHandler<GetTransactionSummariesCompletedEventArgs>(GetTransactionSummariesCallback);
            this.UserContext.PropertyChanged +=
                new PropertyChangedEventHandler(OnUserContextPropertyChanged);

            ResetFilter();
            SubscribeToEvents();
        }
Ejemplo n.º 25
0
        public PlaylistProvider(
            ISession session, 
            Dispatcher dispatcher,
            ILoggerFacade logger)
        {
            _session = session;
            _dispatcher = dispatcher;
            _logger = logger;
            _playlists = new ObservableCollection<Playlist>();

            if (_session.PlaylistContainer != null)
            {
                InitializePlaylistContainer();
            }
            else
            {
                _session.LoginComplete += (s, e) =>
                                              {
                                                  if (e.Status == Error.OK)
                                                  {
                                                      InitializePlaylistContainer();
                                                  }
                                              };
            }
        }
 public EmployeesViewModel(IUnityContainer container)
 {
     this.container = container;
     this.logger = this.container.Resolve<ILoggerFacade>();
     this.eventAggregator = this.container.Resolve<IEventAggregator>();
     this.modelService = this.container.Resolve<IModelService>();
     SubmitCommand = new DelegateCommand(this.OnSubmit);
 }
Ejemplo n.º 27
0
 public FileScheduler(SchedulerConfiguration configuration, ILoggerFacade logger)
     : base(configuration, logger)
 {
     if (this.logger != null)
     {
         this.logger.Log("FileScheduler is created.", Category.Info, Priority.High);
     }
 }
        public SampleAddEditInstrumentView(IUnityContainer container, Ace2ApiServiceModule api, ILoggerFacade log, 
            UiModel model, IEventAggregator eventAggregator)
        {
            InitializeComponent();

            _vm = new SampleAddEditInstrumentViewModel(container, api, log, model, eventAggregator);
            this.DataContext = _vm;
        }
		public SortedModuleInitializer(IUnityContainer container, ILoggerFacade logger, IEventAggregator eventAggregator)
		{
			_logger = logger;
			_eventAggregator = eventAggregator;
			DefaultInitializer = container.Resolve<IModuleInitializer>("defaultModuleInitializer");
			ModuleConfigs = LoadModuleConfig();
			container.RegisterInstance<IModuleConfigs>("ModuleConfigs", ModuleConfigs);
		}
Ejemplo n.º 30
0
        public ModuleTracker(ILoggerFacade logger)
        {
            if( logger==null )
                throw new ArgumentNullException("logger");
            _logger = logger;

            InitializeModules();
        }
Ejemplo n.º 31
0
        public RecentFilesView(
            ILoggerFacade logger,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session)
        {
            m_PropertyChangeHandler = new PropertyChangedNotifyBase();
            m_PropertyChangeHandler.InitializeDependentProperties(this);

            m_Logger    = logger;
            m_ShellView = shellView;
            m_Session   = session;

            resetList();

            DataContext = this;
            InitializeComponent();

            intializeCommands();
        }
Ejemplo n.º 32
0
        public ChatViewModel(IUnityContainer container, IEventAggregator eventAggregator,
                             ILoggerFacade logger, IRegionManager regionManager)
        {
            if (container == null || eventAggregator == null ||
                logger == null || regionManager == null)
            {
                throw new ArgumentException();
            }

            this._container       = container;
            this._eventAggregator = eventAggregator;
            this._logger          = logger;
            this._regionManager   = regionManager;

            Messages = new ObservableCollection <Message>();

            ButtonSend = new DelegateCommand(async() => { await this.ButtonSendClicked(); });

            this._eventAggregator.GetEvent <MessageReceivedEvent>()
            .Subscribe(this.MessageReceivedEventHandler, ThreadOption.UIThread, false, this.MessageReceivedEventFilter);
        }
Ejemplo n.º 33
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="param">DashboardGadgetparam</param>
 public ViewModelIndexConstituents(DashboardGadgetParam param)
 {
     eventAggregator        = param.EventAggregator;
     dbInteractivity        = param.DBInteractivity;
     logger                 = param.LoggerFacade;
     PortfolioSelectionData = param.DashboardGadgetPayload.PortfolioSelectionData;
     EffectiveDate          = param.DashboardGadgetPayload.EffectiveDate;
     lookThruEnabled        = param.DashboardGadgetPayload.IsLookThruEnabled;
     if ((portfolioSelectionData != null) && (EffectiveDate != null) && IsActive)
     {
         dbInteractivity.RetrieveIndexConstituentsData(portfolioSelectionData, Convert.ToDateTime(effectiveDateInfo), lookThruEnabled,
                                                       RetrieveIndexConstituentsDataCallbackMethod);
         BusyIndicatorStatus = true;
     }
     if (eventAggregator != null)
     {
         eventAggregator.GetEvent <PortfolioReferenceSetEvent>().Subscribe(HandlePortfolioReferenceSet);
         eventAggregator.GetEvent <EffectiveDateReferenceSetEvent>().Subscribe(HandleEffectiveDateSet);
         eventAggregator.GetEvent <LookThruFilterReferenceSetEvent>().Subscribe(HandleLookThruReferenceSetEvent);
     }
 }
Ejemplo n.º 34
0
        public MenuBarPlugin(
            ILoggerFacade logger,
            IRegionManager regionManager
            //,[Import(typeof(IMenuBarView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            //MenuBarView menuBarsView
            )
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            //m_MenuBarView = menuBarsView;


            //m_RegionManager.RegisterViewWithRegion(RegionNames.MenuBar, typeof(IMenuBarView));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.MenuBar];
            //targetRegion.Add(m_MenuBarView);
            //targetRegion.Activate(m_MenuBarView);

            //m_Logger.Log(@"MenuBar pushed to region", Category.Debug, Priority.Medium);
        }
Ejemplo n.º 35
0
        public MovingAverageViewModel(WpfStrategy strategy, IHelperFactoryContainer iHelperFactoryContainer,
                                      Dispatcher UiDispatcher, ILoggerFacade logger)
            : base(strategy, iHelperFactoryContainer, UiDispatcher, logger)
        {
            var chartHelper = ServiceLocator.Current.GetInstance <IChartHelper>();

            TimeFormatter  = chartHelper.TimeFormatter;
            PriceFormatter = chartHelper.PriceFormatter;

            IsActive           = false;
            IsLoadingTrades    = true;
            IsLoadingOrderBook = true;

            cancellationTokenSource = new CancellationTokenSource();

            tradeHelperFactory = HelperFactoryContainer.GetFactory <ITradeHelperFactory>();

            orderBookHelperFactory = HelperFactoryContainer.GetFactory <IOrderBookHelperFactory>();

            ShowCandlesticks = Strategy.StrategySubscriptions.Any(s => s.SubscribeCandlesticks);
        }
Ejemplo n.º 36
0
        /// <summary>
        /// Initializes an instance of the <see cref="ModuleManager"/> class.
        /// </summary>
        /// <param name="moduleInitializer">Service used for initialization of modules.</param>
        /// <param name="moduleCatalog">Catalog that enumerates the modules to be loaded and initialized.</param>
        /// <param name="loggerFacade">Logger used during the load and initialization of modules.</param>
        public ModuleManager(IModuleInitializer moduleInitializer, IModuleCatalog moduleCatalog, ILoggerFacade loggerFacade)
        {
            if (moduleInitializer == null)
            {
                throw new ArgumentNullException(nameof(moduleInitializer));
            }

            if (moduleCatalog == null)
            {
                throw new ArgumentNullException(nameof(moduleCatalog));
            }

            if (loggerFacade == null)
            {
                throw new ArgumentNullException(nameof(loggerFacade));
            }

            this.moduleInitializer = moduleInitializer;
            this.moduleCatalog     = moduleCatalog;
            this.loggerFacade      = loggerFacade;
        }
Ejemplo n.º 37
0
        public DescriptionsViewModel(
            IEventAggregator eventAggregator,
            IUnityContainer container,
            ILoggerFacade logger,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session
            )
        {
            m_EventAggregator = eventAggregator;
            m_Container       = container;
            m_Logger          = logger;

            m_UrakawaSession = session;

            ShowAdvancedEditor = false;

            m_EventAggregator.GetEvent <ProjectLoadedEvent>().Subscribe(OnProjectLoaded, ProjectLoadedEvent.THREAD_OPTION);
            m_EventAggregator.GetEvent <ProjectUnLoadedEvent>().Subscribe(OnProjectUnLoaded, ProjectUnLoadedEvent.THREAD_OPTION);

            m_EventAggregator.GetEvent <TreeNodeSelectionChangedEvent>().Subscribe(OnTreeNodeSelectionChanged, TreeNodeSelectionChangedEvent.THREAD_OPTION);
        }
Ejemplo n.º 38
0
        public ValidatorAggregator(
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            [ImportMany(typeof(IValidator), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition = false)]
            IEnumerable <IValidator> validators,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session)
        {
            m_EventAggregator = eventAggregator;
            m_UrakawaSession  = session;
            m_Logger          = logger;

            foreach (IValidator validator in validators)
            {
                m_Validators.Add(validator);
                validator.ValidatorStateRefreshed += OnValidatorStateRefreshed;
            }

            //m_EventAggregator.GetEvent<ProjectLoadedEvent>().Subscribe(OnProjectLoaded, ProjectLoadedEvent.THREAD_OPTION);
            //m_EventAggregator.GetEvent<ProjectUnLoadedEvent>().Subscribe(OnProjectUnLoaded, ProjectUnLoadedEvent.THREAD_OPTION);
        }
Ejemplo n.º 39
0
 public SqlCeDatabase(ILoggerFacade logger, DatabaseType databaseType = DatabaseType.SqlCe)
     : base(databaseType)
 {
     Logger = logger;
     if (_connection == null)
     {
         throw new Exception("not get a connection!");
     }
     if (!_connection.IsConnected)
     {
         throw new Exception(GetConnectionBase().ErrorMsg);
     }
     RegisterColumnType(DbType.AnsiStringFixedLength, "NCHAR(255)");
     RegisterColumnType(DbType.AnsiStringFixedLength, 4000, "NCHAR($l)");
     RegisterColumnType(DbType.AnsiString, "NVARCHAR(255)");
     RegisterColumnType(DbType.AnsiString, 4000, "NVARCHAR($l)");
     RegisterColumnType(DbType.AnsiString, 1073741823, "NTEXT");
     RegisterColumnType(DbType.Binary, "VARBINARY(8000)");
     RegisterColumnType(DbType.Binary, 8000, "VARBINARY($l)");
     RegisterColumnType(DbType.Binary, 1073741823, "IMAGE");
     RegisterColumnType(DbType.Boolean, "BIT");
     RegisterColumnType(DbType.Byte, "TINYINT");
     RegisterColumnType(DbType.Currency, "MONEY");
     RegisterColumnType(DbType.Date, "DATETIME");
     RegisterColumnType(DbType.DateTime, "DATETIME");
     RegisterColumnType(DbType.Decimal, "NUMERIC(19,5)");
     RegisterColumnType(DbType.Decimal, 19, "NUMERIC($p, $s)");
     RegisterColumnType(DbType.Double, "FLOAT");
     RegisterColumnType(DbType.Guid, "UNIQUEIDENTIFIER");
     RegisterColumnType(DbType.Int16, "SMALLINT");
     RegisterColumnType(DbType.Int32, "INT");
     RegisterColumnType(DbType.Int64, "BIGINT");
     RegisterColumnType(DbType.Single, "REAL"); //synonym for FLOAT(24)
     RegisterColumnType(DbType.StringFixedLength, "NCHAR(255)");
     RegisterColumnType(DbType.StringFixedLength, 4000, "NCHAR($l)");
     RegisterColumnType(DbType.String, "NVARCHAR(255)");
     RegisterColumnType(DbType.String, 4000, "NVARCHAR($l)");
     RegisterColumnType(DbType.String, 1073741823, "NTEXT");
     RegisterColumnType(DbType.Time, "DATETIME");
 }
Ejemplo n.º 40
0
        public Dataflow(
            ExportFactory <IFileSystem> fileSystemFactory,
            ILoggerFacade logger)
        {
            this._logger            = logger;
            this._fileSystemFactory = fileSystemFactory;

            var parallelBlockOptions = new ExecutionDataflowBlockOptions
            {
                BoundedCapacity        = 10,
                MaxDegreeOfParallelism = Math.Max(1, Environment.ProcessorCount - 1)
            };

            var linkOptions = new DataflowLinkOptions
            {
                PropagateCompletion = true
            };

            // create the dataflow blocks
            var readFileBlock          = new TransformBlock <string, Tuple <string, string[]> >(filePath => ReadFileContents(filePath), parallelBlockOptions);
            var breakIntoSectionsBlock = new TransformManyBlock <Tuple <string, string[]>, FileSection>(fileInfo => BreakIntoSections(fileInfo), parallelBlockOptions);
            var printBlock             = new ActionBlock <FileSection>(
                section => PrintResults(section),
                new ExecutionDataflowBlockOptions
            {
                MaxDegreeOfParallelism = 1
            });

            InputBlock = readFileBlock;
            Completion = printBlock.Completion;

            // link dataflow blocks together
            readFileBlock.LinkTo(breakIntoSectionsBlock, linkOptions);
            breakIntoSectionsBlock.LinkTo(printBlock, linkOptions);

            // debug task completion
            DebugCompletion(readFileBlock, "Read File Block");
            DebugCompletion(breakIntoSectionsBlock, "Break Into Sections Block");
            DebugCompletion(printBlock, "Print Block");
        }
Ejemplo n.º 41
0
        public FriendsViewModel(ILoggerFacade logger, IRegionManager regionManager, IEventAggregator eventAggregator,
                                ICollectFriendsService collectFriendsService, IGetRoomInfoService getRoomInfoService, IFriendsMainViewModel friendsMainViewModel)
        {
            if (null == logger)
            {
                throw new ArgumentNullException("logger");
            }
            if (null == regionManager)
            {
                throw new ArgumentNullException("regionManager");
            }
            if (null == eventAggregator)
            {
                throw new ArgumentNullException("eventAggregator");
            }
            if (null == collectFriendsService)
            {
                throw new ArgumentNullException("collectFriendsService");
            }
            if (null == getRoomInfoService)
            {
                throw new ArgumentNullException("getRoomInfoService");
            }
            if (null == friendsMainViewModel)
            {
                throw new ArgumentNullException("friendsMainViewModel");
            }

            this.m_Logger                = logger;
            this.m_RegionManager         = regionManager;
            this.m_EventAggregator       = eventAggregator;
            this.m_CollectFriendsService = collectFriendsService;
            this.m_GetRoomInfoService    = getRoomInfoService;
            this.FriendsMainViewModel    = friendsMainViewModel;

            this.NavigateToForwardCommand = new DelegateCommand(ExecuteNavigateToForwardCommand);
            this.ItemDoubleClickedCommand = new DelegateCommand <Friend>(ExecuteItemDoubleClickedCommand);

            Task.Run(() => m_CollectFriendsService.CollectFriends(AuthRepository.MQKeyInfo.UserSid, friendsMainViewModel.Friends));
        }
Ejemplo n.º 42
0
        public DescriptionsNavigationPlugin(
            ILoggerFacade logger,
            IRegionManager regionManager,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(DescriptionsNavigationView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsNavigationView pane,
            [Import(typeof(DescriptionsNavigationViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsNavigationViewModel viewModel
            )
        {
            m_Logger        = logger;
            m_RegionManager = regionManager;

            m_UrakawaSession           = session;
            m_ShellView                = shellView;
            m_DescriptionsNavView      = pane;
            m_DescriptionsNavViewModel = viewModel;

            // Remark: using direct access instead of delayed lookup (via the region registry)
            // generates an exception, because the region does not exist yet (see "parent" plugin constructor, RegionManager.SetRegionManager(), etc.)

            m_RegionManager.RegisterNamedViewWithRegion(RegionNames.NavigationPaneTabs,
                                                        new PreferredPositionNamedView
            {
                m_viewInstance          = m_DescriptionsNavView,
                m_viewName              = @"ViewOf_" + RegionNames.NavigationPaneTabs + @"_Descriptions",
                m_viewPreferredPosition = PreferredPosition.Last
            });

            //m_RegionManager.RegisterViewWithRegion(RegionNames.NavigationPaneTabs, typeof(IDescriptionsNavigationView));

            //IRegion targetRegion = m_RegionManager.Regions[RegionNames.NavigationPaneTabs];
            //targetRegion.Add(m_DescriptionsNavView);
            //targetRegion.Activate(m_DescriptionsNavView);

            //m_Logger.Log(@"Navigation pane plugin initializing...", Category.Debug, Priority.Medium);
        }
Ejemplo n.º 43
0
        public HeadingPaneViewModel(
            IEventAggregator eventAggregator,
            ILoggerFacade logger,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView view,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session)
        {
            //Container = container;
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            m_ShellView = view;
            m_session   = session;

            intializeCommands();

            m_EventAggregator.GetEvent <ProjectLoadedEvent>().Subscribe(onProjectLoaded, ProjectLoadedEvent.THREAD_OPTION);
            m_EventAggregator.GetEvent <ProjectUnLoadedEvent>().Subscribe(onProjectUnLoaded, ProjectUnLoadedEvent.THREAD_OPTION);

            m_EventAggregator.GetEvent <TreeNodeSelectionChangedEvent>().Subscribe(OnTreeNodeSelectionChanged, TreeNodeSelectionChangedEvent.THREAD_OPTION);
        }
Ejemplo n.º 44
0
        public ChatSplitViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,
                                  ILoggerFacade logger, HubConnection connection)
        {
            if (regionManager == null || eventAggregator == null ||
                logger == null || connection == null)
            {
                throw new ArgumentException();
            }

            this._regionManager   = regionManager;
            this._eventAggregator = eventAggregator;
            this._logger          = logger;
            this._connection      = connection;

            // Set as RegionContext in order to make the connection available to all
            // other hostet child views.
            this._regionManager.Regions[MainWindowRegionNames.MAIN_REGION].Context = connection;

            this._connection.Closed += this.WebsocketConnectionLost;
            this._connection.On("PongAsync", this.HandleResponse);
            this._connection.On <Message>("ReceiveMessageAsync", this.HandleReceiveMessage);
        }
Ejemplo n.º 45
0
 private async Task DoExecuteAsync(Func <CancellationToken, Task> taskFunc, ILoggerFacade logger, TaskContext tc, CancellationToken ct)
 {
     try
     {
         await ct.TimeoutAsync(taskFunc, tc.MillisecondsTimeout);
     }
     catch (TimeoutException)
     {
         LogTimeout(logger, tc);
         throw;
     }
     catch (CallerOperationTimeoutException)
     {
         LogCallerTimeout(logger, tc);
         throw;
     }
     catch (OperationCanceledByCallerException)
     {
         LogCallerCancel(logger, tc);
         throw;
     }
 }
Ejemplo n.º 46
0
        public SearchViewModel(IServiceProxy services, ILoggerFacade logger, IEventAggregator eventAggregator)
        {
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            this.services        = services;
            this.logger          = logger;
            this.eventAggregator = eventAggregator;

            SearchResults = new ObservableCollection <Customer>();
            SearchCommand = new RelayCommand(SearchCommandOnExecute, SearchCommandCanExecute);
        }
Ejemplo n.º 47
0
        public HomeViewModel(IServiceProxy services, ILoggerFacade logger, IEventAggregator eventAggregator)
        {
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (eventAggregator == null)
            {
                throw new ArgumentNullException("eventAggregator");
            }

            this.services        = services;
            this.logger          = logger;
            this.eventAggregator = eventAggregator;

            RefreshCommand = new RelayCommand(RefreshCommandOnExecute, RefreshCommandCanExecute);
            this.LoadStats();
        }
Ejemplo n.º 48
0
        /// <summary>
        /// 构造
        /// </summary>
        /// <param name="container"></param>
        /// <param name="dsconfig"></param>
        protected ModuleBase(IApplicationContext container, IDsConfigurationSection dsconfig)
        {
//#if DEBUG

//            Debugger.Launch();

//#endif
            logger = new LoggerFacade(this.GetType());
            DsConfigurationManager dcm = new DsConfigurationManager();
            Assembly a           = this.GetType().Assembly;
            string   contextName = a.GetName().Name.ToLower();

            ParentContaioner = container;
            //初始化环境信息
            this.InitializationDsEnvironment(dsconfig, a.FullName);
            logger.Debug("{0} Plug-ins start loading".FormatString(AddinInfo.AddinName));
            //SyncInfo(dcm);
            if (File.Exists(AddinInfo.ConfigurationFilePath))
            {
                System.Configuration.Configuration ecs = dcm.Get <System.Configuration.Configuration>(AddinInfo.ConfigurationFilePath);
                if (ecs == null)
                {
                    logger.Error("{0} Configuration file loading exception, configuration file does not exist!".FormatString(AddinInfo.AddinName));
                }
                CurrentAddinConfiguration   = ecs;
                this.DsConfigurationSection = dsconfig;
                AddinConfigurationList.TryAdd(AddinInfo.AddinName, ecs);

                ParentContaioner.RegisterInstance(this);
                Container = ChildContainer.Create(container, contextName, ecs);

                GlobalObject.SetAddinContanier(AddinInfo.AddinName, Container);
                //初始化WCF服务
                WCFServiceContainer.Create(contextName, CurrentAddinConfiguration);
                //初始化Socket服务
                SocketServiceContainer.Create(CurrentAddinConfiguration);
            }
            logger.Debug("{0} Plug-in loaded".FormatString(AddinInfo.AddinName));
        }
 /// <summary>
 /// Constructor of the class that initializes various objects
 /// </summary>
 /// <param name="param">MEF Eventaggrigator instance</param>
 public ViewModelPerformanceGadget(DashboardGadgetParam param)
 {
     dbInteractivity        = param.DBInteractivity;
     logger                 = param.LoggerFacade;
     eventAggregator        = param.EventAggregator;
     portfolioSelectionData = param.DashboardGadgetPayload.PortfolioSelectionData;
     effectiveDate          = param.DashboardGadgetPayload.EffectiveDate;
     country                = param.DashboardGadgetPayload.HeatMapCountryData;
     selectedPeriod         = param.DashboardGadgetPayload.PeriodSelectionData;
     if (effectiveDate != null && portfolioSelectionData != null && selectedPeriod != null && IsActive)
     {
         dbInteractivity.RetrievePerformanceGraphData(portfolioSelectionData, Convert.ToDateTime(effectiveDate), selectedPeriod, "NoFiltering",
                                                      RetrievePerformanceGraphDataCallBackMethod);
     }
     if (eventAggregator != null)
     {
         eventAggregator.GetEvent <PortfolioReferenceSetEvent>().Subscribe(HandlePortfolioReferenceSet, false);
         eventAggregator.GetEvent <EffectiveDateReferenceSetEvent>().Subscribe(HandleEffectiveDateSet, false);
         eventAggregator.GetEvent <PeriodReferenceSetEvent>().Subscribe(HandlePeriodReferenceSet, false);
         eventAggregator.GetEvent <HeatMapClickEvent>().Subscribe(HandleCountrySelectionDataSet, false);
     }
 }
        public SettingsAggregator(
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            [ImportMany(typeof(ISettingsProvider), RequiredCreationPolicy = CreationPolicy.Shared, AllowRecomposition = false)]
            IEnumerable <ISettingsProvider> settingsProviders)
        {
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            m_SettingsProviders = settingsProviders;

            if (Tobi.Common.Settings.Default.UpgradeSettings)
            {
                UpgradeAll();
                Tobi.Common.Settings.Default.UpgradeSettings = false;
            }

            // Make sure we mark all the settings so that they all show in persistant storage next time we save.
            MarkAllAsChanged();

            SaveAll();
        }
Ejemplo n.º 51
0
        public HeadingPanelView(
            IEventAggregator eventAggregator,
            ILoggerFacade logger,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession urakawaSession,
            [Import(typeof(HeadingPaneViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            HeadingPaneViewModel viewModel)
        {
            m_UrakawaSession  = urakawaSession;
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;

            m_ViewModel = viewModel;
            DataContext = m_ViewModel;

            m_ignoreTreeNodeSelectedEvent = false;
            //m_ignoreHeadingSelected = false;

            InitializeComponent();

            m_ViewModel.SetView(this);
        }
Ejemplo n.º 52
0
 public CoreRadio(
     [Import("CorePlayer")] ITrackPlayer corePlayer,
     IDocumentStore documentStore,
     ILoadingIndicatorService loadingIndicatorService,
     IToastService toastService,
     ILoggerFacade logger,
     Dispatcher dispatcher)
 {
     _trackQueuePublic        = new ObservableCollection <Track>();
     _trackStreamQueuePublic  = new ObservableCollection <ITrackStream>();
     _trackStreamQueue        = new ConcurrentQueue <ITrackStream>();
     _trackQueue              = new ConcurrentQueue <Track>();
     _corePlayer              = corePlayer;
     _documentStore           = documentStore;
     _loadingIndicatorService = loadingIndicatorService;
     _toastService            = toastService;
     _logger                    = logger;
     _dispatcher                = dispatcher;
     _corePlayer.Volume         = 0.2;
     _corePlayer.TrackComplete += OnTrackComplete;
     _corePlayer.Initialize();
 }
Ejemplo n.º 53
0
        public ViewModelLoginForm(IManageLogins manageLogins, IManageSessions manageSessions, IRegionManager regionManager, ILoggerFacade logger)
        {
            _manageLogins   = manageLogins;
            _manageSessions = manageSessions;
            _regionManager  = regionManager;
            _logger         = logger;

            //try
            //{
            //    if (_manageSessions != null)
            //    {
            //        #region GetSession Service Call
            //        _manageSessions.GetSession((result) =>
            //        {
            //            string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name);
            //            if (result != null)
            //            {
            //                try
            //                {
            //                    Session session = result as Session;
            //                    Logging.LogMethodParameter(_logger, methodNamespace, result.ToString(), 1, result.UserName);
            //                    Logging.LogSessionClose(_logger, result.UserName);
            //                }
            //                catch (Exception ex)
            //                {
            //                    Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK);
            //                    Logging.LogException(_logger, ex);
            //                }
            //            }
            //        });
            //        #endregion
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK);
            //    Logging.LogLoginException(_logger, ex);
            //}
        }
Ejemplo n.º 54
0
        public QuoteDispatcherService(IQuoteUpdateService quoteviewupdateservvice, IStrategyQuoteFeedService feedstrategyquoteservice, TickArchiver tickarchiveservice, ILoggerFacade logger, BlockingCollection <Tick> tickqueue)
        {
            this._quoteviewupdateservice   = quoteviewupdateservvice;
            this._feedstrategyquoteservice = feedstrategyquoteservice;
            this._tickarchiveservice       = tickarchiveservice;
            this._tickqueue = tickqueue;
            this._logger    = logger;
            ConfigManager conf = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <IConfigManager>() as ConfigManager;

            sampletime_ = conf.TickSampleTime;

            IObservable <MyEventArgs <Tick> > tickObservable = System.Reactive.Linq.Observable.FromEvent <MyEventArgs <Tick> >(
                h => TickReceived += h, h => TickReceived -= h);

            // only select trade
            // .BufferWithTime(TimeSpan.FromMilliseconds(_od))
            // .Where(x => x.Count > 0)
            // .Subscribe(DataReceived, LogError);
            tickObservable.Where(e => e.Value.IsTrade).GroupBy(e => e.Value.FullSymbol)
            .Subscribe(group => group.Sample(TimeSpan.FromSeconds(sampletime_))
                       .Subscribe(QuoteDispatcher));
        }
Ejemplo n.º 55
0
 public static void LogBeginMethod(ILoggerFacade logger, string methodNamespace, string userName = "")
 {
     if (userName == "")
     {
         if (logger != null && SessionManager.SESSION != null)
         {
             logger.Log("|User[(" + SessionManager.SESSION.UserName.Replace(Environment.NewLine, " ")
                        + ")]|Type[(BeginMethod"
                        + ")]|MethodNameSpace[(" + methodNamespace.Replace(Environment.NewLine, " ")
                        + ")]|TimeStamp[(" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss,fff").Replace(Environment.NewLine, " ")
                        + ")]", Category.Info, Priority.None);
         }
     }
     else
     {
         logger.Log("|User[(" + userName.Replace(Environment.NewLine, " ")
                    + ")]|Type[(BeginMethod"
                    + ")]|MethodNameSpace[(" + methodNamespace.Replace(Environment.NewLine, " ")
                    + ")]|TimeStamp[(" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss,fff").Replace(Environment.NewLine, " ")
                    + ")]", Category.Info, Priority.None);
     }
 }
Ejemplo n.º 56
0
        public LoginViewModel(ILoggerFacade logger, IUnityContainer unityContainer, IRegionManager regionManager,
                              IEventAggregator eventAggregator, ITrackSuccessConnectionService trackService)
        {
            if (null == logger)
            {
                throw new ArgumentNullException("logger");
            }
            if (null == unityContainer)
            {
                throw new ArgumentNullException("unityContainer");
            }
            if (null == regionManager)
            {
                throw new ArgumentNullException("regionManager");
            }
            if (null == eventAggregator)
            {
                throw new ArgumentNullException("eventAggregator");
            }
            if (null == trackService)
            {
                throw new ArgumentNullException("trackService");
            }

            this.m_Logger          = logger;
            this.m_UnityContainer  = unityContainer;
            this.m_RegionManager   = regionManager;
            this.m_EventAggregator = eventAggregator;

            this.LoginModel                      = new LoginModel();
            this.LoginCommand                    = new DelegateCommand <UIElement>(ExecuteLogin, CanExecuteLogin);
            this.TextChangedCommand              = new DelegateCommand(ExecuteTextChanged);
            this.NavigateToCommand               = new DelegateCommand <Uri>(ExecuteNavigateTo);
            this.InitialFocusCommand             = new DelegateCommand <UIElement>(ExecuteInitialFocusCommand);
            this.InitialLoadedCommand            = new DelegateCommand <SmoothBusyIndicator>(ExecuteInitialLoadedCommand);
            this.NavigateRequiredInfoViewCommand = new DelegateCommand(ExecuteNavigateRequiredInfoViewCommand);

            this.ConnectedIdentifications = trackService.GetListOfSuccessConnections();
        }
Ejemplo n.º 57
0
        public ViewDashboard(IManageDashboard manageDashboard, ILoggerFacade logger,
                             IEventAggregator eventAggregator, IDBInteractivity dbInteractivity, IRegionManager regionManager)
        {
            InitializeComponent();

            //Initialize MEF singletons
            this.eventAggregator = eventAggregator;
            this.manageDashboard = manageDashboard;
            this.logger          = logger;
            this.dbInteractivity = dbInteractivity;
            this.regionManager   = regionManager;
            //Subscribe to MEF Events
            eventAggregator.GetEvent <DashboardGadgetSave>().Subscribe(HandleDashboardGadgetSave);
            eventAggregator.GetEvent <DashboardGadgetLoad>().Subscribe(HandleDashboardGadgetLoad);
            eventAggregator.GetEvent <DashboardTileViewItemAdded>().Subscribe(HandleDashboardTileViewItemAdded);

            //Check for Empty Dashboard
            this.rtvDashboard.LayoutUpdated += (se, e) =>
            {
                this.txtNoGadgetMessage.Visibility = this.rtvDashboard.Items.Count == 0 ? Visibility.Visible : Visibility.Collapsed;
                this.rtvDashboard.Visibility       = this.rtvDashboard.Items.Count == 0 ? Visibility.Collapsed : Visibility.Visible;
                for (int index = 0; index < rtvDashboard.Items.Count; index++)
                {
                    (rtvDashboard.Items[index] as RadTileViewItem).Opacity =
                        (rtvDashboard.Items[index] as RadTileViewItem).TileState == TileViewItemState.Minimized ? 0.5 : 1;
                }
            };

            this.rtvDashboard.TileStateChanged += (se, e) =>
            {
                if (this.rtvDashboard.Items.Count == 1)
                {
                    if ((e.Source as RadTileViewItem).TileState != TileViewItemState.Maximized)
                    {
                        (e.Source as RadTileViewItem).TileState = TileViewItemState.Maximized;
                    }
                }
            };
        }
Ejemplo n.º 58
0
        internal FrameFacade(Frame frame, INavigationService navigationService, string id)
        {
            _frame = frame;
            _frame.ContentTransitions = new TransitionCollection
            {
                new NavigationThemeTransition()
            };
            _frame.RegisterPropertyChangedCallback(Frame.CanGoBackProperty, (s, p)
                                                   => CanGoBackChanged?.Invoke(this, EventArgs.Empty));
            _frame.RegisterPropertyChangedCallback(Frame.CanGoForwardProperty, (s, p)
                                                   => CanGoForwardChanged?.Invoke(this, EventArgs.Empty));

            _dispatcher        = frame.Dispatcher;
            _syncContext       = SynchronizationContext.Current;
            _navigationService = navigationService;
            _logger            = ApplicationTemplate.Current.Container.Resolve <ILoggerFacade>();

            if (id != null)
            {
                Id = id;
            }
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Run the bootstrapper process.
        /// </summary>
        /// <param name="useDefaultConfiguration">If <see langword="true"/>, registers default Composite Application Library services in the container. This is the default behavior.</param>
        public void Run(bool useDefaultConfiguration)
        {
            _useDefaultConfiguration = useDefaultConfiguration;
            ILoggerFacade logger = LoggerFacade;

            if (logger == null)
            {
                throw new InvalidOperationException(Resources.NullLoggerFacadeException);
            }

            logger.Log("Creating Unity container", Category.Debug, Priority.Low);
            Container = CreateContainer();
            if (Container == null)
            {
                throw new InvalidOperationException(Resources.NullUnityContainerException);
            }

            logger.Log("Configuring container", Category.Debug, Priority.Low);

            ConfigureContainer();

            logger.Log("Configuring region adapters", Category.Debug, Priority.Low);

            ConfigureRegionAdapterMappings();

            logger.Log("Creating shell", Category.Debug, Priority.Low);
            DependencyObject shell = CreateShell();

            if (shell != null)
            {
                RegionManager.SetRegionManager(shell, Container.Resolve <IRegionManager>());
            }

            logger.Log("Initializing modules", Category.Debug, Priority.Low);
            InitializeModules();

            logger.Log("Bootstrapper sequence completed", Category.Debug, Priority.Low);
        }
Ejemplo n.º 60
0
        public static ChartValues <T> GetNewTradesChart <T>(
            IEnumerable <ITrade> tradesUpdate,
            Func <ITrade, T> create,
            int tradesChartDisplayCount,
            ILoggerFacade logger) where T : TradeBase, new()
        {
            ChartValues <T> tradesChart;

            var sw = new Stopwatch();

            sw.Start();
            logger.Log($"Start GetTradesChart<{typeof(T).Name}>", Category.Info, Priority.Low);

            // Order by oldest to newest (as it will appear in the chart).
            var newTrades = (from t in tradesUpdate
                             orderby t.Time, t.Id
                             select create(t)).ToList();

            var newTradesCount = newTrades.Count;

            if (newTradesCount > tradesChartDisplayCount)
            {
                // More new trades than the chart can take, only takes the newest trades.
                var chartTrades = newTrades.Skip(newTradesCount - tradesChartDisplayCount).ToList();
                tradesChart = new ChartValues <T>(chartTrades);
            }
            else
            {
                // New trades less (or equal) the
                // total trades to show in the chart.
                tradesChart = new ChartValues <T>(newTrades);
            }

            sw.Stop();
            logger.Log($"End GetTradesChart<{typeof(T).Name}> {sw.Elapsed}", Category.Info, Priority.Low);

            return(tradesChart);
        }