private void liststory_SelectedValueChanged(object sender, EventArgs e) { contentchap.Text = ""; Model.Story story = (Model.Story)liststory.SelectedItem; idt = story.idt; lbStoryName.Text = story.name; List <Model.Chapter> list = story.getChapters(); listchap.DataSource = list; }
public void Show(int iStory) { this.iStory = iStory; switch (iStory) { case 0: pictureBox1.BackgroundImage = Properties.Resources.logo_01; break; case 1: pictureBox1.BackgroundImage = Properties.Resources.logo_02; break; case 2: pictureBox1.BackgroundImage = Properties.Resources.logo_03; break; case 3: pictureBox1.BackgroundImage = Properties.Resources.logo_04; break; case 4: pictureBox1.BackgroundImage = Properties.Resources.logo_05; break; case 5: pictureBox1.BackgroundImage = Properties.Resources.logo_06; break; } contentchap.Text = ""; listchap.DataSource = null; Show(); string[] files = Directory.GetFiles(Application.StartupPath); foreach (string file in files) { string[] token = file.Split('\\'); if (token[token.Length - 1].StartsWith(iStory + "_")) { filesave = token[token.Length - 1]; break; } } if (chapautoscroll == -1) { string[] datasave = filesave.Split('_'); chapautoscroll = int.Parse(datasave[1]); posautoscroll = int.Parse(datasave[2]); } story = Model.MyDatabase.stories.getStories()[iStory]; if (story != null) { List <Model.Chapter> list = story.getChapters(); if (list != null && list.Count > 0) { listchap.DataSource = list; listchap.SelectedIndex = chapautoscroll; } } }