Esempio n. 1
0
        void SpeakAction(object o)
        {
            RaiseNarrationEventWithPossibleWordCompletion(o, NarrationEventType.Utter);

            if (_environment.AppSettings.Keyboard.IsTrainingMode)
            {
                if (!IsAllSelected)
                {
                    TrainingPhrasePrevious = TrainingPhrase;

                    TrainingScore = LevenshtienDistanceScore(TextSlice.Text, TrainingPhrase);

                    TrainingKeysUsed = _trainingKeyCount;

                    var duration = DateTime.UtcNow - _trainingStartTime;
                    TrainingWpm        = TextSlice.Text.Length / 5.0 / duration.TotalMinutes;
                    TrainingVisibility = Visibility.Visible;
                    SetTrainingPhrase();
                }
            }
            else
            {
                TrainingVisibility = Visibility.Collapsed;
            }

            TextSlice          = _editor.SelectAll();
            _isAutoSpaceNeeded = false;

            _predictor.RecordHistory(TextSlice.Text, IsInPrivate);

            TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(EventId.PhrasesSpoken), "1");
            var words = TextSlice.Text.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Length;

            TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(EventId.WordsSpoken), words.ToString());
        }
Esempio n. 2
0
        private void Window_Closing(object sender, EventArgs e)
        {
            AppSettings.Store.Save();

            var process     = Process.GetCurrentProcess();
            var startTime   = process.StartTime;
            var currentTime = DateTime.Now;
            var elapsedTime = currentTime - startTime;

            Properties.Settings.Default.LastSessionId     = InstanceIdentityProvider.Instance.SessionGuid;
            Properties.Settings.Default.LastSessionStart  = startTime;
            Properties.Settings.Default.LastSessionStop   = currentTime;
            Properties.Settings.Default.LastSessionLength = elapsedTime.Ticks;
            Properties.Settings.Default.Save();

            // Turn off ellipsis
            ActivityDisplayProvider.Instance.IsOn = false;

            TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(EventId.AppStop));
            foreach (TraceListener listener in TelemetryMessage.Telemetry.Listeners)
            {
                listener.Flush();
                listener.Dispose();
            }
        }
Esempio n. 3
0
        public void SpeakEffect(AudioGesture effect)
        {
            var args = NarrationEventArgs.Create(effect);

            _lastNarrationEventArgs = args;
            _narrator.OnNarrationEvent(args);

            TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId <AudioGesture>(), effect.ToString());
        }
Esempio n. 4
0
 void RemoveShortcutForThisExe(Version version)
 {
     TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(UpdateTelemetryAction.RemoveShortcut), version.ToString());
     foreach (TraceListener listener in TelemetryMessage.Telemetry.Listeners)
     {
         listener.Flush();
     }
     _updateManager.RemoveShortcutsForExecutable(
         Path.GetFileName(EntryAssembly.Location),
         ShortcutLocations);
 }
Esempio n. 5
0
 void CreateShortcutForThisExe(Version version)
 {
     TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(UpdateTelemetryAction.CreateShortcut), version.ToString());
     foreach (TraceListener listener in TelemetryMessage.Telemetry.Listeners)
     {
         listener.Flush();
     }
     _updateManager.CreateShortcutsForExecutable(Path.GetFileName(
                                                     EntryAssembly.Location),
                                                 ShortcutLocations,
                                                 Environment.CommandLine.Contains("squirrel-install") == false,
                                                 null, null);
 }
Esempio n. 6
0
        private static void GeoWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs <GeoCoordinate> e)
        {
            if (!e.Position.Location.IsUnknown)
            {
                // Record only once
                GeoWatcher.Stop();

                new LocationMessage("Inventory")
                {
                    MessageId      = IdMapper.GetId(InventoryMessages.Location),
                    HostName       = Environment.MachineName,
                    UsernameSecure = Environment.UserName,
                    Location       = new Tuple <double, double>(e.Position.Location.Latitude, e.Position.Location.Longitude)
                }.Enqueue();
            }
        }
Esempio n. 7
0
        private void Window_Loaded(object sender, EventArgs e)
        {
            TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(EventId.AppStart));

            // New session
            Properties.Settings.Default.LastSessionId     = Guid.Empty;
            Properties.Settings.Default.LastSessionStart  = DateTime.Now;
            Properties.Settings.Default.LastSessionStop   = DateTime.Now;
            Properties.Settings.Default.LastSessionLength = 0;
            Properties.Settings.Default.Save();

            // Try to initialize the ellipsis
            ActivityDisplayProvider.Instance.IsOn = true;

            // Give the textbox focus on launch
            TheTextBox.Focus();
        }
Esempio n. 8
0
        async Task UpdateThread()
        {
            Locator.CurrentMutable.Register(() => new SetupLogger(false)
            {
                Level = LogLevel.Info
            }, typeof(ILogger));

            do
            {
                ReleaseEntry entry;
                try
                {
                    entry = await _updateManager.UpdateApp();
                }
                catch (Exception)
                {
                    entry = null;
                }

                if (!_isExitHookInstalled)
                {
                    Application.Current.Dispatcher.Invoke(InstallHook);
                }

                if (entry == null)
                {
                    await Task.Delay(_pollInterval);

                    TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(UpdateTelemetryAction.PolledNoUpdate));
                }
                else
                {
                    TelemetryMessage.Telemetry.TraceEvent(TraceEventType.Information, IdMapper.GetId(UpdateTelemetryAction.PollFoundUpdate), entry.Version.ToString());

                    AvailableUpdate   = entry.Version.Version;
                    IsUpdateAvailable = true;
                    _updateAvailable?.Invoke(this, EventArgs.Empty);

                    Stop();
                }
            }while (!IsUpdateAvailable && _pollInterval != TimeSpan.Zero);
        }