public static Solution Deserialize(string path) { XmlSerializer serializer = new XmlSerializer(typeof(Solution)); using (XmlReader Reader = XmlReader.Create(path)) { Solution solution = (Solution)serializer.Deserialize(Reader); HistoryCollection histories = HistoryCollection.Deserialize(); if (histories.Contains(solution.Name)) { histories[solution.Name].Extension = solution.Extension; histories[solution.Name].Path = solution.Path; histories[solution.Name].OpenTime = DateTime.Now; } else { histories.Add(new History() { Name = solution.Name, Extension = solution.Extension, Path = solution.Path, OpenTime = DateTime.Now }); } histories.Serialize(); return(solution); } }
public void Serialize() { if (!Directory.Exists(Path)) { Directory.CreateDirectory(Path); } XmlSerializer serializer = new XmlSerializer(typeof(Solution)); using (XmlWriter xmlWriter = XmlWriter.Create(Path + @"\" + Name + ".gse")) { serializer.Serialize(xmlWriter, this); } HistoryCollection histories = HistoryCollection.Deserialize(); if (histories.Contains(Name)) { histories[Name].Extension = Extension; histories[Name].Path = Path; histories[Name].SaveTime = DateTime.Now; } else { histories.Add(new History() { Name = Name, Extension = Extension, Path = Path, SaveTime = DateTime.Now }); } histories.Serialize(); }
private void ResetUpdateControls() { ResetControls(); if (rawImage == null || isBindingEnabled == false) return; var old = new ImageEffect(); old.Copy(EditionValue); History.Add(new HistoryObject(EffectType.Reset, EditionValue.GetCopy()) { oldValue = old }); UpdatePreview(true); }
public IHistorySharp PopRedo() { if (CanGoahead) { var redo = RedoCollection[RedoCollection.Count - 1]; RedoCollection.Remove(redo); HistoryCollection.Add(redo); return(redo); } return(null); }
public void NewMessageReceived(string message) { string[] receivedMessage = message.Split(','); App.Current.Dispatcher.Invoke(() => { //ToggleButtonCollection.Add(new ToggleVM(Int32.Parse(receivedMessage[1]), receivedMessage[0])); string color; if (receivedMessage[1] == "1") { color = "Green"; } else { color = "Orange"; } string sentReceived; if (message.Contains("received")) { sentReceived = "received"; } else { sentReceived = "sent"; } HistoryCollection.Add(new HistoryVM(receivedMessage[2], receivedMessage[0] + ":" + color, sentReceived)); foreach (var item in ToggleButtonCollection) { if (item.ButtonId == receivedMessage[0]) { if (item.Value == 0) { item.Value = 1; } else if (item.Value == 1) { item.Value = 0; } } } }); }
private void Move(GamePoint point) { _game.Move(point); Redraw(); HistoryCollection.Add(_game.Save()); }
public void PushHistory(IHistorySharp history) { HistoryCollection.Add(history); }