/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); if ((manager = SaveLoad.OnLoad()) != null) ; //setToCurrent(); else manager = new SeriesManager(); //manager.CurrentSeriesChanged += new SeriesManager.CurrentSeriesChangedHandler(manager_CurrentSeriesChanged); }
private void GUI_Load(object sender, EventArgs e) { if ((manager = SaveLoad.OnLoad()) != null) setToCurrent(); else manager = new SeriesManager(); manager.CurrentSeriesChanged += new SeriesManager.CurrentSeriesChangedHandler(manager_CurrentSeriesChanged); if (manager.Series.Count() != 0) titleControl1.SetText(manager.CurrentSeries.Value); }
/// <summary> /// Instantiates a <see cref="EditSeries"/> with the content of the specified <see cref="Series"/> /// </summary> /// <param name="series">The <see cref="Series"/> to display</param> /// <param name="manager">The manager containing the <see cref="Series"/></param> public EditSeries(Series series, SeriesManager manager) : this() { this.series = series; this.manager = manager; titleControl1.SetText(series); pbPoster.Image = series.Picture; populateTreeView(series); fbd = new FolderBrowserDialog(); }
/// <summary> /// Saves the list. /// </summary> /// <param name="manager">The manager.</param> /// <param name="filename">The filename.</param> /// <exception cref="System.ArgumentException">Empty filename</exception> public static void SaveList(SeriesManager manager, string filename) { if (filename.Length == 0) { throw new ArgumentException("Empty filename"); } try { SaveLoad.SaveManager(manager, filename); } catch (ArgumentException) { Console.WriteLine("Not a valid file"); } catch (IOException) { Console.WriteLine("File being used by another proces"); } }
/// <summary> /// Saves the manager. /// </summary> /// <param name="manager">The manager.</param> /// <param name="filename">The filename.</param> public static void SaveManager(SeriesManager manager, string filename) { using (Stream file = File.Open(filename, FileMode.Create)) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, manager); } }
/// <summary> /// Creates a new list /// </summary> /// <param name="manager">The manager.</param> /// <param name="currentFile">The current file.</param> public void NewList(SeriesManager manager, ref string currentFile) { Filename file = new Filename(); file.ShowDialog(); currentFile = file.File; file.Dispose(); SaveList(manager, currentFile); }