Exemple #1
0
        public async Task <ActionResult> AddOrChangeProcess([FromBody] AddProcess model)
        {
            string userId;

            if (Request.Cookies.ContainsKey("id"))
            {
                userId = Request.Cookies["id"];
            }
            else
            {
                return(BadRequest("Error"));
            }

            try
            {
                using var service = _bookService;
                await service.AddOrUpdateProcess(model.BookId, userId, model.Process);

                return(Ok());
            }
            catch (Exception)
            {
                return(BadRequest("Error"));
            }
        }
        private void addProcessButton_Click(object sender, RoutedEventArgs e)
        {
            if (dataContoller.FindProfileByName(profileList.Text) == null)
            {
                MessageBox.Show("Нет профиля");
                return;
            }
            AddProcess addProcess = new AddProcess(this);

            addProcess.Show();
            LockButtons(true);
        }
Exemple #3
0
        public void Start()
        {
            if (string.IsNullOrEmpty(fullPath))
            {
                return;
            }
            if (!File.Exists(fullPath))
            {
                MsgBox.Error("RemoteClient path does not exist");
                return;
            }
            if (process == null)
            {
                string    fileName        = Path.GetFileName(fullPath);
                Process[] existingProcess = Process.GetProcessesByName(fileName);
                foreach (Process p in existingProcess.Where(IsChildProcess))
                {
                    KillProcess(p);
                }
                process = new Process();

                process.StartInfo.FileName         = fullPath;
                process.StartInfo.WorkingDirectory = Path.GetDirectoryName(fullPath);
                if (!args.IsNullOrEmpty())
                {
                    process.StartInfo.Arguments = @args;
                }
                //Double click exe,bat,cmd...
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.CreateNoWindow  = hide;
                process.Start();

                /*
                 * Add this process to job obj associated with this process handler, so that
                 * when sysproxy exit unexpectedly, this process will be forced killed by system.
                 */
                handler = process.Handle;
                AddProcess?.Invoke(this, EventArgs.Empty);
            }
        }