Beispiel #1
0
        //Override this method for the application specific control
        protected override void sendCommand(int output)
        {
            switch (output)
            {
            case 0:         //Do Nothing
                VirtualKeyboard.ReleaseKey(Keys.Left);
                VirtualKeyboard.ReleaseKey(Keys.Right);
                break;

            case 1:        //Left  arrow (move left)
                VirtualKeyboard.HoldKey(Keys.Left);
                VirtualKeyboard.ReleaseKey(Keys.Right);
                //Console.WriteLine("Left");
                break;

            case 2:        //Right arrow (move right)
                VirtualKeyboard.ReleaseKey(Keys.Left);
                VirtualKeyboard.HoldKey(Keys.Right);
                //Console.WriteLine("Right");
                break;

            default:
                VirtualKeyboard.ReleaseKey(Keys.Left);
                VirtualKeyboard.ReleaseKey(Keys.Right);
                break;
            }
            base.sendCommand(output);
        }
Beispiel #2
0
 private bool CheckKey()
 {
     // if ((!IsCheckCtrlAlKey) || (My.Computer.Keyboard.CtrlKeyDown && My.Computer.Keyboard.AltKeyDown)) TODO
     if ((!IsCheckCtrlAlKey))
     {
         char key = (char)VirtualKeyboard.GetActiveLetterKey();
         if (key == StaticResources.HotKey_Pause)
         {
             Debug.WriteLine("Pause");
             char?tempKey = null;
             while (tempKey != StaticResources.HotKey_Continue)
             {
                 tempKey = (char)VirtualKeyboard.GetActiveLetterKey();
                 if (tempKey == StaticResources.HotKey_Stop)
                 {
                     return(false);
                 }
                 System.Threading.Thread.Sleep(10);
             }
             Debug.WriteLine("Continue");
         }
         else if (key == StaticResources.HotKey_Stop)
         {
             Debug.WriteLine("Stop");
             return(false);
         }
     }
     return(true);
 }
        public void StartSearch()
        {
            MyTorrents.Instance().torrentList.Visible = false;
            TorrentEngine.Instance().SearchCompleted += new SearchCompleted(_torrentEngine_SearchCompleted);
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            keyboard.Reset();

            keyboard.Text = SearchString == null ? "" : SearchString;
            keyboard.DoModal(GUIWindowManager.ActiveWindow);

            if (!keyboard.IsConfirmed)
            {
                MyTorrents.Instance().torrentList.Visible = true;
                MyTorrents.ListType = "Torrents";
                return;
            }

            SearchString = keyboard.Text;

            GUIDialogMenu dlgMenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlgMenu == null)
            {
                return;
            }

            dlgMenu.Reset();

            dlgMenu.SetHeading("Which engine to use?");
            TorrentSearchEngine tse = null;

            try
            {
                tse = new TorrentSearchEngine(Configuration.Instance().Settings["TorrentSearch.Config"] as string);
            }
            catch
            {
                Log.Instance().Print("MyTorrents.xml config file loading failed!");
            }
            foreach (ITorrentSearch engine in tse.Engines)
            {
                GUIListItem listItem = new GUIListItem();
                listItem.Label = engine.Name;
                dlgMenu.Add(listItem);
            }
            dlgMenu.DoModal(GUIWindowManager.ActiveWindow);
            if (dlgMenu.SelectedLabel == -1)
            {
                MyTorrents.Instance().torrentList.Visible = true;
                MyTorrents.ListType = "Torrents";
                return;
            }
            _searchEngine = tse.Engines[dlgMenu.SelectedLabel];
            MyTorrents.Instance().torrentList.Clear();
            MyTorrents.Instance().torrentList.Visible = true;
            MyTorrents.Instance().torrentList.ListItems = SearchResults;

            UpdateSearchResults("Default");//
        }
Beispiel #4
0
        //Override this method for the application specific control
        protected override void sendCommand(int output)
        {
            switch (output)
            {
            case 0:             //Do Nothing
                break;

            case 1:             //Up arrow (move forward/up)
                VirtualKeyboard.HoldKey(Keys.Up);
                break;

            case 2:             //Down arrow (move backward/down)
                VirtualKeyboard.ReleaseKey(Keys.Up);
                VirtualKeyboard.PressKey(Keys.D1);
                break;

            case 3:             //Right arrow (move right)
                VirtualKeyboard.ReleaseKey(Keys.Up);
                VirtualKeyboard.HoldKey(Keys.Right);
                turnKeyIsDown = true;
                break;

            case 4:             //Left  arrow (move left)
                VirtualKeyboard.ReleaseKey(Keys.Up);
                VirtualKeyboard.HoldKey(Keys.Left);
                turnKeyIsDown = true;
                break;
            }
            base.sendCommand(output);
        }
        private void SavePlayList()
        {
            string strNewFileName = playlistPlayer.CurrentPlaylistName;

            if (VirtualKeyboard.GetKeyboard(ref strNewFileName, GetID))
            {
                string strPath         = Path.GetFileNameWithoutExtension(strNewFileName);
                string strPlayListPath = string.Empty;
                using (Profile.Settings xmlreader = new Profile.MPSettings())
                {
                    strPlayListPath = xmlreader.GetValueAsString("music", "playlists", string.Empty);
                    strPlayListPath = Util.Utils.RemoveTrailingSlash(strPlayListPath);
                }

                strPath += ".m3u";
                if (strPlayListPath.Length != 0)
                {
                    strPath = strPlayListPath + @"\" + strPath;
                }
                PlayList playlist = new PlayList();
                for (int i = 0; i < facadeLayout.Count; ++i)
                {
                    GUIListItem  pItem   = facadeLayout[i];
                    PlayListItem newItem = new PlayListItem();
                    newItem.FileName    = pItem.Path;
                    newItem.Description = pItem.Label;
                    newItem.Duration    = (pItem.MusicTag == null) ? pItem.Duration : (pItem.MusicTag as MusicTag).Duration;
                    newItem.Type        = PlayListItem.PlayListItemType.Audio;
                    playlist.Add(newItem);
                }
                IPlayListIO saver = new PlayListM3uIO();
                saver.Save(playlist, strPath);
            }
        }
        /// <summary>
        /// Tries to start the playback of an internet stream
        /// </summary>
        /// <returns>true, if successful</returns>
        private static void OnPlayStream()
        {
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD);

            if (null == keyboard)
            {
                return;
            }
            keyboard.Reset();
            keyboard.Text = String.Empty;
            keyboard.DoModal(GUIWindowManager.ActiveWindow);
            if (keyboard.IsConfirmed)
            {
                if (!keyboard.Text.Equals(String.Empty))
                {
                    if (g_Player.Playing)
                    {
                        g_Player.Stop();
                    }
                    String url = keyboard.Text + ".mplayer";
                    if (url.StartsWith("rtsp:"))
                    {
                        url = "ZZZZ:" + url.Remove(0, 5);
                    }

                    g_Player.Play(url);
                    if (g_Player.Player != null && g_Player.IsVideo)
                    {
                        GUIGraphicsContext.IsFullScreenVideo = true;
                        GUIWindowManager.ActivateWindow((int)Window.WINDOW_FULLSCREEN_VIDEO);
                    }
                }
            }
            return;
        }
 protected bool GetKeyboard(ref string strLine)
 {
     try
     {
         VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)Window.WINDOW_VIRTUAL_KEYBOARD);
         if (null == keyboard)
         {
             return(false);
         }
         keyboard.Reset();
         keyboard.Text = strLine;
         keyboard.DoModal(GetID);
         if (keyboard.IsConfirmed)
         {
             strLine = keyboard.Text;
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         MPTVSeriesLog.Write(string.Format("Virtual Keyboard error: {0}, stack: {1}", ex.Message, ex.StackTrace));
         return(false);
     }
 }
Beispiel #8
0
        /// <summary>
        /// Pelin sisällön alustus
        /// </summary>
        protected void Initialize()
        {
#if DESKTOP
            ((IWindow)Window).Center();
#endif
            graphicsDevice = new Rendering.OpenGl.GraphicsDevice(Window); // TODO: GraphicsDeviceManager, jolle annetaan ikkuna ja asetukset tms. joka hoitaa oikean laitteen luomisen.
            // Graphics initialization is best done here when window size is set for certain
            InitGraphics();
            Device.ResetScreen();
            InitControls();
            InitLayers();
            InitDebugScreen();
            FixedTimeStep = true;
            InstanceInitialized?.Invoke();

            AddMessageDisplay();

            Level = new Level(this);

#if ANDROID
            VirtualKeyboard = new VirtualKeyboard(this);
            //Components.Add(VirtualKeyboard);
            VirtualKeyboard.Initialize();
            VirtualKeyboard.Hide();
#endif

            CallBegin();
        }
Beispiel #9
0
 private void OnChangeName()
 {
     if (_upcomingProgram != null)
     {
         Schedule schedule = Proxies.SchedulerService.GetScheduleById(_upcomingProgram.ScheduleId).Result;
         if (schedule == null)
         {
             return;
         }
         string          schedname = schedule.Name;
         VirtualKeyboard keyboard  = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
         if (keyboard != null)
         {
             keyboard.Reset();
             keyboard.IsSearchKeyboard = false;
             keyboard.Text             = schedname ?? String.Empty;
             keyboard.DoModal(GetID);
             if (keyboard.IsConfirmed)
             {
                 schedule.Name = keyboard.Text;
                 Proxies.SchedulerService.SaveSchedule(schedule).Wait();
             }
         }
     }
 }
Beispiel #10
0
        //Override this method for the application specific control
        protected override void sendCommand(int output)
        {
            switch (output)
            {
            case 0:         //Do Nothing
                break;

            case 1:         //Up arrow (move forward/up)
                VirtualKeyboard.PressKey(System.Windows.Forms.Keys.Up);
                Console.WriteLine("Up");
                break;

            case 2:         //Down arrow (move backward/down)
                VirtualKeyboard.PressKey(System.Windows.Forms.Keys.Down);
                Console.WriteLine("Down");
                break;

            case 3:         //Right arrow (move right)
                VirtualKeyboard.PressKey(System.Windows.Forms.Keys.Right);
                Console.WriteLine("Right");
                break;

            case 4:         //Left  arrow (move left)
                VirtualKeyboard.PressKey(System.Windows.Forms.Keys.Left);
                Console.WriteLine("Left");
                break;
            }

            base.sendCommand(output);
        }
Beispiel #11
0
 private bool CheckKey()
 {
     if ((!IsCheckCtrlAlKey) || (VirtualKeyboard.IsKeyDown(VirtualKeys.VK_CONTROL) && VirtualKeyboard.IsKeyDown(VirtualKeys.VK_MENU)))
     {
         char key = (char)VirtualKeyboard.GetActiveLetterKey();
         if (key == StaticResources.HotKey_Pause)
         {
             Debug.WriteLine("Pause");
             char?tempKey = null;
             while (tempKey != StaticResources.HotKey_Continue)
             {
                 tempKey = (char)VirtualKeyboard.GetActiveLetterKey();
                 if (tempKey == StaticResources.HotKey_Stop)
                 {
                     return(false);
                 }
                 System.Threading.Thread.Sleep(10);
             }
             Debug.WriteLine("Continue");
         }
         else if (key == StaticResources.HotKey_Stop)
         {
             Debug.WriteLine("Stop");
             return(false);
         }
     }
     return(true);
 }
Beispiel #12
0
        /// <summary>
        /// Gets the input from the virtual keyboard window.
        /// </summary>
        public static bool GetStringFromKeyboard(ref string strLine, bool isPassword)
        {
            if (GUIGraphicsContext.form.InvokeRequired)
            {
                GetStringFromKeyboardDelegate d = GetStringFromKeyboard;
                object[] args   = { strLine, isPassword };
                bool     result = (bool)GUIGraphicsContext.form.Invoke(d, args);
                strLine = (string)args[0];
                return(result);
            }

            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            if (keyboard == null)
            {
                return(false);
            }

            keyboard.Reset();
            keyboard.Text     = strLine;
            keyboard.Password = isPassword;
            keyboard.DoModal(GUIWindowManager.ActiveWindow);

            if (keyboard.IsConfirmed)
            {
                strLine = keyboard.Text;
                return(true);
            }

            return(false);
        }
    int TransposeNote(int direction, int data)
    {
        if (data < 0)
        {
            return(data);
        }

        int note = (int)VirtualKeyboard.GetNote(data) - 1;

        if (note + 1 == ( int )VirtualKeyboard.Note.NoteOff)
        {
            return(data);
        }

        int octave = VirtualKeyboard.GetOctave(data);

        int offset = note + direction;

        if (offset > 11)
        {
            octave++;
        }
        if (offset < 0)
        {
            octave--;
            offset = offset + 12;
        }

        offset = System.Math.Abs(offset) % 12 + 1;

        return(VirtualKeyboard.EncodeNoteInfo(offset, octave));
    }
Beispiel #14
0
        protected override void Initialize()
        {
            if (!windowSizeSet)
            {
                SetDefaultResolution();
            }

            if (!windowPositionSet)
            {
                CenterWindow();
            }

            Level = new Level(this);
            base.Initialize();

#if ANDROID
            VirtualKeyboard = new VirtualKeyboard(this);
            Components.Add(VirtualKeyboard);
            VirtualKeyboard.Initialize();
            VirtualKeyboard.Hide();
#endif

            //Activated += (e, sender) => { IsActive = true; };
            //Deactivated += (e, sender) => { IsActive = false; };
        }
        }   // end of LostFocus()

        public static void ShowOnScreenKeyboard()
        {
#if NETFX_CORE
            VirtualKeyboard.Activate();
            //Debug.Assert(false, "Is this needed for Win8?");
#else
            try
            {
                Process tabTip = new Process();
                tabTip.StartInfo.FileName        = "C:\\Program Files\\Common Files\\Microsoft Shared\\ink\\TabTip";
                tabTip.StartInfo.UseShellExecute = true;
                tabTip.Start();
            }
            catch (Win32Exception e)
            {
                Debug.WriteLine("Could not show keyboard. NativeErrorCode: " + e.NativeErrorCode);

                //If this fail we could fall back to the on screen keyboard
                try
                {
                    Process oskProcess = new Process();
                    oskProcess.StartInfo.UseShellExecute = true;
                    oskProcess.StartInfo.FileName        = @"c:\WINDOWS\system32\osk";
                    oskProcess.Start();
                }
                catch (Win32Exception exception)
                {
                    //If this fail we could fall back to the on screen keyboard for Win7

                    Debug.WriteLine("Could not show OSK keyboard. NativeErrorCode: " + exception.NativeErrorCode);
                }
            }
#endif
        }
Beispiel #16
0
        public void SetUp()
        {
            WinAppDriverHelper.CheckIsInstalled();

            WinAppDriverHelper.StartIfNotRunning();

            VirtualKeyboard.MinimizeAllWindows();
        }
Beispiel #17
0
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            if (process == null)
                throw new ArgumentException("No Process");

            VirtualKeyboard kb = new VirtualKeyboard(process);
            kb.Send(Key.A,10);
            kb.Send(13);
        }
Beispiel #18
0
        static VirtualKeyboard()
        {
            object locker = new object();

            lock (locker)
            {
                Instance = new VirtualKeyboard();
            }
        }
Beispiel #19
0
        private void DoSearch()
        {
            string searchString = "";

            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }
            dlg.Reset();
            dlg.SetHeading(Translation.SearchHistory);
            dlg.Add(string.Format("<{0}>", Translation.NewSearch));
            for (int i = _setting.SearchHistory.Count; i > 0; i--)
            {
                dlg.Add(_setting.SearchHistory[i - 1]);
            }
            dlg.DoModal(GetID);
            if (dlg.SelectedId == -1)
            {
                return;
            }

            searchString = dlg.SelectedLabelText;
            if (searchString == string.Format("<{0}>", Translation.NewSearch))
            {
                searchString = "";
            }

            // display an virtual keyboard
            VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);

            if (null == keyboard)
            {
                return;
            }
            keyboard.Reset();
            keyboard.Text = searchString;
            keyboard.DoModal(GetWindowId());
            if (keyboard.IsConfirmed)
            {
                // input confirmed -- execute the search
                searchString = keyboard.Text;
            }

            if ("" != searchString)
            {
                grabber.Search(searchString, Translation.Search);
                UpdateList();
                if (_setting.SearchHistory.Contains(searchString.Trim()))
                {
                    _setting.SearchHistory.Remove(searchString.Trim());
                }
                _setting.SearchHistory.Add(searchString.Trim());
                _setting.Save();
            }
        }
Beispiel #20
0
    private void ParsePSGData(byte data)
    {
        bool first = (data & 128) != 0;

        if (first)
        {
            m_CurrReg  = (data >> 5) & 3;
            m_CurrType = (data >> 4) & 1;
        }

        if (m_CurrType != 0)
        {
            m_LastVol[m_CurrReg] = 0x0f - (data & 0x0f);
            this.data.SetData(m_CurrReg, m_CurrRow, 2, m_LastVol[m_CurrReg]);
        }
        else if (first && m_CurrReg == 3)
        {
            //set noise
            int noise = (data & 7);
            int nf    = noise & 3;
            m_NoiseCH2   = nf == 3;
            m_NoiseMode  = (m_NoiseCH2 ? 1 : 0);
            m_NoiseMode |= ((noise >> 2) & 1) << 4;

            if (!m_NoiseCH2)
            {
                this.data.SetData(3, m_CurrRow, 3, 0x20);
                this.data.SetData(3, m_CurrRow, 4, m_NoiseMode);
                this.data.SetData(3, m_CurrRow, 0, (int)VirtualKeyboard.EncodeNoteInfo(1 + nf, 3));
                this.data.SetData(3, m_CurrRow, 1, 1);
                this.data.SetData(m_CurrReg, m_CurrRow, 2, m_LastVol[3]);
            }
        }
        else if (first)
        {
            m_CurrFreq = (data & 0x0f);
        }
        else
        {
            m_CurrFreq = (m_CurrFreq & 0x0f) | ((data & 0x3f) << 4);
            byte noteData = GetEncodedNoteData(m_CurrFreq);
            if (m_CurrReg != 2 || !m_NoiseCH2)
            {
                this.data.SetData(m_CurrReg, m_CurrRow, 0, noteData);
                this.data.SetData(m_CurrReg, m_CurrRow, 1, 0);
                this.data.SetData(m_CurrReg, m_CurrRow, 2, m_LastVol[m_CurrReg]);
            }
            else
            {
                this.data.SetData(3, m_CurrRow, 3, 0x20);
                this.data.SetData(3, m_CurrRow, 4, m_NoiseMode);
                this.data.SetData(3, m_CurrRow, 0, noteData);
                this.data.SetData(3, m_CurrRow, 1, 1);
                this.data.SetData(3, m_CurrRow, 2, m_LastVol[3]);
            }
        }
    }
Beispiel #21
0
        public static bool IsKeyPressed(VirtualKeyboard keycode)
        {
            // GetAsyncKeyState returns a ushort.
            // The most significant bit of this ushort reflects the state of the button.
            ushort keyState = GetAsyncKeyState((int)keycode);
            ushort mostSignificantBitForUshort = 32768;

            return((keyState & mostSignificantBitForUshort) > 0);
        }
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            if (control == _testConnectionButton)
            {
                TestConnection();
                UpdateButtons();
            }
            else if (control == _serverNameButton)
            {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                if (keyboard != null)
                {
                    keyboard.Reset();
                    keyboard.IsSearchKeyboard = false;
                    keyboard.Text             = _serverNameButton.Label ?? "localhost";
                    keyboard.DoModal(GetID);
                    if (keyboard.IsConfirmed)
                    {
                        _serverNameButton.Label = keyboard.Text.Trim();
                    }
                }
            }
            else if (control == _tcpPortButton)
            {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                if (keyboard != null)
                {
                    int port = ServerSettings.DefaultTcpPort;
                    keyboard.Reset();
                    keyboard.IsSearchKeyboard = false;
                    keyboard.Text             = _tcpPortButton.Label ?? port.ToString();
                    keyboard.DoModal(GetID);
                    if (keyboard.IsConfirmed)
                    {
                        if (!Int32.TryParse(keyboard.Text, out port))
                        {
                            port = ServerSettings.DefaultTcpPort;
                        }
                        _tcpPortButton.Label = port.ToString();
                    }
                }
            }
            else if (control == _enableWolButton || control == _autoStreamingButton)
            {
                UpdateButtons();
            }

            if (control == _autoStreamingButton || control == _rtspStreamingTVButton ||
                control == _rtspStreamingRecButton || control == _teletextSubtitleButton ||
                control == _dvbSubtitlesButton || control == _preferAC3Button ||
                control == _recordingNotificationButton)
            {
                _restartPlayerNeeded = true;
            }
            base.OnClicked(controlId, control, actionType);
        }
        public void SearchContextMenu()
        {
            GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);

            if (dlg == null)
            {
                return;
            }

            dlg.Reset();
            dlg.SetHeading("Torrent menu");
            dlg.Add("Search again");
            dlg.Add("Sort by >>");
            dlg.Add("Filter results");
            dlg.DoModal(GUIWindowManager.ActiveWindow);

            switch (dlg.SelectedLabelText)
            {
            case "Filter results":
            {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                keyboard.Reset();
                keyboard.Text = _filter;
                keyboard.DoModal(GUIWindowManager.ActiveWindow);

                if (keyboard.IsConfirmed)
                {
                    _filter = keyboard.Text;
                    UpdateSearchResults();
                }
                break;
            }

            case "Search again":
            {
                StartSearch();
                break;
            }

            case "Sort by >>":
                dlg.Reset();
                dlg.SetHeading("Sort by...");

                foreach (string sortMethod in _searchEngine.SortMethods())
                {
                    dlg.Add(sortMethod);
                }
                dlg.DoModal(GUIWindowManager.ActiveWindow);

                if (dlg.SelectedLabel != -1)
                {
                    UpdateSearchResults(dlg.SelectedLabelText);
                }
                break;
            }
        }
Beispiel #24
0
        /// <summary>
        /// Makes a new instance of <see cref="InputEngine"/> class.
        /// </summary>
        /// <param name="host">Game host owner.</param>
        /// <param name="moduleLoop">Running loop.</param>
        public InputEngine(GameHost host, GameLoop moduleLoop)
            : base(host, moduleLoop)
        {
            InputStates = new DeviceStates();
            bindings    = new List <Binding>();

            Keyboard = new VirtualKeyboard(null);
            Mouse    = new VirtualMouse(null);
            Joypads  = new List <VirtualJoypad>();
        }
        private void PasteApi_OnClick(object sender, RoutedEventArgs e)
        {
            APIKeyTextBox.Focus();
            if (APIKeyTextBox.Text.Length > 0)
            {
                APIKeyTextBox.Clear();
            }

            VirtualKeyboard.Paste();
        }
Beispiel #26
0
        private void ShowEditor()
        {
            var args = new TextEditorArgs(_editorFont, _editorTitle, _text);

            OnTextEditorStart(this, ref args);
            var vk = new VirtualKeyboard();

            vk.TextEditorClosing += VK_TextEditorClosing;
            Text = vk.Show(args.EditorFont, args.DefaultValue, _pwd, _layout, args.EditorTitle);
        }
        private void textBox2_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            TextBox         textbox        = sender as TextBox;
            VirtualKeyboard keyboardWindow = new VirtualKeyboard(textbox, this);

            if (keyboardWindow.ShowDialog() == true)
            {
                textbox.Text = keyboardWindow.Result;
            }
        }
Beispiel #28
0
    public void UpdateData()
    {
        var colEntry = view.data.GetPatternColumn(view.data.currentPattern, channel);

        for (int i = 0; i < dataEntries.Length; i++)
        {
            UpdateHighlight(i);
            Text label = dataEntries [i].GetComponentInChildren <Text> ( );
            if (colEntry == null)
            {
                label.text  = "-";
                label.color = Color.white;
                continue;
            }
            int val = colEntry.data [line, i];
            if (val < 0)
            {
                label.text  = "-";
                label.color = Color.white;
                continue;
            }

            string text  = System.String.Empty;
            Color  color = Color.white;
            switch (i)
            {
            case 0:
                int off = view.data.GetTransposeOffset(channel);
                off   = Mathf.Clamp((off + 12) / 2, 0, 12);
                color = transposeGradient.Evaluate(off / 12f);

                text = VirtualKeyboard.FormatNote(val);
                break;

            case 1:
                color = val < view.instruments.presets.Length ? validInstrument : invalidInstrument;
                text  = val.ToString("X2");
                break;

            case 2:
                color = volumeGradient.Evaluate(val / 15f);
                text  = val.ToString("X");
                break;

            case 3:
            case 4:
                color = effectColor;
                text  = val.ToString("X2");
                break;
            }

            label.color = color;
            label.text  = text;
        }
    }
Beispiel #29
0
 private void button68_Click(object sender, EventArgs e)
 {
     new System.Threading.Thread(() =>
     {
         Clicker.getInstance.focusL2();
         VirtualKeyboard.KeyDown(Keys.LShiftKey);
         VirtualKeyboard.KeyDown(Keys.OemQuotes);
         System.Threading.Thread.Sleep(1000);
         VirtualKeyboard.KeyUp(Keys.OemQuotes);
         VirtualKeyboard.KeyUp(Keys.LShiftKey);
     }).Start();
 }
Beispiel #30
0
        private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            if (process == null)
            {
                throw new ArgumentException("No Process");
            }

            VirtualKeyboard kb = new VirtualKeyboard(process);

            kb.Send(Key.A, 10);
            kb.Send(13);
        }
Beispiel #31
0
        public async Task CompareInitialScreenshots()
        {
            WinAppDriverHelper.StartIfNotRunning();

            if (!Directory.Exists(TestAppInfo.ScreenshotsFolder))
            {
                Directory.CreateDirectory(TestAppInfo.ScreenshotsFolder);
            }

            // Hide other apps to give a consistent backdrop for acrylic textures
            VirtualKeyboard.MinimizeAllWindows();

            async Task GetScreenshot(string pfn, string fileName)
            {
                using (var session = WinAppDriverHelper.LaunchAppx(pfn))
                {
                    if (TestAppInfo.NoClickCount > 0)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(2));

                        for (var i = 0; i < TestAppInfo.NoClickCount; i++)
                        {
                            await ClickNoOnPopUpAsync(session);
                        }
                    }

                    session.Manage().Window.Maximize();

                    if (TestAppInfo.LongPauseAfterLaunch)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(30)); // Because loading the first frame of the video can sometimes take this long
                    }
                    else
                    {
                        await Task.Delay(TimeSpan.FromSeconds(2));
                    }

                    var screenshot = session.GetScreenshot();
                    screenshot.SaveAsFile(Path.Combine(TestAppInfo.ScreenshotsFolder, fileName), ImageFormat.Png);

                    // Don't leave the app maximized in case we want to open the app again.
                    // Some controls handle layout differently when the app is first opened maximized
                    VirtualKeyboard.RestoreMaximizedWindow();
                }
            }

            await GetScreenshot(TestAppInfo.AppPfn1, App1Filename);
            await GetScreenshot(TestAppInfo.AppPfn2, App2Filename);

            var imageCompareResult = CheckImagesAreTheSame(TestAppInfo.ScreenshotsFolder, App1Filename, App2Filename);

            Assert.IsTrue(imageCompareResult, $"Images do not match.{Environment.NewLine}App1: {App1Filename}{Environment.NewLine}App2: {App2Filename}{Environment.NewLine}See results in '{TestAppInfo.ScreenshotsFolder}'");
        }