public TashHostWindow() { InitializeComponent(); var container = new ContainerBuilder().UseTashHost().Build(); TashAccessor = new TashAccessor(container.Resolve <IDvinRepository>(), container.Resolve <ISimpleLogger>(), new LogConfiguration()); UiSynchronizationContext = SynchronizationContext.Current; vProcessId = Process.GetCurrentProcess().Id; UpdateUiThreadLastActiveAt(); }
private async Task ConnectAndMakeTashRegistrationAsync() { var tashErrorsAndInfos = await TashAccessor.EnsureTashAppIsRunningAsync(); if (tashErrorsAndInfos.AnyErrors()) { MessageBox.Show(string.Join("\r\n", tashErrorsAndInfos.Errors), Properties.Resources.CouldNotConnectToTash, MessageBoxButton.OK, MessageBoxImage.Error); Close(); } var statusCode = await TashAccessor.PutControllableProcessAsync(Process.GetCurrentProcess()); if (statusCode != HttpStatusCode.Created) { MessageBox.Show(string.Format(Properties.Resources.CouldNotMakeTashRegistration, statusCode.ToString()), Properties.Resources.TashHostWindowTitle, MessageBoxButton.OK, MessageBoxImage.Error); Close(); } }
private async void LoustWindow_TickAsync(object sender, EventArgs e) { UiSynchronizationContext.Send(x => UpdateUiThreadLastActiveAt(), null); if (vStatusLastConfirmedAt == vUiThreadLastActiveAt) { return; } var statusCode = await TashAccessor.ConfirmAliveAsync(vProcessId, vUiThreadLastActiveAt, ControllableProcessStatus.Busy); if (statusCode == HttpStatusCode.NoContent) { vStatusLastConfirmedAt = vUiThreadLastActiveAt; UiSynchronizationContext.Post(x => ShowLastCommunicatedTimeStamp(), null); return; } UiSynchronizationContext.Post(x => { CommunicateCouldNotConfirmStatusToTashThenStop(statusCode); }, null); }
public void Initialize() { _Sut = new TashAccessor(_DvinRepository, _SimpleLogger, _LogConfiguration, _MethodNamesFromStackFramesExtractor); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { TashAccessor.ConfirmDeadWhileClosing(vProcessId); }