public VoicepackCombinerForm(VoicepackCombiner voicepackCombiner) { InitializeComponent(); base.Initialize(); _voicepackCombiner = voicepackCombiner; // Custom renderer for displaying gradients and background color. menuStrip1.Renderer = new CustomToolStripRenderer(); this.RoundedEdges = true; listBoxVoicepacks.DataSource = _voicepackCombiner.VoicepacksFilesToCombine; listBoxVoicepacks.DisplayMember = "Name"; listBoxVoicepacks.ItemHeight = 17; listBoxVoicepacks.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; listBoxVoicepacks.DrawItem += new DrawItemEventHandler(listBox_DrawItem); listBoxVoicepacks.DragEnter += new DragEventHandler(listBox_DragEntered); listBoxVoicepacks.DragDrop += new DragEventHandler(listBox_DragDropped); //Need to add an updatemethod: otherwise the bound data is only updated when windows is closed.. (now it is updated when property changes, and when windows closes) checkBoxEnableCombinedVoicepack.DataBindings.Add("Checked", _voicepackCombiner, "UseCombinedVoicepack", true, DataSourceUpdateMode.OnPropertyChanged); _voicepackCombiner.VoicepacksFilesToCombine.ListChanged += VoicepackFiles_ListChanged; UpdateGUIVoicepackListIsEmpty(); //Check if the global voicepack has changed since last time the UI was open _voicepackCombiner.CheckCombinedVoicepackIsStillGlobal(); //Do the check every few seconds while UI is open so it gets updated pollGlobalVoicepackTimer = new System.Timers.Timer(5000); pollGlobalVoicepackTimer.Elapsed += PollGlobalVoicepackChangedTimerElapsed; pollGlobalVoicepackTimer.Start(); VoicepackCombinerFormTooltips.SetToolTip(listBoxVoicepacks, "Testing tooltips"); }
/// <summary> /// TODO: this should not be in this class!!! /// Event handler called by timer to check if the voicepack currently in use was changed (not by the plugin) /// </summary> void PollGlobalVoicepackChangedTimerElapsed(object sender, ElapsedEventArgs e) { _voicepackCombiner.CheckCombinedVoicepackIsStillGlobal(); }