ExamFile.cs CampusAppWP8::File::Exams::ExamFile CampusAppWP8::File::Exams Windows::Storage //----------------------------------------------------------------------- //<copyrightfile="ExamFile.cs"company="BTU/IIT"> //Companycopyrighttag. //</copyright> //<author>stubbfel</author> //<sience>03.09.2013</sience> //---------------------------------------------------------------------- namespaceCampusAppWP8.File.Exams { usingSystem.IO; usingCampusAppWP8.Model; usingWindows.Storage; publicclassExamFile:BinaryModel { #regionMember privateStorageFilestorageFile; #endregion #regionConstructor publicExamFile(stringfileName,stringurl) :base(ModelType.FileAndFeed,fileName,url) { this.IsFileUpToDateOnLoad+=newIsFileUpToDate(this.CheckIsFileUpToDate); this.IsModelUpToDateOnLoad+=newIsModelUpToDate(this.CheckIsModelUpToDate); this.IsFileUpToDateOnSave+=newIsFileUpToDate(this.CheckIsFileUpToDate); } #endregion #regionMethod #regionpublic publicasyncvoidLaunchFile() { if(this.storageFile==null) { this.storageFile=awaitthis.file.AsStorageFile(); } if(this.storageFile!=null) { varoptions=newWindows.System.LauncherOptions(); Windows.System.Launcher.LaunchFileAsync(this.storageFile); } } #endregion publicvoidSaveAndLaunchFile() { if(this.file.Exist()) { this.LaunchFile(); } else { this.OnSaved+=newExamFile.OnIO(this.LaunchFile); this.SaveData(); } } #regionprivate privateboolCheckIsModelUpToDate(byte[]model) { if(model==null) { returnfalse; } returntrue; } privateboolCheckIsFileUpToDate(byte[]model,FileInfofileInfo) { if(fileInfo==null||!fileInfo.Exists||fileInfo.Length<1||model!=null) { returnfalse; } returntrue; } #endregion #endregion } }