public Service()
		{
			DataService = ServiceLocator.Current.GetInstance<IDataService>();
			Logger = ServiceLocator.Current.GetInstance<ILoggerFacade>();
			Logger.Log("${SolutionName} BusinessService was successfully retrieved from container.",
				Category.Info, Priority.None);
			Logger.Log("${SolutionName} Logger for BusinessService was successfully retrieved from container.",
				Category.Info, Priority.None);			
		}
        public async Task <bool> UpdatePlayedSong(AllJoinedTable selectedSong, int?rating = null)
        {
            if (rating != null && rating > 0)
            {
                _loggerFacade?.Log($"Changing song rating ID: {selectedSong.Id}, Rating: {rating}", Category.Debug, Priority.Medium);
            }
            else
            {
                _loggerFacade?.Log($"Updating played song: {selectedSong.Id}", Category.Debug, Priority.Medium);
            }

            return(await _horsifySongApi.UpdatePlayedSongAsync(selectedSong.Id, rating));
        }
示例#3
0
        public void CollectFriends(string strUserSID, FriendCollection friends)
        {
            m_Logger.Log("Mocking CollectFriends Raised", Category.Info, Priority.None);

            Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(() =>
            {
                friends.Add(new Friend(null, "", "Paul", "Bye! See you!", TDD));
                friends.Add(new Friend(null, "", "Jacob", "Really?", CI));
                friends.Add(new Friend(null, "", "Michael", "When is your birthday?", CI));
                friends.Add(new Friend(null, "", "Alexander", "Oh, i see...", SA));
                friends.Add(new Friend(null, "", "William", "Anyway, i will get there", SE));
                friends.Add(new Friend(null, "", "Joshua", "Shut up!!!", DP));
                friends.Add(new Friend(null, "", "Daniel", "Can i see?", TDD));
                friends.Add(new Friend(null, "", "Jayden ", "i wanaa go home....ohoh", DP));
                friends.Add(new Friend(null, "", "Noah ", "tell me how am i supposed live without you..?", SA));
                friends.Add(new Friend(null, "", "Anthony", "Bye! bye...bye...", CI));
                friends.Add(new Friend(null, "", "Christopher", "i'm Crying now...", SE));
                friends.Add(new Friend(null, "", "Aiden", "Did you see that?", SA));
                friends.Add(new Friend(null, "", "Matthew", "Maybe. On september?", SE));
                friends.Add(new Friend(null, "", "David", "How are you David?", SA));
                friends.Add(new Friend(null, "", "Andrew", "Just 3 days remain..", DP));
                friends.Add(new Friend(null, "", "Joseph ", "Remember!", TDD));
                friends.Add(new Friend(null, "", "Logan", "Perfect! wonderful!!", CI));
                friends.Add(new Friend(null, "", "Ryan", "let me see your info..", SA));
            }));
        }
 public void Log(string message, Category category, Priority priority)
 {
     if (_loggerFacade != null)
     {
         _loggerFacade.Log(message, category, priority);
     }
 }
示例#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();
        }
示例#6
0
        public override void Dispose()
        {
            m_RegionManager.Regions[RegionNames.MenuBar].Deactivate(m_MenuBarView);
            m_RegionManager.Regions[RegionNames.MenuBar].Remove(m_MenuBarView);

            m_Logger.Log(@"MenuBar removed from region", Category.Debug, Priority.Medium);
        }
示例#7
0
        public void CollectRooms(RoomCollection rooms, string strMySid)
        {
            m_Logger.Log("Mocking CollectRooms Raised", Category.Info, Priority.None);

            /*
             * rooms.Add(new RoomEntity
             *  ("0", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/1.png", UriKind.Relative))
             *  , "Paul", 0,2, "Bye! See you!", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("1", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/2.png", UriKind.Relative)),
             *  "Jacob, Angel ,Lucas,Grace  ", 5, 0, "Really?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("2", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/3.png", UriKind.Relative)),
             *  "Michael , Landon ,Isaac ", 4, 38, "When is your birthday?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("3", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/4.png", UriKind.Relative)),
             *  "Alexander , Evan ,Isaiah,Taylor,Hannah  ", 6, 0, "Oh, i see...", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "4", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/5.png", UriKind.Relative)),
             *  "William , Mason ,Emma ", 4, 17, "Anyway, i will get there", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "5", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/6.png", UriKind.Relative)),
             *  "Joshua , Gavin ,Olivia ", 4, 0, "Shut up!!!", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("6", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/7.png", UriKind.Relative)),
             *  "Daniel , Nicholas ,Sophia ", 4, 0, "Can i see?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "7", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/8.png", UriKind.Relative)),
             *  "Jayden , Caleb ,Ava ", 4, 0, "i wanaa go home....ohoh", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "8", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/9.png", UriKind.Relative)),
             *  "Noah , Jonathan ,Emily ", 4, 0, "tell me how am i supposed live without you..?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "9", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/10.png", UriKind.Relative)),
             *  "Anthony , Dylan ,Madison ", 4, 0, "Bye! bye...bye...", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "10", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/11.png", UriKind.Relative)),
             *  "Christopher , Tyler ,Abigail ", 4, 0, "i'm Crying now...", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "11", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/12.png", UriKind.Relative)),
             *  "Aiden , Samuel ,Chloe ", 4, 0, "Did you see that?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "12", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/13.png", UriKind.Relative)),
             *  "Matthew , John ,Mia ", 4, 0, "Maybe. On september?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("13", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/14.png", UriKind.Relative)),
             *  "David , Jackson ,Elizabeth ", 4, 0, "How are you David?", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("14", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/15.png", UriKind.Relative)),
             *  "Andrew , Nathan ,Alexis ", 4, 0, "Just 3 days remain..", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "15", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/16.png", UriKind.Relative)),
             *  "Joseph , Gabriel ,Addison ", 4, 0, "Remember!", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ( "16", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/17.png", UriKind.Relative)),
             *  "Logan , Elijah ,Ella ", 4, 0, "Perfect! wonderful!!", DateTime.Now.ToShortDateString()));
             * rooms.Add(new RoomEntity
             *  ("17", new BitmapImage(new Uri(@"/BeautifulTalk.Modules.Rooms;component/Resources/Images/Mocks/18.png", UriKind.Relative)),
             *  "Ryan , Benjamin ,Samantha ", 4, 0, "let me see your info..", DateTime.Now.ToShortDateString()));*/
        }
示例#8
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();
        }
示例#9
0
        private void InitializeTaskBarButtons()
        {
            try
            {
                _togglePlayPauseButton         = new ThumbnailToolBarButton(Properties.Resources.play_circle, "Play");
                _togglePlayPauseButton.Click  += TogglePlayPauseButtonOnClick;
                _togglePlayPauseButton.Enabled = false;
                _nextTrackButton         = new ThumbnailToolBarButton(Properties.Resources.ff_circle, "Next");
                _nextTrackButton.Click  += NextTrackButtonOnClick;
                _nextTrackButton.Enabled = false;

                TaskbarManager
                .Instance
                .ThumbnailToolBars
                .AddButtons(
                    new WindowInteropHelper(
                        Application.Current.MainWindow).Handle,
                    _togglePlayPauseButton,
                    _nextTrackButton);
            }
            catch (Exception e)
            {
                _logger.Log(e.ToString(), Category.Exception, Priority.Medium);
            }
        }
示例#10
0
        public Snapper(
            SessionData sessionData,
            UiState uiState,
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            IAnnotationInference annotationInference,
            IConstrainedOptimizer constrainedOptimizer,
            SnapOptions snapOptions)
        {
            this.sessionData          = sessionData;
            this.eventAggregator      = eventAggregator;
            this.annotationInference  = annotationInference;
            this.constrainedOptimizer = constrainedOptimizer;
            this.snapOptions          = snapOptions;

            primitivesReaderWriterFactory = new PrimitivesReaderWriterFactory();
            var annotationConstraintsExtractor = new AnnotationConstraintsExtractor();

            snappersManager = new SnappersManager(uiState, sessionData);
            snappersManager.RegisterSnapper(new ConeSnapper());
            snappersManager.RegisterSnapper(new CylinderSnapper());
            snappersManager.RegisterSnapper(new SphereSnapper());
            snappersManager.RegisterSnapper(new SgcSnapper());
            snappersManager.RegisterSnapper(new BgcSnapper());
            snappersManager.RegisterSnapper(new CuboidSnapper());

            wholeShapeOptimizationModel = new WholeShapeOptimizationModel(sessionData, snappersManager, annotationConstraintsExtractor, primitivesReaderWriterFactory);

            eventAggregator.GetEvent <GlobalShortcutEvent>().Subscribe(OnGlobalShortcut);

            logger.Log("NewSnapper created", Category.Debug, Priority.None);
        }
        public void Save()
        {
            try
            {
                using (var session = _documentStore.OpenSession())
                {
                    var settings = session.Query <ApplicationSettings>().FirstOrDefault();

                    if (settings != null)
                    {
                        settings.AccentColor = CurrentAccentColor;
                        session.Store(settings);
                        session.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                _toastService.Show(new ToastData
                {
                    Message = "Error while saving general settings"
                });

                _logger.Log(e.ToString(), Category.Exception, Priority.Medium);
            }
        }
示例#12
0
 public SettingsPanelViewModel(ILoggerFacade loggingService, IEventAggregator eventAggregator)
     : base(loggingService)
 {
     loggingService.Log("Creating SettingsPanelViewModel", Category.Debug, Priority.Low);
     m_EventAggregator = eventAggregator;
     RestoreSettings();
 }
        public async Task <HostInfoAnalyzeResult> AnalyzeHostsAsync()
        {
            logger.Log(LogLevel.Information, "Started analyze hosts");

            var res = await hostInfoService.AnalyzeHostsAsync();

            var sb = new StringBuilder();

            sb.AppendLine("Finished analyze hosts");
            sb.AppendLine($"{res.HostsCount} hosts was analyzed.");
            sb.AppendLine($"{res.SuccessAnalyzedHostCount} of them are successful analyzed.");
            sb.AppendLine(string.Format("Results {0} saved", res.HostInfoSuccessSaved ? "successfully" : "are not"));
            logger.Log(LogLevel.Information, sb.ToString());

            return(res);
        }
 private async void ExecuteSeachUploader()
 {
     try
     {
         Uploaders.Clear();
         _service       = _container.Resolve <IYoutubeChannelService>();
         _service.Query = UploaderSearchQuery;
         MoreAction();
     }
     catch (Exception e)
     {
         //TODO: log
         _logger.Log(e.Message, Category.Exception, Priority.High);
         MessageBox.Show("Error occured during search");
     }
 }
示例#15
0
 public void Dispose()
 {
     _sr = null;
     _youtubeService.Dispose();
     _youtubeService = null;
     _logger.Log("Youtube song searcher disposed", Category.Info, Priority.Low);
 }
示例#16
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();
        }
示例#17
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);
        }
示例#18
0
 public static void LogSessionClose(ILoggerFacade logger, string userName = "")
 {
     logger.Log("|User[(" + userName.Replace(Environment.NewLine, " ")
                + ")]|Type[(SessionEnd"
                + ")]|TimeStamp[(" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss,fff").Replace(Environment.NewLine, " ")
                + ")]", Category.Info, Priority.None);
 }
示例#19
0
        /// <summary>
        /// Shows the list of messages.
        /// </summary>
        /// <param name="messagesToShow">The messages to show.</param>
        /// <param name="appendMessage">Indicates whether the message is to be
        /// appened to existing messages or existing messages are first cleared.</param>
        protected void ShowMessages(List <Message> messagesToShow, bool appendMessage = false)
        {
            Action <List <Message>, bool> action = (msgs, append) =>
            {
                if (messages == null)
                {
                    messages = new ObservableCollection <Message>();
                }

                msgs.ForEach(
                    m => Logger.Log(m.Text, ConvertMessageTypeToLogCategory(m.MessageType), Priority.None));

                if (append)
                {
                    msgs.ForEach(m => this.messages.Insert(0, m));
                }
                else
                {
                    messages.Clear();
                    messages.AddRange(msgs);
                }

                IsMessagesExpanded = true;
                OnPropertyChanged("Messages");
                OnPropertyChanged("IsMessagesVisible");
            };

            ViewModelContext.UiDispatcher.Invoke(action, new object[] { messagesToShow, appendMessage });
        }
示例#20
0
 /// <summary>
 /// Loads the data set.
 /// </summary>
 private void LoadDataSet()
 {
     try
     {
         string fileName = Path.Combine(CreateDataDirectory(), GetDataSetFileName());
         if (File.Exists(fileName))
         {
             _dataLog.ReadXml(fileName, XmlReadMode.IgnoreSchema);
         }
     }
     catch (IOException ex)
     {
         _logger.Log(ex.GetBaseException().ToString(), Category.Exception, Priority.High);
         //FIXME: Need to handle this exception with a user notification
     }
 }
示例#21
0
        public ModuleAModule(IRegionManager regionManager, ILoggerFacade logger)
        {
            _regionManager = regionManager;
            _logger        = logger;

            _logger.Log("ModuleAModule.ctor() [done]", Category.Debug, Priority.Low);
        }
示例#22
0
 public CommunityModule(IUnityContainer container, IRegionManager regionManager, ILoggerFacade callbackLogger)
 {
     this._container      = container;
     this._regionManager  = regionManager;
     this._callbackLogger = callbackLogger;
     _callbackLogger.Log("构建社区模块", Category.Debug, Priority.Low);
 }
        public void Run(CancellationToken token)
        {
            var count = 0;

            while (!token.IsCancellationRequested && count++ < 10)
            {
                // TODO: check if IEventAggregator instance is thread safe
                var progressEvent = _eventAggregator.GetEvent <ExecuteStepProgressEvent>();
                progressEvent.Publish(new ExecuteStepProgressEventArgs(_stepNumber, count * 10));

                _logger.Log($"Creating zip files...{count}", Category.Debug, Priority.None);
                Thread.Sleep(500);
            }

            _logger.Log("Completed creating zip files", Category.Debug, Priority.None);
        }
示例#24
0
        public void Submit(Order order, XDocument document)
        {
            var ordersElement = document.Element("Orders");

            if (ordersElement == null)
            {
                ordersElement = new XElement("Orders");
                document.Add(ordersElement);
            }

            var orderElement = new XElement("Order",
                                            new XAttribute("OrderType", order.OrderType),
                                            new XAttribute("Shares", order.Shares),
                                            new XAttribute("StopLimitPrice", order.StopLimitPrice),
                                            new XAttribute("TickerSymbol", order.TickerSymbol),
                                            new XAttribute("TimeInForce", order.TimeInForce),
                                            new XAttribute("TransactionType", order.TransactionType),
                                            new XAttribute("Date", DateTime.Now.ToString(CultureInfo.InvariantCulture))
                                            );

            ordersElement.Add(orderElement);

            string message = String.Format(CultureInfo.CurrentCulture, Resources.LogOrderSubmitted,
                                           orderElement.ToString());

            logger.Log(message, Category.Debug, Priority.Low);
        }
        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();
        }
示例#26
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);
        }
        private async void SaveCommandOnExecute(object obj)
        {
            try
            {
                IsLoading = true;

                var result = IsInUpdateMode
                    ? await this.services.Update(customer)
                    : await this.services.Insert(customer);

                if (result)
                {
                    NavigationCommands.GoToPage.Execute(NavigationScreens.CustomerList, null);
                }

                IsLoading = false;
            }
            catch (Exception ex)
            {
                logger.Log(ex.Message, Category.Exception, Priority.High);
                eventAggregator.GetEvent <ApplicationExceptionEvent>().Publish(ex.Message);
                IsLoading    = false;
                ErrorMessage = ex.Message;
            }
        }
示例#28
0
        public ModuleBModule(IRegionManager regionManager, ILoggerFacade logger)
        {
            _regionManager = regionManager;
            _logger = logger;

            _logger.Log("ModuleBModule.ctor() [done]", Category.Debug, Priority.Low);
        }
示例#29
0
 public static void Info(this ILoggerFacade facade, string format, params object[] args)
 {
     if (facade != null)
     {
         facade.Log(string.Format(format, args), Category.Info, Priority.None);
     }
 }
示例#30
0
        private async void SearchAction()
        {
            if (SearchFieldVisibility != Visibility.Visible)
            {
                SearchFieldVisibility = Visibility.Visible;
                return;
            }

            SearchResult.Clear();

            if (string.IsNullOrWhiteSpace(SearchQuery))
            {
                return;
            }

            try
            {
                _songSearchService.Query = SearchQuery;
                foreach (var song in await _songSearchService.FetchAsync())
                {
                    SearchResult.Add(song);
                }
            }
            catch (Exception ex)
            {
                _logger.Log($"{Tag} FetchFetchSongs error {ex.Message}", Category.Exception, Priority.High);
                _dialogService.ShowError("Spotify search", ex.Message);
            }

            SearchFieldVisibility = Visibility.Hidden;
        }
        public FeedBoxUserControlViewModel(IEventAggregator eventAggregator)
        {
            _logger.Log("Initialize the viewmodel for the feeds", Category.Info, Priority.Medium);
            ChangeFeedCommand = new DelegateCommand <FeedViewModel>(ClickedFeedView);
            _eventAggregator  = eventAggregator;

            AddArchiveFeedDelegateCommand = new DelegateCommand <FeedViewModel>(AddArchiveFeed);
            SearchCommand      = new DelegateCommand(SearchWithTerm);
            CleanFilterCommand = new DelegateCommand(Reset);

            eventAggregator.GetEvent <FetchDataEvent>().Subscribe(ShouldUpdateFeedList);
            eventAggregator.GetEvent <WantFeedEvent>().Subscribe(UpdateFeedListWithClear);
            eventAggregator.GetEvent <WantAllFeedsEvent>().Subscribe(UpdateFeedListWithClear);

            _allFeeds = new ObservableCollection <FeedViewModel>();
            _allFeeds.CollectionChanged += (a, e) =>
            {
                RaisePropertyChanged(nameof(IsEmpty));
                RaisePropertyChanged(nameof(IsNotEmpty));
            };

            var myMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(5000));

            AddArchiveMessageQueue = myMessageQueue;
        }
        public MainWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IRssStore sourceStore)
        {
            _logger.Log("Initialize the viewmodel for the main window", Category.Info, Priority.Medium);
            _regionManager   = regionManager;
            _eventAggregator = eventAggregator;
            _sourceStore     = sourceStore;

            LoadSources();

            GetSourceDelegateCommand     = new DelegateCommand <Source>(SetCurrentSource);
            GetAllSourcesDelegateCommand = new DelegateCommand(GetAllSources);

            UpdateFeedsDelegateCommand = new DelegateCommand(UpdateFeeds);

            OpenAddSourceWindowDelegateCommand  = new DelegateCommand(OpenAddSourceWindow);
            OpenEditSourceWindowDelegateCommand = new DelegateCommand(OpenEditSourceWindow);

            ShowArchiveFeedsDelegateCommand = new DelegateCommand(ShowArchiveFeeds);
            ShowFeedsDelegateCommand        = new DelegateCommand(ShowFeeds);

            eventAggregator.GetEvent <WantUriEvent>().Subscribe(OpenBrowser);
            eventAggregator.GetEvent <WantCloseUriEvent>().Subscribe(CloseBrowser);

            eventAggregator.GetEvent <EditSourceEvent>().Subscribe(EditSource);
            eventAggregator.GetEvent <NewSourceEvent>().Subscribe(AddSource);
            eventAggregator.GetEvent <RemoveSourceEvent>().Subscribe(RemoveSource);
            eventAggregator.GetEvent <FeedsLoadedEvent>().Subscribe(FeedsLoaded);
        }
        public void RemoveToolBarGroup(int uid)
        {
            m_Logger.Log(@"RemoveToolBarGroup", Category.Debug, Priority.Medium);

#if DEBUG
            if (!Dispatcher.CheckAccess())
            {
                Debugger.Break();
            }
#endif

            IRegion targetRegion = m_RegionManager.Regions[RegionNames.MainToolbar];

            var viewsToRemove = new List <object>();

            int    count = 0;
            object view;
            while ((view = targetRegion.GetView(uid + @"_" + count++)) != null)
            {
                viewsToRemove.Add(view);
            }

            foreach (var obj in viewsToRemove)
            {
                targetRegion.Deactivate(obj);
                targetRegion.Remove(obj);
            }
        }
示例#34
0
        public DescriptionsView(
            ILoggerFacade logger,
            IEventAggregator eventAggregator,
            IUnityContainer container,
            [Import(typeof(IShellView), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IShellView shellView,
            [Import(typeof(IUrakawaSession), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            IUrakawaSession session,
            [Import(typeof(DescriptionsViewModel), RequiredCreationPolicy = CreationPolicy.Shared, AllowDefault = false)]
            DescriptionsViewModel viewModel)
        {
            m_EventAggregator = eventAggregator;
            m_Logger          = logger;
            m_Container       = container;
            m_ShellView       = shellView;
            m_Session         = session;

            m_ViewModel           = viewModel;
            m_ViewModel.ShellView = m_ShellView;

            m_Logger.Log("DescriptionsView.ctor", Category.Debug, Priority.Medium);

            DataContext = m_ViewModel;
            InitializeComponent();
        }
示例#35
0
 public static void Info(this ILoggerFacade logger, string msg)
 {
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     logger.Log(msg, Category.Info, Priority.Low);
 }
示例#36
0
 public static void LogLoginException(ILoggerFacade logger, Exception exception)
 {
     logger.Log("|User[(Null)]|Exception[(" + exception.Message.Replace(Environment.NewLine, " ")
                + ")]|Type[(Exception"
                + ")]|StackTrace[(" + StackTraceToString(exception).Replace(Environment.NewLine, " ")
                + ")]|TimeStamp[(" + DateTime.Now.ToUniversalTime().ToString("yyyy-MM-dd HH:mm:ss,fff").Replace(Environment.NewLine, " ")
                + ")]", Category.Exception, Priority.Medium);
 }
示例#37
0
 public static void Exception(this ILoggerFacade logger, string msg, Exception e)
 {
     if (logger == null)
     {
         throw new ArgumentNullException(nameof(logger));
     }
     logger.Log(msg + e.Message, Category.Exception, Priority.High);
 }
        public StopWatchService(IEventAggregator eventAggregator, ILoggerFacade logger)
        {
            this.EventAggregator = eventAggregator;
            this.Logger = logger;

            this.DispatchTimer.Interval = TimeSpan.FromMilliseconds(100);
            this.DispatchTimer.Tick += this.DispatchTimerTick;

            logger.Log("StopWatchService Initialized", Category.Debug, Priority.None);
        }
        public ActionController(ILoggerFacade logger, IUnityContainer container)
        {
            logger.Log("初始化导航示例中的几个按钮的视图", Category.Info, Priority.Low);
            InitializeComponent();

            this.Loaded += (s, e) =>
            {
                this.DataContext = container.Resolve<ActionControllerViewModel>();
            };
        }
示例#40
0
 public TileCreator(ILoggerFacade logger)
 {
     logger.Log($"Windows Version : {Environment.OSVersion.Version}",Category.Info,Priority.High);
     
     if (Environment.OSVersion.Version.Build >= 10586)
         Creator = new Win10TP2TileCreator(logger);
     else 
         Creator = null;
     
     if (Creator == null) 
         throw new InvalidOperationException("This version of Windows does not support creating Tiles!");
 }
        public SearchModel(IEnumerable<Contract.IIdentityProvider> identityProviders, ILoggerFacade logger)
        {
            logger.Log("SearchModel ctor", Category.Debug, Priority.Low);
            _identityProviders = identityProviders.ToArray();

            var profiles = from query in _identityQueries
                                select _identityProviders.Select(ip => ip.FindProfile(new[]{query}));

            //Merge the results from each of the identityProviders into a single sequence.
            //Cancel any running queries if another request comes in (using the Switch Statement)
            _identityActivated = profiles
                .Select(queryResult => queryResult.Merge().ToList())
                .Switch()
                .Select(MergeProfiles)
                .Log(logger, "IdentityActivated");

            var msg = string.Format("SearchModel constructed with {0} identityProviders ({1})",
                                    _identityProviders.Length,
                                    string.Join(",", _identityProviders.Select(i => i.GetType().Name)));
            logger.Log(msg, Category.Debug, Priority.Medium);
        }
示例#42
0
        /// <summary>
        /// Initializes the singleton application object. This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        /// <param name="logger">Logger</param>
        protected PrismApplication(ILoggerFacade logger)
        {
            WindowsRuntimeResourceManager.InjectIntoResxGeneratedApplicationResourcesClass(typeof(Properties.Resources));

            if (logger == null)
                throw new InvalidOperationException("Logger Facade is null");

            Logger = logger;

            Logger.Log("Created Logger", Category.Debug, Priority.Low);

            this.Suspending += OnSuspending;
        }
        public MainWindow(IEventAggregator eventAggregator, IRegionManager regionManager, ILoggerFacade logger, AppState state)
        {
            Uri mainPage;

            InitializeComponent();

            _logger = logger;

            // Subscribes to the CloseGameEvent and closes the window when triggered.
            eventAggregator.GetEvent<CloseGameEvent>().Subscribe(a => Close());

            if (state.Mode == ScreenMode.FullScreen)
            {
                WindowStyle = WindowStyle.None;
                WindowState = WindowState.Maximized;
                Focus();
            }

            if (string.IsNullOrEmpty(state.Language))
            {
                mainPage = new Uri("/PageSelectLanguage", UriKind.Relative);
            }
            else
            {
                _dictionary.SetCultureCommand.Execute(state.Language);
                mainPage = new Uri("/PageStartMenu", UriKind.Relative);
            }

            Width = SystemParameters.PrimaryScreenWidth;
            Height = SystemParameters.PrimaryScreenHeight;

            Loaded += (o, args) =>
            {
                _logger.Log("Navigating to default header and start menu.", Category.Debug, Priority.Medium);
                regionManager.RequestNavigate("HeaderContentRegion", new Uri("/PageHeader", UriKind.Relative));
                regionManager.RequestNavigate("MainContentRegion", mainPage);
            };

            Closing += (o, args) =>
            {
                state.SaveState();
            };

            //Setup.SetupGame();
        }
示例#44
0
        public PositionsViewModel(
            ILoggerFacade logger,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            UserContext userContext)
        {
            logger.Log("PositionsViewModel.PositionsViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _regionManager = regionManager;
            _eventAggregator = eventAggregator;
            this.UserContext = userContext;

            BuyCommand = new DelegateCommand<object>(this.CreateBuyOrderExecute);
            SellCommand = new DelegateCommand<object>(this.CreateSellOrderExecute);
            UpdateAccountsCommand = new DelegateCommand<object>(this.UpdateAccountsExecute);

            SubscribeToEvents();
        }
示例#45
0
 public MapViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, ILoggerFacade loggerFacade, IConfiguration configuration)
 {
     _container = new ErrorsContainer<string>(OnErrorsChanged);
     this.regionManager = regionManager;
     mapDataEvent = eventAggregator.GetEvent<CompositePresentationEvent<MapData>>();
     mapLoadedEvent = eventAggregator.GetEvent<CompositePresentationEvent<MapLoaded>>();
     mapExtentEvent = eventAggregator.GetEvent<CompositePresentationEvent<MapExtent>>();
     this._loggerFacade = loggerFacade;
     this.configuration = configuration;
     _notificationErrorInteraction = new InteractionRequest<Notification>();
     this.NotificationErrorInteraction.Raised += (o, e) =>
     {
         // Do some logging
         _loggerFacade.Log(e.Context.Content as string, Category.Exception, Priority.High);
         var result = messageBoxCustom.Show(e.Context.Content as string, Silverlight.UI.Esri.JTMap.Resources.Map.ErrorMessage,
         MessageBoxCustomEnum.MessageBoxButtonCustom.Ok);
     };
     HandleRightClick = new DelegateCommand<object>(this.OnRightMouseClicked, this.CanRightMouseClicked);
     this.ContextMenuVisibility = Visibility.Collapsed;
     this.MenuItemCommand = new DelegateCommand<object>(
         this.OnMenuItemClicked, this.CanMenuItemClicked);
     string tradeNote = "J&T Software BVBA - Custom Silverlight map editor - Version 1.0";
     HelpContents.DisplayHelp(tradeNote, regionManager,false);
 }
示例#46
0
 public LoginViewModel(
     ILoggerFacade logger,
     IStatusBar statusBar,
     IRegionManager regionManager,
     IEventAggregator eventAggregator,
     ISecurityServiceAsync securityService,
     UserContext userContext)
 {
     logger.Log("LoginViewModel.LoginViewModel()", Category.Debug, Priority.Low);
     _logger = logger;
     _statusBar = statusBar;
     _regionManager = regionManager;
     _eventAggregator = eventAggregator;
     _securityService = securityService;
     _securityService.AuthenticateUserCompleted += new EventHandler<AuthenticateUserCompletedEventArgs>(AuthenticateUserCallback);
     this.UserContext = userContext;
     LoginCommand = new DelegateCommand<object>(this.LoginExecute, this.CanLoginExecute);
     OpenAccountCommand = new DelegateCommand<object>(this.OpenAccountExecute);
     #if !SILVERLIGHT
     PasswordChangedCommand = new DelegateCommand<object>(this.PasswordChangedExecute);
     #endif
     this.PropertyChanged += this.OnPropertyChanged;
     this.ValidateAll();
 }
示例#47
0
        public LoggedInUserViewModel(
            ILoggerFacade logger,
            IStatusBar statusBar,
            IRegionManager regionManager,
            IEventAggregator eventAggregator,
            ITradingServiceAsync tradingService,
            UserContext userContext)
        {
            logger.Log("LoggedInUserViewModel.LoggedInUserViewModel()", Category.Debug, Priority.Low);
            _logger = logger;
            _statusBar = statusBar;
            _regionManager = regionManager;
            _eventAggregator = eventAggregator;
            _tradingService = tradingService;
            this.UserContext = userContext;
            this.SignOutCommand = new DelegateCommand<object>(this.SignOutExecute);

            _tradingService.GetBrokerageAccountSummariesCompleted +=
                new EventHandler<GetBrokerageAccountSummariesCompletedEventArgs>(GetBrokerageAccountSummariesCallback);
            _tradingService.GetExternalAccountSummariesCompleted +=
                new EventHandler<GetExternalAccountSummariesCompletedEventArgs>(GetExternalAccountSummariesCallback);

            SubscribeToEvents();
        }
 /// <summary>
 /// Class utility method to generate an entry in the log with the specified category message and culture
 /// </summary>
 /// <param name="facade">Logger facade to use</param>
 /// <param name="culture">Culture to use when formatting</param>
 /// <param name="priority">Priority to use</param>
 /// <param name="cat">Category to use</param>
 /// <param name="msg">Message to use</param>
 /// <param name="args">Arguments for the message</param>
 private static void LogIt(ILoggerFacade facade, IFormatProvider culture, Priority priority, Category cat, string msg, params object[] args)
 {
     facade.Log(string.Format(culture, msg, args), cat, priority);
 }
示例#49
0
 public ViewC(ILoggerFacade logger)
 {
     InitializeComponent();
     logger.Log("创建一个ViewC", Category.Info, Priority.Low);
 }
 public ScoreKeeperService(ILoggerFacade logger)
 {
     this.Logger = logger;
     this.Competitors = new DispatchingObservableCollection<CompetitorModel>();
     logger.Log("ScoreKeeperService Initialized", Category.Debug, Priority.None);
 }
 public ConfigGameViewModel(IEventAggregator eventAggregator, ILoggerFacade logger, IScoreKeeperService scoreService)
 {
     this.ScoreKeeper = scoreService;
     logger.Log("ConfigGameNumberViewModel Initialized", Category.Debug, Priority.None);
 }