public Project(string name, Uri location) : base(name, location) { AssemblyLocation = GenerateAssemblyLocation(); FReferenceConverter = new ReferenceConverter(location); FDocumentConverter = new DocumentConverter(location); FReferences = new EditableIDList <IReference>("References"); FReferences.Mapper.RegisterMapping <IConverter>(FReferenceConverter); Add(FReferences); FDocuments = new EditableIDList <IDocument>("Documents"); FDocuments.Mapper.RegisterMapping <IConverter>(FDocumentConverter); Add(FDocuments); FReferences.Added += Reference_Added; FDocuments.Added += Document_Added; References = FReferences; Documents = FDocuments; FBackgroundWorker = new BackgroundWorker(); FBackgroundWorker.WorkerReportsProgress = false; FBackgroundWorker.WorkerSupportsCancellation = false; FBackgroundWorker.DoWork += DoWorkCB; FBackgroundWorker.RunWorkerCompleted += RunWorkerCompletedCB; }
public Solution(string path, MappingRegistry registry) : base(Path.GetFileName(path), true) { LocalPath = path; FRegistry = registry; Mapper = new ModelMapper(this, registry); // Do not allow rename on add. Rename triggers save/delete in case of PersistentIDContainer. Projects = new EditableIDList <IProject>("Projects", false); Add(Projects); ProjectContentRegistry = new ProjectContentRegistry(); var tempPath = Shell.TempPath.ConcatPath("ProjectContentRegistry"); if (!Directory.Exists(tempPath)) { Directory.CreateDirectory(tempPath); } ProjectContentRegistry.ActivatePersistence(tempPath); Projects.Added += Projects_Added; Projects.Removed += Projects_Removed; OnRootingChanged(RootingAction.Rooted); }
public Project(string path) : base(path) { LocalPath = path; FReferenceConverter = new ReferenceConverter(path); FDocumentConverter = new DocumentConverter(path); FReferences = new EditableIDList <IReference>("References"); FReferences.RootingChanged += FReferences_RootingChanged; Add(FReferences); FDocuments = new EditableIDList <IDocument>("Documents"); FDocuments.RootingChanged += FDocuments_RootingChanged; Add(FDocuments); FReferences.Added += Reference_Added; FDocuments.Added += Document_Added; References = FReferences; Documents = FDocuments; FBackgroundWorker = new BackgroundWorker(); FBackgroundWorker.WorkerReportsProgress = false; FBackgroundWorker.WorkerSupportsCancellation = false; FBackgroundWorker.DoWork += DoWorkCB; FBackgroundWorker.RunWorkerCompleted += RunWorkerCompletedCB; }
public TLValueTrack(string name) : base(name) { Keyframes = new EditableIDList <TLValueKeyframe>("Keyframes"); Curves = new EditableIDList <TLCurve>("Curves"); Minimum = new EditableProperty <float>("Minimum"); Minimum.Value = -1f; Maximum = new EditableProperty <float>("Maximum"); Maximum.Value = 1f; Add(Keyframes); Add(Curves); Add(Minimum); Add(Maximum); Keyframes.Added += Keyframes_Added; Keyframes.Removed += Keyframes_Removed; string label; int x; if (Int32.TryParse(name, out x)) { label = "Value " + x.ToString(); } else { label = name; } Label.Value = label; }
public TLRuler() : base(IDGenerator.NewID) { Marker = new EditableIDList <TLValueKeyframe>("Marker"); FPS = new EditableProperty <int>("FPS"); FPS.Value = 30; Speed = new EditableProperty <float>("Speed"); Speed.Value = 1; Loop = new EditableProperty <bool>("Loop"); Loop.Value = true; LoopStart = new EditableProperty <float>("LoopStart"); LoopEnd = new EditableProperty <float>("LoopEnd"); LoopEnd.Value = 10; //panzoom matrix Add(Marker); Add(FPS); Add(Speed); Add(Loop); Add(LoopStart); Add(LoopEnd); }
public XElement Serialize(EditableIDList <TLTrackBase> value, Serializer serializer) { var x = new XElement("Timeliner"); x.SerializeAndAddList(value, serializer); return(x); }
public EditableIDList <TLTrackBase> Deserialize(XElement data, Type type, Serializer serializer) { var list = new EditableIDList <TLTrackBase>("Tracks"); data.DeserializeAndAddToList(list, serializer); return(list); }
public TLStringTrack(string name) : base(name) { //create the keyframe list and add it to self Keyframes = new EditableIDList <TLStringKeyframe>("Keyframes"); Keyframes.Added += Keyframes_Added; Add(Keyframes); //set the name of this track Label.Value = "String " + name; }
public TLStringTrack(string name) : base(name) { //create the keyframe list and add it to self Keyframes = new EditableIDList<TLStringKeyframe>("Keyframes"); Keyframes.Added += Keyframes_Added; Add(Keyframes); //set the name of this track Label.Value = "String " + name; }
public void TestCollectionRooting() { var rootContainer = new IDContainer("RootContainer", true); var subContainer1 = new EditableIDList <IIDItem>("SubContainer1"); var subContainer2 = new EditableIDList <IIDItem>("SubContainer2"); var idItem = new IDItem("Item1"); subContainer1.Add(subContainer2); subContainer2.Add(idItem); Assert.AreEqual(false, idItem.IsRooted); rootContainer.Add(subContainer1); Assert.AreEqual(true, idItem.IsRooted); subContainer1.Remove(subContainer2); Assert.AreEqual(false, idItem.IsRooted); // Now check that events are fired not too often int eventFiredCount = 0; idItem.RootingChanged += delegate(object sender, RootingChangedEventArgs args) { eventFiredCount++; switch (args.Rooting) { case RootingAction.Rooted: Assert.IsNotNull(idItem.Owner); break; case RootingAction.ToBeUnrooted: Assert.IsNotNull(idItem.Owner); break; } }; subContainer1.Add(subContainer2); // This should trigger a Rooted event Assert.AreEqual(1, eventFiredCount, "Rooted event didn't occur."); subContainer2.Remove(idItem); // This should trigger a ToBeUnrooted event Assert.AreEqual(2, eventFiredCount, "ToBeUnrooted event didn't occur."); subContainer1.Remove(subContainer2); // This shouldn't trigger anything Assert.AreEqual(2, eventFiredCount, "IdItem did not unsubcribe from event."); subContainer2.Add(idItem); // This should also not trigger anything Assert.AreEqual(2, eventFiredCount, "RootingChanged event triggered even if not in object graph."); subContainer1.Add(subContainer2); // Now this should finally trigger the RootingChanged event. Assert.AreEqual(3, eventFiredCount); }
public TLValueTrack(string name) : base(name) { Keyframes = new EditableIDList <TLValueKeyframe>("Keyframes"); Curves = new EditableIDList <TLCurve>("Curves"); Minimum = new EditableProperty <float>("Minimum"); Minimum.Value = -1f; Maximum = new EditableProperty <float>("Maximum"); Maximum.Value = 1f; Add(Keyframes); Add(Curves); Add(Minimum); Add(Maximum); Keyframes.Added += Keyframes_Added; Keyframes.Removed += Keyframes_Removed; Label.Value = "Value " + name; }
public void TestEditableCollectionAndEditableIDList() { var sampleData = new IIDItem[] { new IDItem("item1"), new IDItem("item2"), new IDItem("item3"), new IDItem("item4"), new IDItem("item5"), new IDItem("item6") }; var sourceCollection = new EditableIDList <IIDItem>("source"); var targetCollection = new EditableCollection <IIDItem>(); var syncer = targetCollection.SyncWith(sourceCollection, (itemB) => itemB); sourceCollection.AddRange(sampleData); CollectionAssert.AreEqual(sourceCollection, targetCollection); sourceCollection.Remove(sampleData[0]); CollectionAssert.AreEqual(sourceCollection, targetCollection); sourceCollection.Clear(); CollectionAssert.AreEqual(sourceCollection, targetCollection, "Clear() on EditableIDList failed."); }
public TLStringTrack(string name) : base(name) { //create the keyframe list and add it to self Keyframes = new EditableIDList <TLStringKeyframe>("Keyframes"); Keyframes.Added += Keyframes_Added; Add(Keyframes); //set the name of this track string label; int x; if (Int32.TryParse(name, out x)) { label = "String " + x.ToString(); } else { label = name; } Label.Value = label; }
public TLAudioTrack(string name) : base(name) { Samples = new EditableIDList<TLSample>("Samples"); }
public TLAudioTrack(string name) : base(name) { Samples = new EditableIDList <TLSample>("Samples"); }
//imitate base constructor public TLDocument(string name, string location) : base(name, location) { //create tracks list Tracks = new EditableIDList<TLTrackBase>("Tracks"); //add to self Add(Tracks); }
public TLValueTrack(string name) : base(name) { Keyframes = new EditableIDList<TLValueKeyframe>("Keyframes"); Curves = new EditableIDList<TLCurve>("Curves"); Minimum = new EditableProperty<float>("Minimum"); Minimum.Value = -1f; Maximum = new EditableProperty<float>("Maximum"); Maximum.Value = 1f; Add(Keyframes); Add(Curves); Add(Minimum); Add(Maximum); Keyframes.Added += Keyframes_Added; Keyframes.Removed += Keyframes_Removed; Label.Value = "Value " + name; }