private void Window_Initialized(object sender, EventArgs e) { ferma_forms = new List <Windows.Ferma.Ferma_form>(); ferma_form = new Windows.Ferma.Ferma_form(); ferma_forms.Add(ferma_form); sqlite_main = new SQLiteMain("Data/main.db"); LatestFile model = new LatestFile(); latest_files = new List <LatestFile>(); latest_files = model.getLatestFiles(sqlite_main.Connection()); files_start_index = project_menu.Items.Count; if (latest_files.Capacity > 0) { project_menu.Items.Add(new Separator()); files_start_index = project_menu.Items.Count; foreach (var file in latest_files) { MenuItem menu_item = new MenuItem(); menu_item.Header = file.filepath; menu_item.Click += new RoutedEventHandler(OpenFermaWithFile); project_menu.Items.Add(menu_item); } } }
public void OpenFermaWithFile(string filename) { WorkWithLatestFiles(filename); ferma_form = new Windows.Ferma.Ferma_form(); ferma_forms.Add(ferma_form); ferma_form.openFile(filename); ferma_form.Show(); }