topeterk / HitCounterManager

Free Hit Counter / Death Counter that is running in the background, so you can focus on your stream. No need to keep any windows open for a window capture any more. Initially designed for Dark Souls and similar games but supports any game.
MIT License
86 stars 20 forks source link

Bug fix where ActiveGameIndex is not set correctly on program Startup #36

Open neimex23 opened 4 weeks ago

neimex23 commented 4 weeks ago

Hey good, I hope you are well. After a lot of time coding and very little because university things I started adding functionalities for ASC 3.0 after my new interface was finished.

I have a problem with the combobox that we used to set the active splitter did'nt set on Startup,

BEFORE HCM INTERFACE IMPLEMENT

LoadAutoSplitterSettings.Invoke(AutoSplitterInstance, [profCtrl, this]);
List<string> GameList = (List<string>)GetGames.Invoke(AutoSplitterInstance, null);
foreach (string i in GameList) comboBoxGame.Items.Add(i);
comboBoxGame.SelectedIndex = (int)GetSplitterEnable.Invoke(AutoSplitterInstance, null);
PracticeModeCheck.Checked = (bool)GetPracticeMode.Invoke(AutoSplitterInstance, null);

AFTER HCM INTERFACE IMPLEMENT

AutoSplitterCoreModule.AutoSplitterRegisterInterface(InterfaceASC);
comboBoxGame.Items.Clear();
foreach (string game in InterfaceASC.GameList)
{
    comboBoxGame.Items.Add(game);
}

 LoadAutoSplitterHotKeys();

You added interfaceASC.ActiveGameIndex = GetSplitterEnable(); on ASC in RegisterHitCounterManagerInterface() Function but the problem for manage this by the function is that called before fill ComboBox on HCM, then this raises an OutOfRange exception in the comboBox, to fix this im added GetActiveGameIndexMethod Function. Remember that now ASC Fill ObservableCollection GameList after AutoSplitterRegisterInterface is invocated.

I dont know why PracticeMode still working but if it works that's enough, maybe is manage by other function.

I have the solution for V2.X but i cant do a PR because There is a commits before or affter in the current branch so I can't do it without breaking everything

Im attach the files that i change HitCounterManagerV2-Fix.zip