public static string WriteApplicationToFile(SavedAppications applications, string pathToFile) { FileStream overWriteFile = new FileStream(pathToFile, FileMode.Create); StreamWriter textWriter = new StreamWriter(overWriteFile); SavedAppications reFormatted = new SavedAppications(); reFormatted.TemplateName = applications.TemplateName; reFormatted.SavedWindows = new List<SavedWindow>( applications.SavedWindows.OrderBy(x => x.WindowPositionNumber)); ; string toObject = JsonConvert.SerializeObject(applications); textWriter.Write(toObject); textWriter.Flush(); textWriter.Close(); return pathToFile; }
private void setProperties(SavedAppications x) { TemplateName = x.TemplateName; // ohh i have to match this shit... iF it exists. // TODO: I may want to wrap the processes thing in its own model to separate my concersn more... // But I already have a list of active windows... How Do I compare these things together? What should I do? // Two things that I think this needs to do now: // First one is to load up applications that are currently not ON // Second resize what is on to their appropriate areas... Wow this just got cool }
private SavedAppications createSavedApplicationFromCurrentState() { SavedAppications applications = new SavedAppications(); applications.TemplateName = this.TemplateName; var list2 = new List<SavedWindow>(_SavedProcesses.AsEnumerable()); applications.SavedWindows = list2; return applications; }
/// <summary> /// Returns the string where we wrote the file /// </summary> public static string WriteApplicationsToStaticFile(SavedAppications applications) { string pathToFile = String.Format(pathStringUnPopulated(), applications.TemplateName); return WriteApplicationToFile(applications, pathToFile); }