Exemple #1
0
        private void NewSessionAction(object obj)
        {
            var sessionManager = ServiceLocator.Instance.Get <ISessionManager>();

            if (!sessionManager.IsSaved)
            {
                var userResult = MessageBox.Show("Do you want to save changes you made to " + sessionManager.Name + "?", "Sentinel", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);
                if (userResult == MessageBoxResult.Cancel)
                {
                    return;
                }
                if (userResult == MessageBoxResult.Yes)
                {
                    SaveSession.Execute(null);

                    // if the user clicked "Cancel" at the save dialog box
                    if (!sessionManager.IsSaved)
                    {
                        return;
                    }
                }
            }

            // Remove the tab control.
            if (tabControl.Items.Count > 0)
            {
                var tab = tabControl.SelectedItem;
                tabControl.Items.Remove(tab);
            }

            Add.Execute(null);
        }
 public SaveSessionViewModel(SaveSession window, Models.SessionModel session)
 {
     this.sessionModel = session;
     Window            = window;
     Genders           = new ObservableCollection <string>()
     {
         "Man", "Woman"
     };
 }
 private void CommonEndOfSession()
 {
     recording = false;
     LocalKinect.KinectController.Stop();
     RemoteKinect.Server.Stop();
     SessionPercentageTimer.Stop();
     EndOfSessionTimer.Stop();
     Session.Duration  = CurrentDuration;
     SaveSessionWindow = new SaveSession(Session);
     SaveSessionWindow.WindowClosed += SaveSessionWindow_WindowClosed;
     SaveSessionWindow.Show();
     RaisePropertyChanged("CanRecord");
     RaisePropertyChanged("CanForceFPS");
 }
        public ActionResult Save(SaveSession model)
        {
            if (ModelState.IsValid && model.Duration.HasValue)
            {
                var session = Context.Sessions.FirstOrDefault(e => e.Uid == model.SessionId); //SessionModel.Mapper.Instance.Get(new SessionModel.QueryByIdentity(sessionId));
                session = session ?? new Session()
                {
                    UserId = CurrentUser.Id
                };                                                              //new SessionModel.Entity { UserId = user.Id.Value };
                session.Duration = new TimeSpan(0, 0, 0, 0, model.Duration.Value);

                // Save the session.
                Context.Sessions.Add(session);
                Context.SaveChanges();

                return(Json(new { status = "success" }));
            }

            return(Json(new { status = "failure" }));
        }
Exemple #5
0
        private void LoadSessionAction(object obj)
        {
            var sessionManager = ServiceLocator.Instance.Get <ISessionManager>();
            var fileNameToLoad = (string)obj;

            if (!sessionManager.IsSaved)
            {
                var userResult = MessageBox.Show("Do you want to save changes you made to " + sessionManager.Name + "?", "Sentinel", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);
                if (userResult == MessageBoxResult.Cancel)
                {
                    return;
                }
                if (userResult == MessageBoxResult.Yes)
                {
                    SaveSession.Execute(null);

                    // if the user clicked "Cancel" at the save dialog box
                    if (!sessionManager.IsSaved)
                    {
                        return;
                    }
                }
            }

            if (fileNameToLoad == null)
            {
                // Open file dialog
                //open a save file dialog
                OpenFileDialog openFile = new OpenFileDialog
                {
                    FileName    = sessionManager.Name,
                    DefaultExt  = ".sntl",
                    Filter      = "Sentinel session (.sntl)|*.sntl",
                    FilterIndex = 0
                };

                if ((bool)!openFile.ShowDialog(this))
                {
                    return;
                }

                fileNameToLoad = openFile.FileName;
            }

            //TODO: can be changed to just clear?
            //tabControl.Items.Clear();

            // Remove the tab control
            if (tabControl.Items.Count > 0)
            {
                var tab = tabControl.SelectedItem;
                tabControl.Items.Remove(tab);
            }

            RemoveBindingReferences();

            sessionManager.LoadSession(fileNameToLoad);
            AddToRecentFiles(fileNameToLoad);

            BindViewToViewModel();

            if (!sessionManager.ProviderSettings.Any())
            {
                return;
            }

            var frame = ServiceLocator.Instance.Get <IWindowFrame>();

            // Add to the tab control.
            var newTab = new TabItem {
                Header = sessionManager.Name, Content = frame
            };

            tabControl.Items.Add(newTab);
            tabControl.SelectedItem = newTab;
        }
Exemple #6
0
        public void Post([FromBody] Session value)
        {
            IInsertSession saveObj = new SaveSession();

            saveObj.InsertSession(value);
        }
Exemple #7
0
 public IkadnBaseObject Save(SaveSession session)
 {
     return(Save());
 }