private void buttonLogout_Click(object sender, EventArgs e)
 {
     this.BackgroundImage = global::UI.Properties.Resources.faccebook_background;
     FacebookConnection.Logout();
     panelMain.Controls.Clear();
     panelMain.Controls.Add(buttonlLogin);
     checkBoxRememberUser.Checked = false;
     panelMain.Controls.Add(checkBoxRememberUser);
 }
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     try
     {
         DataManagerWrapper.SetDataManager(this, FacebookConnection.Login());
         showHomePage();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
        public static Boolean AppUserNotification(String UserId, String Group)
        {
            if (!String.IsNullOrEmpty(RaceDayConfiguration.Instance.NotifyAdminUser))
            {
                String             message = String.Format("{0} joined RaceDay group {1}", FacebookConnection.UserTemplateToken(UserId), Group);
                FacebookConnection fb      = new FacebookConnection(FacebookUser.CurrentUser.Identity);
                return(fb.UserNotification(
                           FacebookConnection.AppToken(RaceDayConfiguration.Instance.ApplicationId, RaceDayConfiguration.Instance.ApplicationSecret),
                           RaceDayConfiguration.Instance.NotifyAdminUser,
                           "newuser",
                           "/",
                           message));
            }

            return(true);
        }
Пример #4
0
        // Application specific functionality
        //
        protected Boolean AppEventNotification(String EventName, DateTime EventDate)
        {
            if (!String.IsNullOrEmpty(RaceDayConfiguration.Instance.NotifyAdminUser))
            {
                String message = String.Format("{0} added the event {1} for {2}",
                                               FacebookConnection.UserTemplateToken(FacebookUser.CurrentUser.id), EventName, EventDate.ToShortDateString());
                FacebookConnection fb = new FacebookConnection(FacebookUser.CurrentUser.Identity);
                return(fb.UserNotification(
                           FacebookConnection.AppToken(RaceDayConfiguration.Instance.ApplicationId, RaceDayConfiguration.Instance.ApplicationSecret),
                           RaceDayConfiguration.Instance.NotifyAdminUser,
                           "event",
                           "/",
                           message));
            }

            return(true);
        }
        protected override void OnShown(EventArgs e)
        {
            try
            {
                m_AppSettings = AppSettings.Instance;
                if (m_AppSettings.RememberUser && !string.IsNullOrEmpty(m_AppSettings.LastAccessToken))
                {
                    DataManagerWrapper.SetDataManager(this, FacebookConnection.Connect(m_AppSettings.LastAccessToken));
                    initializeUserPreferences();
                    showHomePage();
                }
            }
            catch (Exception)
            {
            }

            base.OnShown(e);
        }
Пример #6
0
        public async Task <IActionResult> Create(IFormFile file, [Bind("BookId,BookName,Author,Publication,Price,Summary,PictureName,GenreId")] Book book)
        {
            if (ModelState.IsValid)
            {
                if (file == null)
                {
                    ModelState.AddModelError("", "You must enter book picture");
                }
                else if (GetAllBooks.Where(b => b.BookName == book.BookName).Count() == 0)
                {
                    // get the image name and save the path to the saved pictures
                    var filePath = _staticImagesRoute + file.FileName;

                    // save the image name to the pictureName property so we get it later for the view
                    book.PictureName = "/img/" + file.FileName;

                    // save the picture to the static path
                    using (var stream = new FileStream(filePath, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);
                    }

                    // save book
                    _context.Add(book);
                    await _context.SaveChangesAsync();

                    FacebookConnection.PostMessage(book);
                    return(RedirectToAction(nameof(Index)));
                }
                else
                {
                    ModelState.AddModelError("", "The book already exist");
                }
            }
            ViewData["GenreID"] = new SelectList(_context.Genres, "GenreId", "GenreName", book.GenreId);
            return(View(book));
        }
 private void manualConnection()
 {
     DataManagerWrapper.SetDataManager(this, FacebookConnection.Login());
     invokeHomePage();
 }
 private void AutomaticConnection()
 {
     initializeUserPreferences();
     DataManagerWrapper.SetDataManager(this, FacebookConnection.Connect(m_AppSettings.LastAccessToken));
     showHomePage();
 }