private void Initialize()
        {
            Logger Log = Logger.Instance;

            Console.SetOut(Log);
            DataContext = Log.Content;
            Loaded     += new RoutedEventHandler(delegate(object sender, RoutedEventArgs e)
            {
                InputBlock.KeyDown += new KeyEventHandler(delegate(object _sender, KeyEventArgs _e)
                {
                    if (_e.Key == Key.Enter)
                    {
                        Log.RunCommand(InputBlock.Text);
                        InputBlock.Text = "";
                        InputBlock.Focus();
                    }
                });
                Log.Updated += new Logger.UpdatedEventHandler(delegate(string value)
                {
                    Scroller.ScrollToBottom();
                    if (Log.Content.Output.Count > 500)
                    {
                        Log.Content.Output.RemoveAt(0);
                    }
                });
            });
        }
    /// <summary>
    /// Gets the input block at the given position.
    /// </summary>
    /// <returns>
    /// The input block.
    /// </returns>
    /// <param name='touchPos'>
    /// Touch position.
    /// </param>
    protected InputBlock GetInputBlock(Vector2 touchPos)
    {
        foreach (Camera inputCamera in inputCameras)
        {
            InputBlock block = GetInputBlock(inputCamera, touchPos);
            if (block != null)
            {
                if (modalStack.Count > 0)
                {
                    foreach (ModalItem modalItem in modalStack)
                    {
                        if ((modalItem.layerMask | inputCamera.cullingMask) != 0)
                        {
                            if (modalItem.inputBlock == block || modalItem.inputBlock.HasChild(block))
                            {
                                return(block);
                            }

                            break;
                        }
                    }
                }
                else
                {
                    return(block);
                }
            }
        }

        return(null);
    }
        async void InputBlock_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (cmdexecListener.isSubscribed)
                {
                    return;
                }

                string cmd = InputBlock.Text;
                await _wxhtpClient.ExecuteTask(
                    _ct, _wxhtpClient.getTcpClient().Client.RemoteEndPoint.ToString(), METHOD_TYPE.GET, ACTION_TYPE.COMMAND_PROMPT, cmd);

                cmdexecListener.Subscribe(_wxhtpClient, dc);

                dc.ConsoleInput = InputBlock.Text;
                dc.RunCommand();
                InputBlock.IsReadOnly = true;
                InputBlock.Focus();
                Task r = Task.Delay(TimeSpan.FromSeconds(1.5));
                r.Wait();
                InputBlock.IsReadOnly = false;
                Scroller.ScrollToBottom();
            }
        }
示例#4
0
        public void ConnectDevice()
        {
            _networkList = new ObservableCollection <Network>(App.am.Networks);
            _network     = new Network(null);
            foreach (Network n in _networkList)
            {
                if (Messenger.connected(n.Names, n.Comm))
                {
                    App.Current.Dispatcher.Invoke((Action) delegate()
                    {
                        _network.UpdateStatus(n.Names, "connected");
                        InputBlock.Text = InputBlock.Text + Environment.NewLine + "Connected:" + n.Names + "to:" + n.Comm;
                        Scroller.ScrollToBottom();
                        InputBlock.ScrollToEnd();
                    });
                    Console.WriteLine("modem  connected:" + n.Names + "to:" + n.Comm);

                    port2.Content = port2.Content + Environment.NewLine + "Connected:" + n.Names + "";
                }

                else
                {
                    _network.UpdateStatus(n.Names, "disconnected");
                    App.Current.Dispatcher.Invoke((Action) delegate()
                    {
                        InputBlock.Text = InputBlock.Text + Environment.NewLine + "Not connected:" + n.Names + "to:" + n.Comm;
                        Scroller.ScrollToBottom();
                        InputBlock.ScrollToEnd();
                    });
                    Console.WriteLine("not connected:" + n.Names + "to:" + n.Comm);
                    port2.Content = port2.Content + Environment.NewLine + " " + n.Names + " " + n.Status;
                }
            }
        }
        private void InputBlock_OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            string input = InputBlock.Text;

            switch (e.Key)
            {
            case Key.Enter:
                e.Handled = true;
                _model.ExecuteCommand(input);
                break;

            case Key.Tab:
                e.Handled = true;
                _model.ShowMatchingCommand(input);
                InputBlock.SelectionStart  = InputBlock.Text.Length;
                InputBlock.SelectionLength = 0;
                break;

            case Key.Up:
                e.Handled = true;
                _model.GoToPreviousCommand();
                break;

            case Key.Down:
                e.Handled = true;
                _model.GoToNextCommand();
                break;
            }

            InputBlock.Focus();
            Keyboard.Focus(InputBlock);
            Scroller.ScrollToBottom();
        }
示例#6
0
 void WriteLine(string Text, params string[] args)
 {
     Console.ConsoleInput = string.Format(Text, args);
     Console.RunCommand();
     InputBlock.Focus();
     Scroller.ScrollToBottom();
 }
示例#7
0
 void Start()
 {
     rope     = GetComponentInChildren <LightRope>();
     output   = outputObject.GetComponent <InputBlock>();
     leftSet  = null;
     rightSet = null;
 }
    /// <summary>
    /// Raises the tap ended event for the tapped input block.
    /// </summary>
    /// <param name='touchPos'>
    /// Touch position.
    /// </param>
    protected void OnTapEnded(Vector2 touchPos)
    {
        InputBlock block = GetInputBlock(touchPos);

        if (block != null)
        {
            block.OnTapEnded(touchPos);
        }
    }
    /// <summary>
    /// Raises the swipe from right to left event for the swiped input block.
    /// </summary>
    /// <param name='startPos'>
    /// Start swipe position.
    /// <param name='endPos'>
    /// End swipe position.
    /// </param>
    protected void OnSwipeRightLeft(Vector2 startPos, Vector2 endPos)
    {
        InputBlock block = GetInputBlock(startPos);

        if (block != null)
        {
            block.OnSwipeRightLeft(startPos, endPos);
        }
    }
示例#10
0
    /// <summary>
    /// Raises the swipe from left to right event for the swiped input block.
    /// </summary>
    /// <param name='startPos'>
    /// Start swipe position.
    /// <param name='endPos'>
    /// End swipe position.
    /// </param>
    protected void OnSwipeLeftRight(Vector2 startPos, Vector2 endPos)
    {
        Debug.Log("gugu");
        InputBlock block = GetInputBlock(startPos);

        if (block != null)
        {
            block.OnSwipeLeftRight(startPos, endPos);
        }
    }
示例#11
0
 void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         dc.ConsoleInput = InputBlock.Text;
         dc.RunCommand();
         InputBlock.Focus();
         Scroller.ScrollToBottom();
     }
 }
示例#12
0
 private void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     Console.WriteLine("key " + e.Key.ToString());
     if (e.Key == Key.Enter)
     {
         dc.ConsoleInput = InputBlock.Text;
         dc.RunCommand();
         InputBlock.Focus();
         Scroller.ScrollToBottom();
     }
 }
示例#13
0
    /// <summary>
    /// Determines whether this instance has the specified block as a child. It is recursive through all children.
    /// </summary>
    /// <returns>
    /// <c>true</c> if this instance has the specified block as a child; otherwise, <c>false</c>.
    /// </returns>
    /// <param name='block'>
    /// The block.
    /// </param>
    public bool HasChild(InputBlock block)
    {
        foreach (InputBlock childBlock in children)
        {
            if (block == childBlock || childBlock.HasChild(block))
            {
                return(true);
            }
        }

        return(false);
    }
        async void InputBlock_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                _minecraftConsole.ConsoleInput = InputBlock.Text;
                await _minecraft.SendCommandAsync(_minecraftConsole.ConsoleInput);

                _minecraftConsole.RunCommand();
                InputBlock.Focus();
                MinecraftConsole.ScrollToBottom();
            }
        }
示例#15
0
        public ConsoleView()
        {
            InitializeComponent();

            this.DataContext = dc;

            InputBlock.KeyDown += InputBlock_KeyDown;
            InputBlock.Focus();

            Scroller.KeyDown += Scroller_KeyDown;

            dc.Enter = (input) => { };
        }
示例#16
0
        private void bwMessage_DoWork(object sender, DoWorkEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action) delegate()
            {
                InputBlock.Text = InputBlock.Text + Environment.NewLine + "Downloading messages from the server......" + "  " + DateTime.Now.ToString();
                Scroller.ScrollToBottom();
                InputBlock.ScrollToEnd();
            });
            Console.WriteLine("starting the back ground task");
            BackgroundWorker worker = sender as BackgroundWorker;

            syncs(url);
            System.Threading.Thread.Sleep(1000);
        }
示例#17
0
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            App.Current.Dispatcher.Invoke((Action) delegate()
            {
                InputBlock.Text = " " + "  " + DateTime.Now.ToString();// InputBlock.Text + Environment.NewLine + "now sending messages";
                // Scroller.ScrollToBottom();
                InputBlock.ScrollToEnd();
            });

            if (!bwMessage.IsBusy)
            {
                tasks();
            }
            Console.WriteLine("new process after one minute:");
        }
        void KeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                Repl.ConsoleInput = InputBlock.Text;
                if (InputBlock.Text == "")
                {
                    return;
                }

                Repl.RunCommand();
                InputBlock.Focus();
                Scroller.ScrollToBottom();
            }
        }
示例#19
0
 async void InputBlock_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         InputBlock.IsEnabled = false;
         try
         {
             await _context.ConsoleVM.RunCommand();
         }
         finally
         {
             InputBlock.IsEnabled = true;
             InputBlock.Focus();
             Scroller.ScrollToBottom();
         }
     }
 }
示例#20
0
 private void refreshClick(object sender, RoutedEventArgs e)
 {
     if (Messenger.disconnected())
     {
         App.Current.Dispatcher.Invoke((Action) delegate()
         {
             InputBlock.Text = InputBlock.Text + Environment.NewLine + "Ports disconnected " + DateTime.Now.ToString();
             Scroller.ScrollToBottom();
             InputBlock.ScrollToEnd();
         });
     }
     else
     {
         App.Current.Dispatcher.Invoke((Action) delegate()
         {
             InputBlock.Text = InputBlock.Text + Environment.NewLine + "disconnection process failed " + DateTime.Now.ToString();
             Scroller.ScrollToBottom();
             InputBlock.ScrollToEnd();
         });
     }
 }
 private void OutputView_OnMouseEnter(object sender, MouseEventArgs e)
 {
     InputBlock.Focus();
 }
 public void SetFocus()
 {
     InputBlock.Focus();
 }
示例#23
0
	/// <summary>
	/// Initializes a new instance of the <see cref="ModalItem"/> class.
	/// </summary>
	/// <param name='_inputBlock'>
	/// _input block.
	/// </param>
	/// <param name='_layerMask'>
	/// _layer mask.
	/// </param>
	public ModalItem(InputBlock _inputBlock, int _layerMask) 
	{
		inputBlock = _inputBlock;
		layerMask = _layerMask;
	}
示例#24
0
 private void windowLoaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlockKeyDown;
     InputBlock.Focus();
 }
示例#25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModalItem"/> class.
 /// </summary>
 /// <param name='_inputBlock'>
 /// _input block.
 /// </param>
 /// <param name='_layerMask'>
 /// _layer mask.
 /// </param>
 public ModalItem(InputBlock _inputBlock, int _layerMask)
 {
     inputBlock = _inputBlock;
     layerMask  = _layerMask;
 }
示例#26
0
 internal void IssueInputBlock()
 {
     dc.ConsoleInput = InputBlock.Text;
     dc.RunConsoleInput();
     InputBlock.Focus();
 }
示例#27
0
 void Console_Loaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlock_KeyDown;
     InputBlock.Focus();
 }
 Task IPipeline <Order, Response> .Complete()
 {
     InputBlock.Complete();
     return(Task.CompletedTask);
 }
示例#29
0
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
 {
     InputBlock.KeyDown += InputBlock_KeyDown;
     InputBlock.Focus();
 }
示例#30
0
	/// <summary>
	/// Determines whether this instance has the specified block as a child. It is recursive through all children.
	/// </summary>
	/// <returns>
	/// <c>true</c> if this instance has the specified block as a child; otherwise, <c>false</c>.
	/// </returns>
	/// <param name='block'>
	/// The block.
	/// </param>
	public bool HasChild(InputBlock block)
	{
		foreach (InputBlock childBlock in children)
		{
			if (block == childBlock || childBlock.HasChild(block)) {
				return true;
			}
		}
			
		return false;
	}
 public Task Post(Order input)
 {
     InputBlock.Post(input);
     return(Task.CompletedTask);
 }
示例#32
0
        private void syncs(string url)
        {
            App.Current.Dispatcher.Invoke((Action) delegate()
            {
                InputBlock.Text = InputBlock.Text + Environment.NewLine + "Connecting to the download url" + "  " + DateTime.Now.ToString();
                Scroller.ScrollToBottom();
                InputBlock.ScrollToEnd();
            });

            double lastID = 0;

            _messageList = new ObservableCollection <Message>(App.am.Messages);

            try
            {
                lastID = _messageList.Max(h => Convert.ToDouble(h.Id));
            }
            catch
            {
                MessageBox.Show("you have no last ID please insert/reset the last ID !");
                App.Current.Dispatcher.Invoke((Action) delegate()
                {
                    InputBlock.Text = Environment.NewLine + "you have no last ID please insert/reset the last ID !";
                    Scroller.ScrollToBottom();
                    InputBlock.ScrollToEnd();
                });
            }

            if (lastID != 0)
            {
                url = url + lastID.ToString();
                using (var client = new WebClient())
                {
                    try
                    {
                        var json = client.DownloadString(url);
                        //Console.WriteLine(url);
                        WebRequest      request    = WebRequest.Create(url);
                        HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                        Stream          dataStream = response.GetResponseStream();

                        StreamReader reader = new StreamReader(dataStream);

                        string responseFromServer = reader.ReadToEnd();

                        Console.WriteLine(responseFromServer);
                        App.Current.Dispatcher.Invoke((Action) delegate()
                        {
                            InputBlock.Text = InputBlock.Text + Environment.NewLine + responseFromServer + "  " + DateTime.Now.ToString();
                        });

                        // Console.WriteLine(response.ToString());
                        List <Message> models = JsonConvert.DeserializeObject <List <Message> >(responseFromServer);

                        for (int d = 0; d < models.Count; d++)
                        {
                            //Console.WriteLine( models[d].Numbers);


                            _message          = App.am.Messages.Add();
                            _message.Numbers  = models[d].Numbers;
                            _message.Id       = models[d].Id;
                            _message.Messages = models[d].Messages;
                            _message.Dor      = DateTime.Now.ToString();
                            _message.Sent     = "F";

                            _message.Save();
                        }
                        App.Current.Dispatcher.Invoke((Action) delegate()
                        {
                            Refresh();
                        });
                    }
                    catch
                    {
                        Console.WriteLine("server is taking long to respond");
                        App.Current.Dispatcher.Invoke((Action) delegate()
                        {
                            InputBlock.Text = InputBlock.Text + Environment.NewLine + "server is taking long to respond!";
                            Scroller.ScrollToBottom();
                            InputBlock.ScrollToEnd();
                        });
                    }
                }
            }
        }