/// <summary>
        /// Close Run Event
        /// </summary>
        void CloseRun()
        {
            var runNumber = _run.RunNumber;

            // if there are any incomplete calls return
            var calls = _repository.Calls.Where(x => x.RunNumber == runNumber);

            if (calls.Any(x => !x.Visited))
            {
                var message = Resources.GetString(Resource.String.message_run_incomplete);
                UserDialogs.Instance.Alert(message);
                return;
            }

            var confirmConfig = new ConfirmConfig
            {
                Message  = Resources.GetString(Resource.String.message_close_run),
                OnAction = (confirm => {
                    if (confirm)
                    {
                        // because we are on a seperate thread we need a new realm
                        var run = _repository.Runs.Find(runNumber);
                        RunService.CloseRun(_repository, run);
                        RefreshData();
                    }
                })
            };

            UserDialogs.Instance.Confirm(confirmConfig);
        }
예제 #2
0
        /// <summary>
        /// Close the run
        /// </summary>
        void CloseRun()
        {
            var profile = _repository.Profiles.First();
            var run     = _repository.Runs.Find(profile.CurrentRunNumber);

            // if there are any incomplete calls return
            var calls = _repository.Calls.Where(x => x.RunNumber == run.RunNumber);

            if (calls.Any(x => !x.Visited))
            {
                var message = Resources.GetString(Resource.String.message_run_incomplete);
                UserDialogs.Instance.Alert(message);
                return;
            }

            var confirmConfig = new ConfirmConfig
            {
                Message  = Resources.GetString(Resource.String.message_close_run),
                OnAction = (confirm => {
                    if (confirm)
                    {
                        RunService.CloseRun(_repository, run);
                        Activity.RunOnUiThread(_fragmentActionListener.PopToRoot);
                    }
                })
            };

            UserDialogs.Instance.Confirm(confirmConfig);
        }