private void CreateShutdownForm() { using (_closeUIWaitHandle = new AutoResetEvent(false)) { Thread closeUIThread = new Thread(() => { StreamVRUI closeUI = CreateUI(true); closeUI.Show(); // On close, enqueue exit message closeUI.Closed += (object sender, EventArgs args) => { msgQueue.Enqueue(new Message() { Type = "EXIT" }); }; _closeUIWaitHandle.Set(); System.Windows.Threading.Dispatcher.Run(); }); closeUIThread.SetApartmentState(ApartmentState.STA); closeUIThread.IsBackground = true; closeUIThread.Start(); _closeUIWaitHandle.WaitOne(); } }
private StreamVRUI CreateUI(bool isStreaming) { StreamVRUI ui = new StreamVRUI() { ServerURL = this.serverUrl, UserName = this.userName, RoomCode = this.roomCode, StartingView = this.startingView.Name, StartingViewOptions = this.startingViews.Select(v => v.Name) }; ui.AssignValues(isStreaming); return(ui); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIDocument uiDoc = commandData.Application.ActiveUIDocument; Document doc = uiDoc.Document; this.application = commandData.Application.Application; this.Converter = new GenericConverter(Debug); this.Command_GetAll = new GetAll(Debug, this.Converter); this.Command_Get = new Get(Debug, this.Converter); this.Command_Set = new Set(Debug, uiDoc, this.Converter); this.Command_Paint = new Paint(Debug, this.Converter); this.Command_Create = new Create(Debug, this.Converter); this.Command_Export = new Export(Debug, this.Converter); this.serverUrl = "192.168.0.119:7002"; this.userName = this.application.Username; this.roomCode = "123456"; this.startingViews = GetView3Ds(doc); this.startingView = this.startingViews.FirstOrDefault(e => e.Name == "3D View 3"); Debug("SERVER CONN"); Debug(serverUrl); Debug(userName); Debug(roomCode); StreamVRUI startUI = CreateUI(false); bool? start = startUI.ShowDialog(); if (start != true) { return(Result.Cancelled); } this.serverUrl = startUI.ServerURL; this.roomCode = startUI.RoomCode; this.startingView = this.startingViews.FirstOrDefault(v => v.Name == startUI.StartingView); this.CreateShutdownForm(); this.ListenForMessages(uiDoc); return(Result.Succeeded); }