Пример #1
0
    private async void OnClick()
    {
        var target = _inputField.text.ToUpper().Replace(" ", "");

        _inputField.text = "";

        foreach (var x in target)
        {
            if (CheckKey(x))
            {
                Debug.Log("input : " + x);
                await Task.Delay(100);

                //Down
                WinApi32.keybd_event((byte)x, 0, 0, (UIntPtr)0);
                //Wait
                await Task.Delay(1000);

                //Up
                WinApi32.keybd_event((byte)x, 0, 2, (UIntPtr)0);
                //Wait
                await Task.Delay(100);
            }
        }
    }
Пример #2
0
        public MainViewModel()
        {
            FoldersList                     = new ObservableCollection <SoftwareDirectoryViewModel>();
            ScanFolderCommand               = new RelayCommand(OnScanFolderCommand);
            BrowseWorkingFolderCommand      = new RelayCommand(OnBrowseWorkingFolderCommand);
            ClearRecentWorkingFolderCommand = new RelayCommand(OnClearRecentWorkingFolderCommand);
            CloseAppCommand                 = new RelayCommand(() => Application.Current.Shutdown());
            ShowAboutCommand                = new RelayCommand(OnShowAboutCommand);

            QSSettings     = new AppSettings();
            ShowAllFolders = true;

            // Code runs in Blend --> create design time data.
            if (IsInDesignMode)
            {
                #region design mode

                var lstRandomName = "Suspendisse dignissim cursus lectus ut dictum erat porttitor quis Integer nec tincidunt tellus Vestibulum odio libero fringilla quis nunc vel elementum commodo massa Sed luctus vulputate mauris quis varius Morbi eget elit mauris Quisque congue sapien condimentum felis tempus finibus Praesent non molestie enim Quisque gravida".Split(' ');
                var randGen       = new Random();

                FoldersList.Add(new SoftwareDirectoryViewModel(@"C:\")
                {
                    OriginalModel =
                    {
                        AppName      = lstRandomName[randGen.Next(lstRandomName.Length)],
                        NotesToolTip = lstRandomName[randGen.Next(lstRandomName.Length)],
                        ExistenceCheckRegistryKey       = @"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion",
                        ExistenceCheckRegistryValueName = "SM_GamesName",
                        SetupFileName     = "setup.exe",
                        SetupSilentParams = "/q"
                    }
                });

                Title = Constants.APPLICATIONNAME + " 1.2.3.4";

                IsAdmin         = false;
                ComputerDetails = "I5";
                HDDStatus       = "C: OK, D: failing!";

                #endregion design mode
            }
            // Code runs "for real"
            else
            {
                Logger.Setup();

                #region get version

                //http://stackoverflow.com/a/909583/426315

                var assembly = System.Reflection.Assembly.GetExecutingAssembly();
                var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);

                #endregion get version

                Logger.Log.Debug("Start new run - version " + fvi.FileVersion);

                Title = Constants.APPLICATIONNAME + " " + fvi.FileVersion;

                InitLog4NetOutputToWindow();
                LoadAppSettings();
                ScanFolderCommand.Execute(null);
                IsAdmin         = WinApi32.IsUserAnAdmin();
                ComputerDetails = HardwareLogic.GetComputerDetails();
                HDDStatus       = HardwareLogic.GetFixedDrivesStatus();
            }
        }