Exemplo n.º 1
0
 public LoginControlService(ISendHttpRequests httpClient, IProvideConfiguration<LoginConfiguration> configuration, IMapEntities<IEnumerable<CollectionData>, FormUrlEncodedContent> mapper, IStoreDataLocally localStorageService, IHandleUserAccountEvents userAccountEvents)
 {
     this.httpClient = httpClient;
     this.configuration = configuration;
     this.mapper = mapper;
     this.localStorageService = localStorageService;
     this.userAccountEvents = userAccountEvents;
 }
Exemplo n.º 2
0
        public LoginControl(IServiceLoginControl loginControlService, IProvideConfiguration<RedisConfiguration> redisConfigurationProvider, IBuildContent contentBuilder, IGetFieldValue fieldValueGetter, IHandleUserAccountEvents userAccountEvents, ILog logger)
        {
            this.loginControlService = loginControlService;
            this.contentBuilder = contentBuilder;
            this.fieldValueGetter = fieldValueGetter;
            this.userAccountEvents = userAccountEvents;
            this.logger = logger;
            this.redisConfigurationProvider = redisConfigurationProvider;
            InitializeComponent();
            
            var collection = loginControlService.GetCollection();
            Resources.Add("templateData", collection.template.data);

            foreach (var panel in this.contentBuilder.GetContentFor(collection))
            {
                templateContainer.Children.Add(panel);
            }

            this.userAccountEvents.UserHasLogged += OnUserHasLogged;
            this.userAccountEvents.UserCouldNotLogIn += OnUserCouldNotLogin;
        }
Exemplo n.º 3
0
        public Chat(IProvideUser userProvider, IListenToMessages<Action<string, string>> roomInvitationsListener, IListenToMessages<Action<string, string>> messageListener, IServiceChatRoomsControl chatRoomControlService, IStoreGlobalState applicationGlobalState, ICreateDteHandler dteHandlerCreator, IStoreDTE dteStore, IHandleCodePaste codePasteEvents, IHandleToolWindowEvents toolWindowEvents, IHandleUserAccountEvents userAccountEvents, IHandleVisualStudioClipboard clipboardHandler, IHandleSocketIOEvents socketIOEvents, ILog logger, IHandleMixedEditorEvents mixedEditorEvents, IHandleUIEvents userInterfaceEvents)//, IHandleChatEvents chatEventsHandler)
        {
            chatIsEnabled = true;
            
            //chatEvents = chatEventsHandler;
            dteStore.dte = ((DTE)Package.GetGlobalService(typeof(DTE)));
            this.dteStore = dteStore;
            this.codePasteEvents = codePasteEvents;
            this.toolWindowEvents = toolWindowEvents;
            this.userAccountEvents = userAccountEvents;
            this.clipboardHandler = clipboardHandler;
            this.socketIOEvents = socketIOEvents;
            this.logger = logger;
            this.mixedEditorEvents = mixedEditorEvents;
            this.userInterfaceEvents = userInterfaceEvents;
            this.applicationGlobalState = applicationGlobalState;
            this.chatRoomControlService = chatRoomControlService;
            this.messageListener = messageListener;
            this.roomInvitationsListener = roomInvitationsListener;
            this.userProvider = userProvider;
            this.dteHandlerCreator = dteHandlerCreator;
            this.messagesList = new Dictionary<string, TableRowGroup>();

            this.taskbarNotifierWindow = new TaskbarNotifierWindow(dteStore.dte)
                                        {
                                            OpeningMilliseconds = 500,
                                            HidingMilliseconds = 500,
                                            StayOpenMilliseconds = 2000
                                        };
            InitializeComponent();
            
            var mce = new ModalCodeEditor { RefControl = this.mainGrid };
            codeEditor = mce;
            var collection = chatRoomControlService.GetCollection();
            var roomLinks = FormatRooms(collection.rooms);

            Resources.Add("rooms", roomLinks);
            comboRooms.SelectionChanged += OnRoomSelectionChanged;
            if(roomLinks.Count > 0)
                comboRooms.SelectedIndex = 0;
            
            Loaded += (s, e) => chatRoomControlService.HandleDock(GetChatUIElements());

            this.mixedEditorEvents.DataWasPasted += MixedEditorDataWasPasted;

            lastStamp = "";

            this.codePasteEvents.Clear();
            this.codePasteEvents.CodePasteWasClicked += PasteCode;
            this.codePasteEvents.CodeQuotedWasClicked += GoToCode;

            this.toolWindowEvents.Clear();
            this.toolWindowEvents.ToolWindowWasDocked += OnToolWindowWasDocked;

            this.userAccountEvents.Clear();
            this.userAccountEvents.UserHasLogout += OnUserLogout;

            this.socketIOEvents.Clear();
            this.socketIOEvents.SocketWasDisconnected += (s, e) =>
                                                        {
                                                            currentChannel = "";
                                                            //var room = "/room/{0}/messages".FormatUsing(e.RoomId);// "chat " + e.RoomId;
                                                            //subscribedChannels.Remove(room);
                                                            Dispatcher.Invoke(new Action(() => btnReconnect.Visibility = Visibility.Visible));
                                                        };
            roomInvitationChannel = "/user/" + userProvider.GetUser().id.ToString() + "/invitations";
            roomInvitationsListener.ListenOnChannel(roomInvitationChannel,RoomInvitationMessage,
                                                    () => { }, () => { });

        }