/// <summary> /// Läd den Dialog aus dem angegebenen Dateinamen. /// </summary> /// <param name="filename"></param> /// <param name="objdefid"></param> /// <returns></returns> public bool OpenFromFilename(String filename) { try { String xmlDialog = File.ReadAllText(filename, Encoding.Default); Type[] extraTypes = new Type[0]; //TODO_WPF!!!!!!!!!!!!!extraTypes[0] = typeof(TrackListColumn); XmlSerializer bf = new XmlSerializer(typeof(HitbaseDialogData), extraTypes); StringReader xmlString = new StringReader(xmlDialog); HitbaseDialogData hitbaseDialogData = (HitbaseDialogData)bf.Deserialize(xmlString); xmlString.Close(); ReadDialogFromDialogData(null, hitbaseDialogData); UpdateAllControls(); return(true); } catch (Exception e) { MessageBox.Show(e.Message); return(true); } }
/// <summary> /// Speichern den Dialog im Design-Modus in die angegebene Datei. /// </summary> /// <param name="filename"></param> /// <returns></returns> public bool SaveDialogToFilename(String filename) { HitbaseDialogData hitbaseDialog = new HitbaseDialogData(); hitbaseDialog.Properties.Add(new HitbaseControlData.Property("Version", 1)); SaveDialogToXMLRecursive(hitbaseDialog, this); Type[] extraTypes = new Type[0]; //TODO_WPF!!!!!!!!!!!!!!extraTypes[0] = typeof(TrackListColumn); XmlSerializer bf = new XmlSerializer(typeof(HitbaseDialogData), extraTypes); StreamWriter stream = new StreamWriter(filename, false, Encoding.Default); bf.Serialize(stream, hitbaseDialog); stream.Close(); return(true); }
public string GetXMLStringFromDialog() { HitbaseDialogData hitbaseDialog = new HitbaseDialogData(); hitbaseDialog.Properties.Add(new HitbaseControlData.Property("Version", 1)); hitbaseDialog.Add(this); SaveDialogToXMLRecursive(hitbaseDialog, this); Type[] extraTypes = new Type[0]; //TODO_WPF!!!!!!!!!!!!!!!!!!!extraTypes[0] = typeof(TrackListColumn); XmlSerializer bf = new XmlSerializer(typeof(HitbaseDialogData), extraTypes); StringWriter stream = new StringWriter(); bf.Serialize(stream, hitbaseDialog); stream.Close(); return(stream.ToString()); }
public bool OpenDialogDesign(int categoryId) { Stopwatch sw = new Stopwatch(); sw.Start(); Debug.WriteLine("1.: " + sw.ElapsedMilliseconds.ToString()); DialogDataSet ds = new DialogDataSet(); DialogTableAdapter dialogTableAdapter = new DialogTableAdapter(DataBase); Debug.WriteLine("2.: " + sw.ElapsedMilliseconds.ToString()); dialogTableAdapter.FillByCategoryID(ds.Dialog, categoryId); Debug.WriteLine("3.: " + sw.ElapsedMilliseconds.ToString()); if (ds.Dialog.Rows.Count < 1) // nichts gefunden { return(false); } Type[] extraTypes = new Type[] { typeof(Field) }; //TODO_WPF!!!!!!!!!!!!!!!extraTypes[0] = typeof(TrackListColumn); XmlSerializer bf = new XmlSerializer(typeof(HitbaseDialogData), extraTypes); StringReader xmlString = new StringReader(ds.Dialog[0].DialogXML); HitbaseDialogData hitbaseDialogData = (HitbaseDialogData)bf.Deserialize(xmlString); xmlString.Close(); Debug.WriteLine("4.: " + sw.ElapsedMilliseconds.ToString()); ReadDialogFromDialogData(null, hitbaseDialogData); Debug.WriteLine("5.: " + sw.ElapsedMilliseconds.ToString()); UpdateAllControls(); Debug.WriteLine("6.: " + sw.ElapsedMilliseconds.ToString()); //TODO_WPF!!!!!!!!!!!!! undoEngine.Initialize(); return(true); }