示例#1
0
 /// For list view
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     using (var db = new UberEversolContext())
     {
         session_list.ItemsSource = db.Sessions.ToList();
     }
 }
示例#2
0
        /// List button Add
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new UberEversolContext())
            {
                Session s = new Session(dpDate.Date.DateTime, txtTitle.Text, txtDesc.Text);

                db.Sessions.Add(s);
                db.SaveChanges();

                // Update the session list
                session_list.ItemsSource = db.Sessions.ToList();
            }
        }
        /// <summary>
        /// Page Load Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            using (var db = new UberEversolContext())
            {
                subjectList = db.Subjects.OrderBy(s => s.last_name).ToList();
                foreach (Subject s in subjectList.Where(s => s.image != null))
                {
                    s.imageObj = await s.loadImage();
                }

                subject_list.ItemsSource = subjectList;
            }
        }
示例#4
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            /// Migrates the database to the device
            using (var db = new UberEversolContext())
            {
                db.Database.Migrate();
            }
        }
示例#5
0
        private async void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            String qryStr  = txtQry.Text;
            int    qryType = cboFields.SelectedIndex;

            lstvResultsSessions.Visibility = Visibility.Collapsed;
            lstvResultsTracks.Visibility   = Visibility.Collapsed;

            if (!String.IsNullOrEmpty(qryStr))  // Check input value
            {
                using (var db = new UberEversolContext())
                {
                    List <Session> ses_results;
                    List <Track>   trk_results;

                    if (qryType == 0)
                    {
                        ses_results = db.Sessions.Where(s => s.title.Contains(qryStr) ||
                                                        s.description.Contains(qryStr)).ToList();

                        txtSesResultCount.Text          = ses_results.Count + " record(s) found!";
                        lstvResultsSessions.ItemsSource = ses_results;
                        lstvResultsSessions.Visibility  = Visibility.Visible;
                    }
                    else if (qryType == 1)
                    {
                        trk_results = db.Tracks.Where(t => t.title.Contains(qryStr) ||
                                                      t.description.Contains(qryStr) ||
                                                      t.subject.first_name.Contains(qryStr) ||
                                                      t.subject.last_name.Contains(qryStr)).ToList();


                        foreach (Track t in trk_results)
                        {
                            t.loadStructures();  // Populates the Icollection objects of track

                            if (t.subject != null)
                            {
                                t.subject.imageObj = await t.subject.loadImage();
                            }
                        }

                        txtTrkResultCount.Text        = trk_results.Count + " record(s) found!";
                        lstvResultsTracks.ItemsSource = trk_results;
                        lstvResultsTracks.Visibility  = Visibility.Visible;
                    }
                }
            }
        }
示例#6
0
 /// <summary>
 /// After Page frame has been initialized
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     using (var db = new UberEversolContext())
     {
         var ses = from s in db.Sessions
                   where s.id == sessionId
                   select s;
         //selSession = ses;
         txtTitle.Text       = ses.Select(s => s.title).ToString();
         txtDescription.Text = ses.Select(s => s.description).ToString();
         txtFolder.Text      = ses.Select(s => s.folderDir).ToString();
         //db.Sessions.Where(s => s.id == sessionId);
         // Load the Track list
     }
 }
示例#7
0
        /// List button Remove
        private void remove_click(object sender, RoutedEventArgs e)
        {
            Session lvi = (Session)session_list.SelectedItem;

            using (var db = new UberEversolContext())
            {
                var s     = new Session(txtTitle.Text, txtDesc.Text);
                var title = lvi.title;
                db.Sessions.Remove(lvi);
                db.SaveChanges();

                // Update the session list
                session_list.ItemsSource = db.Sessions.ToList();
            }
        }
        /// <summary>
        /// Event when the content dialog is opened
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private async void ContentDialog_Opened(ContentDialog sender, ContentDialogOpenedEventArgs args)
        {
            List <Subject> subject_list;

            using (var db = new UberEversolContext())
            {
                // Get the list of subject names and ids
                subject_list = db.Subjects.OrderBy(t => t.last_name).ToList();
            }

            foreach (Subject s in subject_list)
            {
                if (s.image != null)
                {
                    s.imageObj = await s.loadImage();
                }
                cboSubjects.Items.Add(s);
            }
        }
        /// <summary>
        /// Session add click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void appBtnNewSession_Click(object sender, RoutedEventArgs e)
        {
            cdNewSession newSessionDialog = new cdNewSession();
            await newSessionDialog.ShowAsync();

            if (newSessionDialog.result == cdResult.AddSuccess)
            {
                // Add New was successful.
                // Refresh the listview
                using (var db = new UberEversolContext())
                {
                    session_list.ItemsSource = db.Subjects.ToList();
                }
            }
            else if (newSessionDialog.result == cdResult.AddFail)
            {
                // Add failed.
                // Prompt User
            }
        }
示例#10
0
        /// <summary>
        /// Save button click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            Session  newSes  = new Session(txtTitle.Text, txtDescription.Text);
            TimeSpan timeVal = dtSessionTime.Time;

            newSes.created = dtSessionDate.Date.Date + timeVal;

            using (var db = new UberEversolContext())
            {
                db.Sessions.Add(newSes);
                db.SaveChanges();
            }

            result = cdResult.AddSuccess;

            FlyoutBase.SetAttachedFlyout(this, (FlyoutBase)this.Resources["notifyFlyout"]);
            FlyoutBase.ShowAttachedFlyout(this);

            FlyoutBase.GetAttachedFlyout(this).Hide();
        }