コード例 #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();
 }
コード例 #6
0
 public void SendMessageToUser(Guid recipientId, string message)
 {
     EventServiceHost?.SendMessageToUser(_userId, recipientId, message);
 }
コード例 #7
0
 public void SendMessageToChat(string message)
 {
     EventServiceHost?.SendMessageToChat(_userId, message);
 }