Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AlbumManager albumManager = new AlbumManager();

        Session["albums"]     = albumManager.GetAlbums(Constants.defaultAlbumsPageSize, Constants.defaultAlbumsPageIndex);
        Session["albumCount"] = albumManager.GetAlbumCount().ToString();
    }
Beispiel #2
0
    public static string getAlbums(string pageIndex)
    {
        int          pageId       = int.Parse(pageIndex);
        AlbumManager albumManager = new AlbumManager();
        List <Album> albums       = albumManager.GetAlbums(Constants.defaultAlbumsPageSize, pageId);

        return(JsonConvert.SerializeObject(albums));
    }
        private AlbumManager albumManager; //Maybe move this to main window.
        /// <summary>
        /// Constructor with an album manasger instance that was created from the Main Window.
        /// </summary>
        /// <param name="manager">AlbumManager instance</param>
        public AlbumsPage(AlbumManager manager)
        {
            albumManager = manager;
            InitializeComponent();

            //no need to check for index or whatever since the list in album manager is an observablecollection.
            ListViewAlbums.ItemsSource = albumManager.GetAlbums();
        }
        /// <summary>
        /// Default constructor
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            //Subscribe to ESC key event. Receiver ESC button press to stop playing slideshow.
            this.PreviewKeyDown += new KeyEventHandler(EscButtonHandler);
            albumManager         = new AlbumManager();
            AlbumsTv.ItemsSource = albumManager.GetAlbums();
        }
        /// <summary>
        /// Open file, not implemented
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void menuItemOpen_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection <Album> albums = albumManager.GetAlbums();
            RestoreAlbum restoreAlbum           = new RestoreAlbum(albums);

            if (restoreAlbum.ShowDialog() == true)
            {
                this.album = albumManager.GetAlbum(restoreAlbum.AlbumId);
                UpdateGUI();
            }
        }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        NewsAndEventManager newsAndEventsManager = new NewsAndEventManager();

        Session["news"] = newsAndEventsManager.GetNewsHeadline(Constants.defaultHomeNewsPageSize, Constants.defaultNewsPageIndex);

        AlbumManager albumManager = new AlbumManager();

        Session["albums"]     = albumManager.GetAlbums(Constants.defaultHomeAlbumsPageSize, Constants.defaultAlbumsPageIndex);
        Session["albumCount"] = albumManager.GetAlbumCount().ToString();
    }
        /// <summary>
        /// Method to show open file dialog to let user open a bin file to load data.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void Open_Menu_Click(object sender, RoutedEventArgs e)
        {
            string errorMessage;

            //Import saved data from Data.bin file
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Bin file (*.bin)|*.bin";
            if (openFileDialog.ShowDialog() == true)
            {
                albumManager = SerializationHelper.Deserialize(openFileDialog.FileName, out errorMessage);
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    MessageBox.Show(errorMessage);
                }
                AlbumsTv.ItemsSource = albumManager.GetAlbums();
            }
        }
        public IActionResult Index()
        {
            List <Album> albums = manager.GetAlbums();

            return(View(albums));
        }
Beispiel #9
0
 public MainPage()
 {
     this.InitializeComponent();
     Albums = AlbumManager.GetAlbums();
 }