public BookCreator(OuhmaniaModel model) { _model = model; var peopleBindingSource = new BindingSource(); peopleBindingSource.DataSource = model.AllPeople; InitializeComponent(); peopleChechboxList.DataSource = peopleBindingSource; pathOrErrorLabel.DataBindings.Add(new Binding("Text", _model, "ExportPath")); if (_model.ExportPath != null) { exportButton.Enabled = true; } CenterToParent(); }
public MainWindow() { peopleBindingSource = new BindingSource(); loadedPicturesBindingSource = new BindingSource(); _model = new OuhmaniaModel { Version = VERSION, SupportedFileExtensions = supportedExtensions, PicturesWithPeople = new Dictionary <string, List <string> >(), AllPeople = new List <string> { "Thomas Kowalski", "Amanda Turner" }, AutoSave = true, AutoSaveIntervalInMins = 5, DirectoryPath = AppDomain.CurrentDomain.BaseDirectory, CurrentPicturePath = "" }; peopleBindingSource.DataSource = _model.AllPeople; loadedPicturesBindingSource.DataSource = new List <string>(); InitializeComponent(); Text = getFormTitle(); CenterToScreen(); // replace with some method // new Localization(); // saveTagsButton.Text = Localization.Get("SaveButton"); peopleCheckBoxList.DataSource = peopleBindingSource; loadedPicturesList.DataSource = loadedPicturesBindingSource; Trace.Listeners["textWriterListener"].Attributes["initializeData"] = AppDomain.CurrentDomain.BaseDirectory + "\\" + DateTime.Now + ".log"; programLoaded = true; pictureBox1.Image = new Bitmap(20, 20); if (_model.AutoSave) { SetTimer(); } }
public bool LoadModel() { var openFileDialog = new OpenFileDialog { Filter = FILES_FILTER, InitialDirectory = AppDomain.CurrentDomain.BaseDirectory }; if (openFileDialog.ShowDialog() != DialogResult.OK) { return(false); } var reader = new StreamReader(openFileDialog.OpenFile()); _model = new JavaScriptSerializer().Deserialize <OuhmaniaModel>(reader.ReadLine() ?? string.Empty); reader.Dispose(); reader.Close(); Text = GetFormTitle(); return(true); }
public MainWindow() { var newCulture = new CultureInfo("en-US"); Thread.CurrentThread.CurrentCulture = newCulture; Thread.CurrentThread.CurrentUICulture = newCulture; _model = new OuhmaniaModel { Version = VERSION, SupportedFileExtensions = supportedExtensions, PicturesWithPeople = new Dictionary <string, List <string> >(), AllPeople = new List <string>(), AutoSave = true, AutoSaveIntervalInMinutes = 5, DirectoryPath = AppDomain.CurrentDomain.BaseDirectory, CurrentPicturePath = "" }; _model.Dirty = false; peopleBindingSource = new BindingSource { DataSource = _model.AllPeople }; InitializeComponent(); Text = GetFormTitle(); CenterToScreen(); peopleCheckBoxList.DataSource = peopleBindingSource; Trace.Listeners["textWriterListener"].Attributes["initializeData"] = AppDomain.CurrentDomain.BaseDirectory + "\\" + DateTime.Now + ".log"; programLoaded = true; pictureBox1.Image = new Bitmap(20, 20); if (_model.AutoSave) { SetTimer(); } }