/// <summary> /// 强制保存 /// </summary> public void SaveEntity() { if (MessageBox.Show("确认强制保存吗?\n要知道这存在一定破坏性!", "对象编辑", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } ConfigWriter writer = new ConfigWriter { Solution = Context.Solution, Directory = Path.GetDirectoryName(Context.Solution.FileName) }; if (Context.SelectProject != null) { writer.SaveProject(Context.SelectProject, false); return; } var tables = Context.GetSelectEntities(); foreach (var entity in tables) { writer.SaveEntity(entity, false); } }
/// <summary> /// 保存 /// </summary> /// <param name="solution"></param> private static void SaveSolution(SolutionConfig solution) { var writer = new ConfigWriter { Solution = solution, }; writer.SaveSolution(); }
/// <summary> /// 保存 /// </summary> /// <param name="solution"></param> /// <param name="directory"></param> private static void SaveSolution(SolutionConfig solution, string directory) { var writer = new ConfigWriter { Solution = solution, Directory = directory }; writer.SaveSolution(); }
/// <summary> /// 保存解决方案 /// </summary> public void SaveSolution() { ConfigWriter.Save(Context.Solution, Context.FileName); SolutionModel model = new SolutionModel { Solution = Context.Solution }; model.ResetStatus(); Context.StateMessage = "保存成功"; }
/// <summary> /// 升级配置类 /// </summary> /// <returns></returns> public void Save() { var path = IOHelper.CheckPath(@"C:\Projects\AgebullDesigner", "UpgradeDocument"); if (RootConfig.ConfigTypes.Count == 0) { MessageBox.Show(@"点错了吧"); return; } foreach (var type in RootConfig.ConfigTypes) { var file = Path.Combine(path, type.Name + ".cfg"); ConfigWriter.Serializer(file, type); } }
/// <summary> /// 强制保存 /// </summary> public void SaveEntity(object arg) { ConfigWriter writer = new ConfigWriter { Solution = Context.Solution, }; if (Context.SelectProject != null) { writer.SaveProject(Context.SelectProject, Path.GetDirectoryName(Context.Solution.SaveFileName)); return; } var tables = Context.GetSelectEntities(); foreach (var entity in tables) { writer.SaveEntity(entity, Path.GetDirectoryName(Context.Solution.SaveFileName), true); } }