public Page AddSlide(string name, bool saveCurrentFirst = true)
		{
			if (saveCurrentFirst && this.CurrentPage != null && !this.DiagramDoesnShowASlideRightNow) this.SaveCurrent();

			var slide = new Page { Name = name, IsNew = true };
			this.Pages.Add(slide);

			this.CurrentPage = slide;
			this.diagram.Clear();
			this.diagram.AddShape(new TextShape { Text = "Dragdrop new items from the toolbox onto this surface.", Position = new Point(400, 400) });
			//nothing to load since this is a new Page
			this.diagram.Metadata.Id = slide.Id;
			this.diagram.Metadata.Title = name;
			// every new Page is saved even if nothing has been added
			this.SaveCurrent();
			return slide;
		}
		public void ImportAllPagesFromAssembly()
		{
			// reset the whole manager
			this.Reset();
			var names = new[] { "XOM", "Info", "News", "AAPL", "MSFT" };
			Page infoPage = null;
			foreach (var name in names)
			{
				try
				{
					var sri = ExtensionUtilities.GetStream(string.Format("{0}/{1}.xml", location, name), ExtensionUtilities.ExecutingAssemblyName);
					// Application.GetResourceStream(new Uri(string.Format("{0}/{1}.xml", location, name), UriKind.Relative));
					if (sri == null)
					{
						return;
					}
					using (var s = sri)
					{
						var reader = new StreamReader(s);
						var xml = reader.ReadToEnd();
						reader.Close();
						string id = null;
						string title = null;
						GetDiagramIdAndTitle(xml, ref id, ref title);
						if (string.IsNullOrEmpty(id))
						{
							continue;
						}
						if (string.IsNullOrEmpty(title))
						{
							continue;
						}
						this.SaveInStorage(xml, id);

						var page = new Page(id) { Name = title };
						if (title == "Info")
						{
							infoPage = page;
						}
						this.Pages.Add(page);
					}
				}
				catch (Exception exc)
				{
					continue;
				}
			}
			// set the info page as starting page
			if (infoPage != null)
			{
				this.CurrentPage = infoPage;
			}
		}
		public void Reset()
		{
			this.Pages.Clear();
			this.HyperLinks.Clear();
			//make sure this is the lowercase private field
			this.currentPage = null;
			this.OnPropertyChanged("currentPage");
			//clear the storage
			DeleteAllFilesFromStorage();
		}
 internal void SaveSlide(Page page)
 {
     if (page == null) throw new ArgumentNullException("page");
     try
     {
         //make sure the Page info is stored as part of the diagram serialization
         this.diagram.Metadata.Title = page.Name;
         this.diagram.Metadata.Id = page.Id;
         var xml = this.diagram.Save();
         this.SaveInStorage(xml, page.Id);
     }
     catch (Exception exc)
     {
         RadWindow.Alert(exc.Message);
     }
     page.IsNew = false; //once saved it's not new anymore
 }
		public void InitializeFromStorage()
		{
			this.diagram.Clear();
#if WPF
			var xmls = fileManager.LoadPages();
			foreach (var slideXml in xmls)
			{
				string id = null;
				string title = null;
				GetDiagramIdAndTitle(slideXml, ref id, ref title);
				if (string.IsNullOrEmpty(id)) throw new Exception("The slide doesn't have an Id.");
				var page = new Page(id) { Name = title };
				this.Pages.Add(page);
			}
#else
			var xmls = fileManager.LoadPages();
			foreach (var slideXml in xmls)
			{
				string id = null;
				string title = null;
				GetDiagramIdAndTitle(slideXml, ref id, ref title);
				if (string.IsNullOrEmpty(id)) throw new Exception("The slide doesn't have an Id.");
				var page = new Page(id) { Name = title };
				this.Pages.Add(page);
			}
#endif
			if (this.Pages.Any())
			{
				this.CurrentPage = this.Pages[0];
				fileManager.CurrentFile = this.currentPage.Id;
			}
		}