예제 #1
0
 public void CopyProjectAttachmentsRequest(Guid userId, Guid projectId, string targetDirectory)
 {
     if (HostIsEnabled)
     {
         EventServiceHost.CopyProjectAttachments(userId, projectId, targetDirectory);
     }
 }
예제 #2
0
        public void Stop()
        {
            //отключаемся от сервера
            if (HostIsEnabled)
            {
                try
                {
                    EventServiceHost.Disconnect(_appSessionId);
                }
                catch (TimeoutException e)
                {
                    _container.Resolve <IMessageService>().ShowOkMessageDialog(e.GetType().Name, e.PrintAllExceptions());
                }
                catch (CommunicationObjectFaultedException e)
                {
                    _container.Resolve <IMessageService>().ShowOkMessageDialog(e.GetType().Name, e.PrintAllExceptions());
                }
#if DEBUG
#else
                catch (Exception e)
                {
                    _container.Resolve <IHvtAppLogger>().LogError("", e);
                    _container.Resolve <IMessageService>().ShowOkMessageDialog(e.GetType().Name, e.PrintAllExceptions());
                }
#endif
            }

            this.Disable();
        }
예제 #3
0
        /// <summary>
        /// Отключение от хоста
        /// </summary>
        private void Disable()
        {
            //сносим хост
            if (EventServiceHost != null)
            {
                EventServiceHost.Abort();
                EventServiceHost = null;
            }

            //освобождаем контейнер синхронизации
            SyncContainer.Disconnect();
        }
예제 #4
0
        public bool UserConnected(Guid userId)
        {
            if (HostIsEnabled)
            {
                try
                {
                    return(EventServiceHost.UserIsConnected(userId));
                }
                catch (CommunicationObjectFaultedException)
                {
                    this.DisableWaitRestart();
                    return(false);
                }
            }

            return(false);
        }
예제 #5
0
 /// <summary>
 /// Пинг хоста (циклический при удаче)
 /// </summary>
 private void PingHost()
 {
     Task.Run(
         () =>
     {
         if (HostIsEnabled)
         {
             try
             {
                 if (EventServiceHost.HostIsAlive())
                 {
                     Thread.Sleep(new TimeSpan(0, 0, 2, 0));
                     this.PingHost();
                 }
             }
             catch (Exception)
             {
                 this.DisableWaitRestart();
             }
         }
     }).Await();
 }
 public void SendMessageToUser(Guid recipientId, string message)
 {
     EventServiceHost?.SendMessageToUser(_userId, recipientId, message);
 }
 public void SendMessageToChat(string message)
 {
     EventServiceHost?.SendMessageToChat(_userId, message);
 }