private void EditApp(object sender, EventArgs e) { player.PlaySound(sounds.Click); var index = apps.FindIndex(a => a == _currentApp); if (apps[index] == null) { return; } var createAppDialog = new CreateAppDialog(apps[index]); if (createAppDialog.ShowDialog() == DialogResult.OK) { Controls.Remove(apps[index].PictureBox); apps[index] = createAppDialog.appEntity; Controls.Add(apps[index].PictureBox); InitIconConfig(apps[index]); UpdateLaunchButtonText(launchButton, apps); UpdateSwitchButtonStatus(switchButton, apps); WriteToFile(config.FilePath, apps); player.PlaySound(sounds.PositiveAction); logger.Log(LogType.Edit, apps[index].AppName); } else { player.PlaySound(sounds.PositiveAction); } }
private void AddApp(object sender, EventArgs e) { player.PlaySound(sounds.Click); var createAppDialog = new CreateAppDialog(); if (createAppDialog.ShowDialog() == DialogResult.OK) { var newApp = (createAppDialog.appEntity.Clone() as AppEntity); apps.Add(newApp); Controls.Add(newApp.PictureBox); InitIconConfig(newApp); UpdateFormSize(this); InitLaunchButtonProps(launchButton, apps); UpdateSwitchButtonStatus(switchButton, apps); WriteToFile(config.FilePath, apps); player.PlaySound(sounds.PositiveAction); logger.Log(LogType.Add, newApp.AppName); } else { player.PlaySound(sounds.NegativeAction); } }