public void CopyProjectAttachmentsRequest(Guid userId, Guid projectId, string targetDirectory) { if (HostIsEnabled) { EventServiceHost.CopyProjectAttachments(userId, projectId, targetDirectory); } }
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(); }
/// <summary> /// Отключение от хоста /// </summary> private void Disable() { //сносим хост if (EventServiceHost != null) { EventServiceHost.Abort(); EventServiceHost = null; } //освобождаем контейнер синхронизации SyncContainer.Disconnect(); }
public bool UserConnected(Guid userId) { if (HostIsEnabled) { try { return(EventServiceHost.UserIsConnected(userId)); } catch (CommunicationObjectFaultedException) { this.DisableWaitRestart(); return(false); } } return(false); }
/// <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); }