예제 #1
0
 private void ProgramEntry_UninstallationFinished(object sender, OperationFinishedEventArgs e)
 {
     if (!e.Cancelled)
     {
         UpdateProgramList(e.Entry, e.OperationType);
         NotifyService.Notify(new Notification("Info", "Uninstallation finished"));
     }
 }
        public async override Task <TollGeolocationStatus> CheckStatus()
        {
            var location  = GeoWatcher.Location;
            var waypoints = GeoDataService.FindNearestEntranceTollPoints(location);

            WaypointChecker.SetTollPointsInRadius(waypoints);

            if (waypoints.Count == 0)
            {
                return(TollGeolocationStatus.NotOnTollRoad);
            }

            var insideTollPoint = WaypointChecker.DetectWeAreInsideSomeTollPoint(location);

            if (insideTollPoint != null)
            {
                double radius = insideTollPoint.Radius != 0 ? insideTollPoint.Radius / 1000 : SettingsService.WaypointSmallRadius * 1000;
                Log.LogMessage($"We are inside tollpoint {radius} radius");

                WaypointChecker.SetIgnoredChoiceTollPoint(insideTollPoint);

                if (WaypointChecker.TollPointsInRadius.Count == 1)
                {
                    GeoWatcher.StopUpdatingHighAccuracyLocation();
                }

                if (await SpeechToTextService.AskQuestion($"Are you entering {insideTollPoint.Name} tollroad?"))
                {
                    WaypointChecker.SetEntrance(insideTollPoint);

                    if (insideTollPoint.WaypointAction == WaypointAction.Bridge)
                    {
                        WaypointChecker.SetExit(insideTollPoint);

                        WaypointChecker.SetTollPointsInRadius(null);
                        await NotifyService.Notify("Bill was created");

                        WaypointChecker.ClearData();
                        return(TollGeolocationStatus.NotOnTollRoad);
                    }
                    else
                    {
                        return(TollGeolocationStatus.OnTollRoad);
                    }
                }
                else
                {
                    return(TollGeolocationStatus.NotOnTollRoad);
                }
            }
            else
            {
                return(TollGeolocationStatus.NearTollRoadEntrance);
            }
        }
예제 #3
0
        private void CheckSelfUpdate()
        {
            PackageManager m = new PackageManager();

            _selfUpdate = m.GetManagerUpdate(new Core.Models.Version(Assembly.GetExecutingAssembly().GetName().Version.ToString()));
            if (_selfUpdate != null)
            {
                menuItem_update.Visibility = Visibility.Visible;
                NotifyService.Notify(new Notification("Update", "There is a update for VoukoderManager. Click to install it"), DoSelfUpdate);
            }
        }
예제 #4
0
 private void Package_InstallationFinished(object sender, OperationFinishedEventArgs e)
 {
     if (!e.Cancelled)
     {
         if (e.Entry.ComponentType == ProgramType.VoukoderCore || ((VKPackage)e.Entry).Dependencies != null)
         {
             LoadProgramLists();
         }
         else
         {
             UpdateProgramList(e.Entry, e.OperationType);
         }
         NotifyService.Notify(new Notification("Info", "Installation finished"));
     }
 }
        private void CheckForUpdate()
        {
            if (_entry.SubComponent != null)
            {
                var p = new PackageManager();
                if (!_updateSearchCoreDone)
                {
                    _coreUpdate           = p.GetUpdate(_entry.SubComponent.SubComponent);
                    _updateSearchCoreDone = true;
                }

                var update = p.GetUpdate(_entry.SubComponent);
                if (update == null)
                {
                    if (_coreUpdate != null)
                    {
                        _packageUpdate           = _coreUpdate;
                        _buttonUpdate.Content    = "Update";
                        _buttonUpdate.Visibility = Visibility.Visible;
                        CreateUpdateInfo(_packageUpdate);
                    }
                }
                else
                {
                    if (_coreUpdate != null)
                    {
                        update.Dependencies = new List <IGitHubEntry>()
                        {
                            _coreUpdate
                        };
                        CreateUpdateInfo(_coreUpdate);
                    }
                    _packageUpdate           = update;
                    _buttonUpdate.Content    = "Update";
                    _buttonUpdate.Visibility = Visibility.Visible;
                    CreateUpdateInfo(update);
                }
                if (_packageUpdate != null)
                {
                    NotifyService.Notify(new Notification("Update", $"There is an update available: {_packageUpdate.Name}"));
                }
            }
        }
        public override async Task <TollGeolocationStatus> CheckStatus()
        {
            var location  = GeoWatcher.Location;
            var waypoints = GeoDataService.FindNearestExitTollPoints(location);

            WaypointChecker.SetTollPointsInRadius(waypoints);

            if (waypoints.Count == 0)
            {
                return(TollGeolocationStatus.OnTollRoad);
            }

            var insideTollPoint = WaypointChecker.DetectWeAreInsideSomeTollPoint(location);

            if (insideTollPoint != null)
            {
                double radius = insideTollPoint.Radius != 0 ? insideTollPoint.Radius / 1000 : SettingsService.WaypointSmallRadius * 1000;
                Log.LogMessage($"We are inside tollpoint {radius} radius");

                WaypointChecker.SetIgnoredChoiceTollPoint(insideTollPoint);

                if (WaypointChecker.TollPointsInRadius.Count == 1)
                {
                    GeoWatcher.StopUpdatingHighAccuracyLocation();
                }

                if (await SpeechToTextService.AskQuestion($"Are you exiting from {insideTollPoint.Name} tollroad?"))
                {
                    WaypointChecker.SetExit(insideTollPoint);
                    WaypointChecker.SetTollPointsInRadius(null);
                    WaypointChecker.SetIgnoredChoiceTollPoint(null);

                    if (WaypointChecker.Exit != null)
                    {
                        await NotifyService.Notify("Bill was created");

                        var duration = WaypointChecker.TripDuration;

                        if (duration.Hours > 0)
                        {
                            await NotifyService.Notify($"Trip duration is {duration.Hours} hours {duration.Minutes} minutes {duration.Seconds} seconds");
                        }
                        else
                        {
                            await NotifyService.Notify($"Trip duration is {duration.Minutes} minutes {duration.Seconds} seconds");
                        }

                        WaypointChecker.ClearData();
                    }
                    else
                    {
                        await NotifyService.Notify("Bill was not created. You didn't enter any exit");
                    }

                    return(TollGeolocationStatus.NotOnTollRoad);
                }
                else
                {
                    return(TollGeolocationStatus.OnTollRoad);
                }
            }
            else
            {
                return(TollGeolocationStatus.NearTollRoadExit);
            }
        }
예제 #7
0
 public void Notify(object sender, FileSystemEventArgs e)
 {
     notifyService.Notify(e.Name);
 }