public bool Archive(Workday wd) { IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); try { if (!file.DirectoryExists("/history")) { file.CreateDirectory("/history"); } } catch { return(false); } try { String filename = Workday.StartTime.ToFileTime().ToString(); IsolatedStorageHelper.ObjToFile(wd, typeof(Workday), "/history/" + filename + ".xml"); } catch { return(false); } return(true); }
private void EndWorkday() { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; Workday archivedWorkday = App.Inst.Workday; if (App.Inst.Archive(App.Inst.Workday)) { App.Inst.Workday = new Workday(); MessageBox.Show("This workday has been archived. You can access it again from the 'History' option in the menu."); } else { return; } bool autoExport; if (settings.TryGetValue <bool>("autoTimecardExport", out autoExport)) { if (autoExport) { AutoEmailTimecard(archivedWorkday); } } if (settings.TryGetValue <bool>("autoSummaryExport", out autoExport)) { if (autoExport) { AutoSummarise(); } } }
protected override void OnNavigatedTo(NavigationEventArgs e) { IDictionary <string, string> parameters = NavigationContext.QueryString; if (parameters.ContainsKey("file")) { filename = "/history/" + parameters["file"]; Workday workday = (Workday)IsolatedStorageHelper.FileToObj(typeof(Workday), filename); WorkdayView.Workday = workday; PageTitle.Text = workday.StartTime.ToString("ddd ") + workday.StartTime.ToString("d"); } base.OnNavigatedTo(e); }
private void AutoEmailTimecard(Workday archivedWorkday) { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; SetDic AutoSubmitSettings; if (settings.TryGetValue<SetDic>("AutoSubmitSettings", out AutoSubmitSettings)) { String EmailAddr; if (AutoSubmitSettings.TryGetValue("EmailAddr", out EmailAddr)) { RemoteEmail email = new RemoteEmail(); email.From = "*****@*****.**"; email.To = EmailAddr; email.Subject = "Timecard for " + archivedWorkday.StartTime.ToString("D"); email.Body = HtmlHelper.ItemiseWorkday2(archivedWorkday); email.EmailRequestCompleted += Email_Completed; email.Email(); } } }
private void AutoEmailTimecard(Workday archivedWorkday) { IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings; SetDic AutoSubmitSettings; if (settings.TryGetValue <SetDic>("AutoSubmitSettings", out AutoSubmitSettings)) { String EmailAddr; if (AutoSubmitSettings.TryGetValue("EmailAddr", out EmailAddr)) { RemoteEmail email = new RemoteEmail(); email.From = "*****@*****.**"; email.To = EmailAddr; email.Subject = "Timecard for " + archivedWorkday.StartTime.ToString("D"); email.Body = HtmlHelper.ItemiseWorkday2(archivedWorkday); email.EmailRequestCompleted += Email_Completed; email.Email(); } } }
private void LoadState() { LicenceHelper.IsTrialMode(true); DataDictionary["Workday"] = Workday = (Workday)IsolatedStorageHelper.FileToObj(typeof(Workday), "current/workday.xml"); LastPunch = (PunchType)IsolatedStorageHelper.FileToObj(typeof(PunchType), "current/lastpunch.xml"); PunchList = (ObservableCollection<PunchType>)IsolatedStorageHelper.FileToObj(typeof(ObservableCollection<PunchType>), "current/punchlist.xml"); EmailQueue = (RemoteEmailQueue)IsolatedStorageHelper.FileToObj(typeof(RemoteEmailQueue), "current/emailqueue.xml"); }
public bool Archive(Workday wd) { IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication(); try { if (!file.DirectoryExists("/history")) { file.CreateDirectory("/history"); } } catch { return false; } try { String filename = Workday.StartTime.ToFileTime().ToString(); IsolatedStorageHelper.ObjToFile(wd, typeof(Workday), "/history/" + filename + ".xml"); } catch { return false; } return true; }