예제 #1
0
        private void ProfileChangedEvent(object sender, EventArgs e)
        {
            var currentCell = ProgramGrid.CurrentCellAddress;
            var comboBox    = sender as DataGridViewComboBoxEditingControl;

            ProgramManager.entries.programs[currentCell.Y].profile = comboBox.EditingControlFormattedValue.ToString();
            ProgramManager.entries.programs[currentCell.Y].ApplyConfig();
            ProgramManager.SaveEntries();
        }
예제 #2
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (ProgramGrid.SelectedRows.Count > 0)
     {
         var entry = ProgramManager.entries.programs[ProgramGrid.CurrentCell.RowIndex];
         entry.RemoveConfig();
         ProgramManager.entries.programs.Remove(entry);
         ProgramManager.SaveEntries();
         UpdateEntryList();
     }
 }
예제 #3
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (ProfileManager.profiles.Count == 0)
            {
                MessageBox.Show("No profiles have been created. Please create a new profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            var result = openProgramDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (ProgramManager.entries.programs.Any(x => x.path == openProgramDialog.FileName))
                {
                    MessageBox.Show("This program has already been added to the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var newEntry = new ProgramManager.ProgramEntry()
                {
                    icon      = null,
                    path      = openProgramDialog.FileName,
                    profile   = ProfileManager.profiles.First().Key,
                    XIVersion = "Finding..."
                };

                string fileName   = openProgramDialog.FileName;
                int    entryIndex = ProgramManager.entries.programs.Count;

                ProgramManager.entries.programs.Add(newEntry);

                UpdateEntryList();

                Task <Tuple <int, string> > getVersionTask = new Task <Tuple <int, string> >(() =>
                {
                    return(GetXInputVersion(fileName, entryIndex));
                });

                getVersionTask.Start();

                getVersionTask.ContinueWith(task =>
                {
                    ProgramManager.entries.programs[task.Result.Item1].XIVersion = task.Result.Item2;
                    ProgramManager.entries.programs[task.Result.Item1].ApplyConfig();
                    ProgramManager.SaveEntries();
                    UpdateEntryList();
                });
            }
        }
예제 #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ProgramManager.LoadEntries();
            ProfileManager.ReloadProfiles();

            for (int i = 0; i < ProgramManager.entries.programs.Count; i++)
            {
                if (!ProfileManager.profiles.Any(x => x.Key == ProgramManager.entries.programs[i].profile))
                {
                    ProgramManager.entries.programs.RemoveAt(i);
                }
            }

            ProfileCombo_DropDown(null, null);
            DeviceCombo_DropDown(null, null);

            if (ProfileManager.profiles.Count == 0)
            {
                ProfileManager.activeProfile = new ProfileManager.Profile();
            }
            else
            {
                var startupProfile = ProfileManager.profiles.First();
                ProfileManager.activeProfile = startupProfile.Value;
                ProfileCombo.Text            = startupProfile.Key;
            }

            UpdateDeviceCombo();
            UpdateMappingGrid();
            UpdateEntryList();

            foreach (var entry in ProgramManager.entries.programs)
            {
                entry.ApplyConfig();
            }
        }