コード例 #1
0
ファイル: MainForm.cs プロジェクト: sjroesink/zVirtualScenes
 private void btnAddBltInCMD_Click(object sender, EventArgs e)
 {
     if (dataListViewScenes.SelectedIndex != -1)
     {
         scene selected_scene = (scene)dataListViewScenes.SelectedObject;
         AddEditSceneBuiltinCMD addCMDform = new AddEditSceneBuiltinCMD(null, selected_scene.id);
         addCMDform.ShowDialog();
     }
     else
     {
         MessageBox.Show("Please select a scene!", zvsEntityControl.zvsNameAndVersion, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: sjroesink/zVirtualScenes
        private void editCommandToolStripMenuItem_Click(object sender, EventArgs e)
        {
            foreach (scene_commands cmd in dataListViewSceneCMDs.SelectedObjects)
            {
                using (zvsEntities2 db = new zvsEntities2(zvsEntityControl.GetzvsConnectionString))
                {
                    scene_commands selected_sceneCMD = db.scene_commands.FirstOrDefault(c => c.id == cmd.id);
                    if (selected_sceneCMD != null)
                    {
                        if (selected_sceneCMD.scene.is_running)
                        {
                            MessageBox.Show("Cannot modify scene when it is running.", ProgramName);
                            return;
                        }

                        switch ((command_types)selected_sceneCMD.command_type_id)
                        {
                            case command_types.builtin:
                                AddEditSceneBuiltinCMD b_cmd_editForm = new AddEditSceneBuiltinCMD(selected_sceneCMD.id);
                                b_cmd_editForm.ShowDialog();
                                break;
                            case command_types.device_command:
                            case command_types.device_type_command:
                                {
                                    AddEditSceneDeviceCMD editCMDform = new AddEditSceneDeviceCMD(selected_sceneCMD.id, selected_sceneCMD.device_id.Value);
                                    editCMDform.ShowDialog();
                                    break;
                                }
                        }
                    }
                }
            }
        }