private static void InitializeForm(string category, string username) { if (_singleton == null) _singleton = new FormEditArtical(); _singleton.InitializeComponent(); _singleton._tableLookupCategoriesTableAdapter.Fill(_singleton._kanNaimDataSetCategories.Table_LookupCategories); _singleton._comboBoxArticleCategory.SelectedIndex = _singleton._comboBoxArticleCategory.FindString(category); _singleton._tableLookupReportersTableAdapter1.Fill(_singleton._kanNaimDataSetReportersNames.Table_LookupReporters); _singleton._comboBoxEditor.SelectedIndex = _singleton._comboBoxEditor.FindString(username); _singleton._userControlTakFillSizeX3.TakType = 1; _singleton._userControlTakFillSizeX2.TakType = 2; _singleton._userControlTakFillSizeX1.TakType = 3; _singleton._userControlTakFillSizeMedium.TakType = 4; _singleton._userControlTakFillSizeSmall.TakType = 5; UcTakFillCollection.Clear(); UcTakFillCollection.Add("takMedium",_singleton._userControlTakFillSizeMedium); UcTakFillCollection.Add("takSmall",_singleton._userControlTakFillSizeSmall); UcTakFillCollection.Add("takX1",_singleton._userControlTakFillSizeX1); UcTakFillCollection.Add("takX2",_singleton._userControlTakFillSizeX2); UcTakFillCollection.Add("takX3",_singleton._userControlTakFillSizeX3); }
/* private static void FillComboBoxPhotosFromOriginId(int imgId) { var img = (from c in Db.Table_PhotosArchives where c.Id == imgId select c).Single(); int? originId = img.OriginalPhotoId; var relatedPhotos = from c in Db.Table_PhotosArchives where c.OriginalPhotoId == originId select c; foreach (Table_PhotosArchive item in relatedPhotos) { _singl._comboBoxArticlePhoto.Items.Add(item); } } */ public static FormEditArtical GetFormEditArtical(int articleId) { if (_singleton == null) _singleton = new FormEditArtical(); try { _tblArticle = (Db.Table_Articles .Where(c => c.ArticleId == articleId)) .Single(); PopulateFromArticle(); _isNewArticle = false; return _singleton; } catch { _isNewArticle = true; return GetFormEditNewArtical("חדשות", "משה נעים"); } }
private void FormEditArtical_FormClosing(object sender, FormClosingEventArgs e) { _singleton = null; }