Ejemplo n.º 1
0
 /// <summary>
 /// 启动应用
 /// </summary>
 /// <param name="model">应用的数据模型</param>
 private static void LaunchApp(AppInfo model)
 {
     startFlag = true;
     if (!string.IsNullOrEmpty(model.AppPath))
     {
         switch (model.AppType)
         {
             case 1:
                 CommandHelper.StartCmd(model.AppPath);
                 break;
             case 2:
                 Process.Start(model.AppPath);
                 break;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 运行单个的程序
 /// </summary>
 private void RunSingleApp(AppInfo model)
 {
     LaunchApp(model);
     cmd.HideOpaqueLayer();
     startFlag = false;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 修改按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnModify_Click(object sender, EventArgs e)
        {
            AppInfo model = dgvInfos.SelectedRows[0].DataBoundItem as AppInfo;

            ShowModify(model);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 加载修改的页面
 /// </summary>
 /// <param name="model"></param>
 private void ShowModify(AppInfo model)
 {
     txtName.Text = model.AppName;
     txtParam.Text = model.AppParam;
     txtPath.Text = model.AppPath;
     txtID.Text = model.ID.ToString();
     switch (model.AppType)
     {
         case 1:
             rdbCommand.Checked = true;
             break;
         case 2:
             rdbFile.Checked = true;
             break;
     }
     pnAdd.Show();
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 运行单个的程序
 /// </summary>
 private void RunSingleApp(AppInfo model)
 {
     LaunchApp(model);
     cmd.HideOpaqueLayer();
     startFlag = false;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 鼠标拖拽到列表上完成时发生的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvInfos_DragDrop(object sender, DragEventArgs e)
        {
            string[] fileInfo = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            for (int i = 0; i < fileInfo.Length; i++)
            {
                AppInfo model = new AppInfo();
                model.AppName = Path.GetFileNameWithoutExtension(fileInfo[i]);
                model.AppPath = fileInfo[i];
                model.AppType = (int)ExcuteType.ExcuteFile;
                model.AppParam = "";
                if (!service.Add(model))
                {
                    MessageBox.Show("保存失败!");
                    return;
                }
            }
            InitData();
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 确定按钮事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     bool result = false;
     AppInfo model = new AppInfo();
     model.AppName = txtName.Text;
     model.AppParam = txtParam.Text;
     model.AppPath = txtPath.Text;
     model.AppType = (int)(rdbCommand.Checked ? ExcuteType.ExcuteCommand : ExcuteType.ExcuteFile);
     if (string.IsNullOrEmpty(txtID.Text))
     {
         result = service.Add(model);
     }
     else
     {
         model.ID = int.Parse(txtID.Text);
         result = service.Update(model);
     }
     if (result)
     {
         ResetInput();
         pnAdd.Hide();
         InitData();
     }
     else
     {
         MessageBox.Show("保存失败!");
     }
 }