/// <summary>
        /// Registers the connection.
        /// </summary>
        /// <param name="connection">The connection.</param>
        public override void RegisterConnection(IWebSocketConnection connection)
        {
            if (_connections == null)
            {
                _connections = DependencyUtility.Resolve <IWebSocketConnectionManager>();
            }

            _queueHandler.CreateQueue(QUEUE_EXCHANGE_ID, connection.ClientIdentifier);
            _queueHandler.AddEvent(QUEUE_EXCHANGE_ID, connection.ClientIdentifier, OnDequeue);
        }
Exemplo n.º 2
0
        public void DependencyUtilityRegistersAndResolvesInterfaces()
        {
            Guid id = Guid.NewGuid();
            IDependencyUtility utility = new DependencyUtility();

            utility.Register <ITestInterface>(new TestClass(id));

            ITestInterface resolvedObject = utility.Resolve <ITestInterface>();

            Assert.Equal(id, resolvedObject.Id);
        }
Exemplo n.º 3
0
        private void Prepare()
        {
            var directory = Directory.CreateDirectory(AppPaths.AppPath);



            musicLoader = new MusicLoader(directory.FullName, tokenID, userID);

            DependencyUtility.RegisterInstance(musicLoader);
            DependencyUtility.RegisterType <MusicPlayer>();

            DependencyUtility.RegisterInstance(new AutorunHelper(System.Reflection.Assembly.GetExecutingAssembly().Location));

            var progressWindow = new ProgressWindow("Синхронизация", musicLoader);

            progressWindow.Show();



            musicWorker = DependencyUtility.Resolve <TrackList>();

            musicPlayer = DependencyUtility.Resolve <MusicPlayer>();
            musicLoader.LoadAsync().ContinueWith((t) => Dispatcher.Invoke(firstSynchronizationCompleted));

            var settingsWindow = new SettingsWindow();

            fastTimer.Tick += (s, e) =>
            {
                if (!mutexShow.WaitOne(0, true))
                {
                    musicPlayer.InvokeShow();
                }
                else
                {
                    mutexShow.ReleaseMutex();
                }
            };
        }