private void SaveButton_Click(object sender, EventArgs e) { var settings = (UserSettings)CurrentPropertyGridControl.SelectedObject; UserSettings.Save(settings); GlobalObjects.UserSettings = settings; StatusMessagesService.Write("Some settings will be updated after app restart."); Close(); }
public virtual ActionResult Index() { ViewBag.Message = "Welcome to Epilogger!"; var activity = ES.GetHomepageActivity(); var model = new HomepageViewModel( activity.Take(8).ToList(), 0, activity.Count() ) {HomepageTotal = new HomepageTotal()}; model.HomepageTotal = new HomepageTotals().HomepageTotal; //Do the redis stuff to get the Trending Events var eplRedis = new Common.Redis(); var trendingEventId = eplRedis.GetTrendingEvents(); var trendingEvents = new List<Event>(); foreach (var e in trendingEventId.Take(10).Select(eventId => ES.FindByID((int.Parse(eventId))))) { if (e !=null) { e.Name = e.Name.TruncateAtWord(30); trendingEvents.Add(e); } } model.TrendingEvents = trendingEvents; //Convert the Image ID in the ActivityContent to the Image HTML from the template. Facilite common HTML and single place for image HTML. foreach (var item in model.Activity.Where(item => item.ActivityType == ActivityType.PHOTOS_VIDEOS)) { item.Image = IS.FindByID(Convert.ToInt32(item.ActivityContent)); } //This is for the featured Events //Get all the Events that are currently features var featured = new List<HomepageFeaturedEventsViewModel>(); foreach (var evt in ES.GetFeaturedEvents()) { var fViewModel = new HomepageFeaturedEventsViewModel { Event = evt, TopImages = IS.GetNewestPhotosByEventID(evt.ID, 5) }; featured.Add(fViewModel); } model.FeaturedEvents = featured; var sc = new StatusMessagesService(); model.StatusMessages = sc.GetLast10Messages(); return View(model); }
static void ApplicationStartup() { GlobalObjects.Storage = new LiteDatabaseStorage(); GlobalObjects.UserSettings = UserSettings.Load(); StatusMessagesService.StartAutoClearThread(); GlobalObjects.MainForm = new MainForm(); GlobalObjects.MainForm.FormClosed += delegate { Application.Exit(); }; GlobalObjects.MainForm.Show(); }
private void RefreshButton_Click(object sender, EventArgs e) { StatusMessagesService.Write("Refreshing."); XWV.Reload(); }
public CustomBrowserControl() { InitializeComponent(); XWV = new CefSharpXWebView(CurrentXWebViewControl, new BrowserRequestHandler()); //Register events. //----- XWV.LoadStarted += (s, e) => { if (_requestsReplacer.IsUrlRedirect(e.Url, out var redirectUrl)) { e.Cancel = true; XWV.LoadUrl(redirectUrl); } else { StatusMessagesService.Write($"Navigating to '{e.Url}'. "); } }; XWV.GoBackRequested += (s, e) => { StatusMessagesService.Write($"Go back'."); }; XWV.GoForwardRequested += (s, e) => { StatusMessagesService.Write($"Go forward'."); }; XWV.LoadFinished += async(s, e) => { XWV.ThreadSync.Invoke(() => { UrlTextEdit.Text = e.Url; }); if (e.IsError) { StatusMessagesService.Write($"Error while loading '{e.Url}'. " + $"Error description: '{e.ErrorDescription}'."); } else { StatusMessagesService.Write($"Loaded '{e.Url}'. "); try { var title = await XWV.ExJs <string>("return document.title;"); await XWV.ThreadSync.InvokeAsync(() => { PageTitleChanged?.Invoke(XWV, title); }); } catch (Exception ex) { Debug.WriteLine(ex); } } }; XWV.Disposing += delegate { StatusMessagesService.Write("Closing WebView."); }; //----- XWV.WaitInitialization().ContinueWith((t) => { XWV.LoadUrl(GlobalObjects.UserSettings.HomeUrl); }); }
public virtual ActionResult StatusMessages(StatusMessage model) { var sc = new StatusMessagesService(); sc.Save(model); return View(); }