public static void Save(QueryDefine qd) { string targetQueryPath = QuerysFolderPath + qd.Title + ".xml"; // シリアライズ(書き込み) using (FileStream fs = new FileStream(QuerysFolderPath + qd.Title + ".xml", FileMode.Create, FileAccess.Write)) { Serializer.Serialize(fs, qd); } }
private void ok_Click(object sender, EventArgs e) { try { EditQuery = new QueryDefine(this.Title.Text, this.Query.Text, this.Description.Text); if (IsAdd) { RegistQuery(EditQuery); } else { UpdateQuery(EditQuery); } IsSuccess = true; } catch (Exception ex) { RegistUtil.DisplayErrorMessage("登録に失敗しました。:" + ex) ; } }
private void QueryDisplay(QueryDefine qd) { this.Query.Text = qd.ToJson(); }
public QueryAdd(QueryDefine editQuery, bool isFavorite) { InitializeComponent(); Set(editQuery, isFavorite); }
private void UpdateQuery(QueryDefine editQuery) { // タイトルが変更された場合は元のクエリを消去して登録 if (InitialQuery.Title != editQuery.Title) { if (InitialFavoriteFlg) RegistUtil.RemoveFavoriteQuery(InitialQuery.Title); RegistUtil.Delete(InitialQuery.Title); } else { if (InitialFavoriteFlg && !IsFavorite.Checked) RegistUtil.RemoveFavoriteQuery(editQuery.Title); } RegistQuery(editQuery); }
private void Set(QueryDefine editQuery, bool isFavorite) { InitialQuery = new QueryDefine(editQuery.Title, editQuery.Query, editQuery.Description); InitialFavoriteFlg = isFavorite; this.Title.Text = InitialQuery.Title; this.Query.Text = InitialQuery.Query; this.Description.Text = InitialQuery.Description; this.IsFavorite.Checked = InitialFavoriteFlg; }
private void RegistQuery(QueryDefine editQuery) { if (IsFavorite.Checked) RegistUtil.RegistFavoriteQuery(editQuery.Title); RegistUtil.Save(editQuery); }
private void QueryDisplay(QueryDefine qd) { this.Title.Text = qd.Title; this.Query.Text = qd.Query; this.Description.Text = qd.Description; }