コード例 #1
0
        internal void EmbedTerminalInObject(VtNetTerminal vtNetTerminal)
        {
            ManualResetEvent reset = new ManualResetEvent(false);

            var t = Task.Factory.StartNew(() =>
                                          TerminalContainer.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                //UI code here
                var newTerminal  = new VirtualTerminalControl();
                var newPivotItem = new PivotItem {
                    Content = newTerminal
                };
                var headingBinding = new Binding {
                    Source = newTerminal, Path = new Windows.UI.Xaml.PropertyPath("WindowTitle")
                };
                newPivotItem.SetBinding(PivotItem.HeaderProperty, headingBinding);

                TerminalContainer.Items.Add(newPivotItem);

                var result = new VtNetTerminal(newTerminal);

                vtNetTerminal.Terminal = newTerminal;
                lock (Terminals)
                {
                    Terminals.Add(vtNetTerminal);
                }

                reset.Set();
            })
                                          );

            t.Wait();
            reset.WaitOne();
            return;
        }