Ejemplo n.º 1
0
        public ChannelService(
            IChatState chatState,
            ILogThings logger,
            IAutomateThings automation)
        {
            try
            {
                region          = chatState.RegionManager;
                container       = chatState.Container;
                events          = chatState.EventAggregator;
                cm              = chatState.ChatModel;
                connection      = chatState.Connection;
                characters      = chatState.CharacterManager;
                this.logger     = logger.ThrowIfNull("logger");
                this.automation = automation.ThrowIfNull("automation");

                events.GetEvent <ChatOnDisplayEvent>().Subscribe(BuildHomeChannel, ThreadOption.UIThread, true);
                events.GetEvent <RequestChangeTabEvent>().Subscribe(RequestNavigate, ThreadOption.UIThread, true);
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }
Ejemplo n.º 2
0
        public ServerCommandService(IChatState chatState,
            IAutomateThings automation,
            IManageNotes notes,
            IManageChannels channels,
            IFriendRequestService friendRequestService)
            : base(chatState)
        {
            this.channels = channels;
            this.automation = automation;
            this.notes = notes;
            this.friendRequestService = friendRequestService;

            Events.GetEvent<CharacterSelectedLoginEvent>()
                .Subscribe(GetCharacter, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ChatCommandEvent>().Subscribe(EnqueueAction, ThreadOption.BackgroundThread, true);
            Events.GetEvent<ConnectionClosedEvent>().Subscribe(WipeState, ThreadOption.PublisherThread, true);

            ChatModel.CurrentAccount = ChatConnection.Account;

            noisyTypes = new[]
            {
                UserJoin,
                UserLeave,
                UserStatus,
                PublicChannelList,
                PrivateChannelList,
                UserList,
                ChannelAd,
                ChannelMessage
            };

            LoggingSection = "cmnd serv";
        }
Ejemplo n.º 3
0
        public ServerCommandService(IChatState chatState,
                                    IAutomateThings automation,
                                    IManageNotes notes,
                                    IManageChannels channels,
                                    IFriendRequestService friendRequestService)
            : base(chatState)
        {
            this.channels             = channels;
            this.automation           = automation;
            this.notes                = notes;
            this.friendRequestService = friendRequestService;

            Events.GetEvent <CharacterSelectedLoginEvent>()
            .Subscribe(GetCharacter, ThreadOption.BackgroundThread, true);
            Events.GetEvent <ChatCommandEvent>().Subscribe(EnqueueAction, ThreadOption.BackgroundThread, true);
            Events.GetEvent <ConnectionClosedEvent>().Subscribe(WipeState, ThreadOption.PublisherThread, true);

            ChatModel.CurrentAccount = ChatConnection.Account;

            noisyTypes = new[]
            {
                UserJoin,
                UserLeave,
                UserStatus,
                PublicChannelList,
                PrivateChannelList,
                UserList,
                ChannelAd,
                ChannelMessage
            };

            LoggingSection = "cmnd serv";
        }
Ejemplo n.º 4
0
        public ChannelService(
            IChatState chatState,
            ILogThings logger,
            IAutomateThings automation)
        {
            try
            {
                region = chatState.RegionManager;
                container = chatState.Container;
                events = chatState.EventAggregator;
                cm = chatState.ChatModel;
                connection = chatState.Connection;
                characters = chatState.CharacterManager;
                this.logger = logger.ThrowIfNull("logger");
                this.automation = automation.ThrowIfNull("automation");

                events.GetEvent<ChatOnDisplayEvent>().Subscribe(BuildHomeChannel, ThreadOption.UIThread, true);
                events.GetEvent<RequestChangeTabEvent>().Subscribe(RequestNavigate, ThreadOption.UIThread, true);
            }
            catch (Exception ex)
            {
                ex.Source = "Message Daemon, init";
                Exceptions.HandleException(ex);
            }
        }
Ejemplo n.º 5
0
        public HomeChannelViewModel(string name, IChatState chatState, IAutomateThings automation, IBrowseThings browser,
                                    HomeSettingsViewModel settingsVm, HomeHelpViewModel helpVm, IUpdateMyself updateService)
            : base(chatState)
        {
            try
            {
                Model         = Container.Resolve <GeneralChannelModel>(name);
                ConnectTime   = 0;
                flavorText    = new StringBuilder("Connecting");
                connectDotDot = new StringBuilder();

                this.updateService = updateService;
                HelpVm             = helpVm;

                Container.RegisterType <object, HomeChannelView>(Model.Id, new InjectionConstructor(this));
                minuteOnlineCount = new CacheCount(OnlineCountPrime, 15, 1000 * 15);

                updateTimer.Enabled  = true;
                updateTimer.Elapsed += (s, e) =>
                {
                    OnPropertyChanged("RoughServerUpTime");
                    OnPropertyChanged("RoughClientUpTime");
                    OnPropertyChanged("LastMessageReceived");
                };

                updateTimer.Elapsed += UpdateConnectText;
                SettingsVm           = settingsVm;

                Events.GetEvent <NewUpdateEvent>().Subscribe(param =>
                {
                    var temp = param as CharacterUpdateModel;
                    if (!(temp?.Arguments is LoginStateChangedEventArgs))
                    {
                        return;
                    }

                    OnPropertyChanged("OnlineCount");
                    OnPropertyChanged("OnlineFriendsCount");
                    OnPropertyChanged("OnlineBookmarksCount");
                    OnPropertyChanged("OnlineCountChange");
                });

                Events.GetEvent <LoginAuthenticatedEvent>().Subscribe(LoggedInEvent);
                Events.GetEvent <LoginFailedEvent>().Subscribe(LoginFailedEvent);
                Events.GetEvent <ReconnectingEvent>().Subscribe(LoginReconnectingEvent);

                this.automation = automation;
                this.browser    = browser;

                LoggingSection = "utility channel vm";

                Themes = new ObservableCollection <ThemeModel>();
            }
            catch (Exception ex)
            {
                ex.Source = "Utility Channel ViewModel, init";
                Exceptions.HandleException(ex);
            }
        }
Ejemplo n.º 6
0
 public HomeSettingsViewModel(IChatState chatState, IAutomateThings automationService, IconService iconService,
                              ICharacterManager characterManager)
     : base(chatState)
 {
     automation            = automationService;
     this.iconService      = iconService;
     this.characterManager = characterManager;
 }
Ejemplo n.º 7
0
 public HomeSettingsViewModel(IChatState chatState, IAutomateThings automationService, IconService iconService,
     ICharacterManager characterManager)
     : base(chatState)
 {
     automation = automationService;
     this.iconService = iconService;
     this.characterManager = characterManager;
 }
Ejemplo n.º 8
0
        public HomeChannelViewModel(string name, IChatState chatState, IAutomateThings automation, IBrowseThings browser,
            HomeSettingsViewModel settingsVm, HomeHelpViewModel helpVm, IUpdateMyself updateService)
            : base(chatState)
        {
            try
            {
                Model = Container.Resolve<GeneralChannelModel>(name);
                ConnectTime = 0;
                flavorText = new StringBuilder("Connecting");
                connectDotDot = new StringBuilder();

                this.updateService = updateService;
                HelpVm = helpVm;

                Container.RegisterType<object, HomeChannelView>(Model.Id, new InjectionConstructor(this));
                minuteOnlineCount = new CacheCount(OnlineCountPrime, 15, 1000*15);

                updateTimer.Enabled = true;
                updateTimer.Elapsed += (s, e) =>
                {
                    OnPropertyChanged("RoughServerUpTime");
                    OnPropertyChanged("RoughClientUpTime");
                    OnPropertyChanged("LastMessageReceived");
                };

                updateTimer.Elapsed += UpdateConnectText;
                SettingsVm = settingsVm;

                Events.GetEvent<NewUpdateEvent>().Subscribe(param =>
                {
                    var temp = param as CharacterUpdateModel;
                    if (!(temp?.Arguments is LoginStateChangedEventArgs))
                        return;

                    OnPropertyChanged("OnlineCount");
                    OnPropertyChanged("OnlineFriendsCount");
                    OnPropertyChanged("OnlineBookmarksCount");
                    OnPropertyChanged("OnlineCountChange");
                });

                Events.GetEvent<LoginAuthenticatedEvent>().Subscribe(LoggedInEvent);
                Events.GetEvent<LoginFailedEvent>().Subscribe(LoginFailedEvent);
                Events.GetEvent<ReconnectingEvent>().Subscribe(LoginReconnectingEvent);

                this.automation = automation;
                this.browser = browser;

                LoggingSection = "utility channel vm";

                Themes = new ObservableCollection<ThemeModel>();
            }
            catch (Exception ex)
            {
                ex.Source = "Utility Channel ViewModel, init";
                Exceptions.HandleException(ex);
            }
        }