public void EvaluationConfidenceLevelMapTest()
        {
            var patterns = new KeyValuePair <double, int>[]
            {
                new KeyValuePair <double, int>(0.0, 0),
                new KeyValuePair <double, int>(0.97015, 1),
                new KeyValuePair <double, int>(0.96774, 2),
                new KeyValuePair <double, int>(0.97024, 3),
                new KeyValuePair <double, int>(0.98052, 4),
            };

            foreach (var pattern in patterns)
            {
                var e = new Client.App.Userquake.UserquakeEvaluateEventArgs()
                {
                    StartedAt       = DateTime.MinValue,
                    UpdatedAt       = DateTime.MinValue,
                    Count           = 0,
                    Confidence      = pattern.Key,
                    AreaConfidences = null,
                };

                Assert.AreEqual(pattern.Value, e.ConfidenceLevel);
            }
        }
Exemple #2
0
        private void MediatorContext_OnNewUserquakeEvaluation(object sender, Client.App.Userquake.UserquakeEvaluateEventArgs e)
        {
            var userquakeNotification = configuration.UserquakeNotification;

            if (!userquakeNotification.Enabled)
            {
                return;
            }
            if (!userquakeNotification.Sound)
            {
                return;
            }

            PlaySound(SoundType.P2PQ_Snd9);
        }
Exemple #3
0
        private void MediatorContext_OnNewUserquakeEvaluation(object sender, Client.App.Userquake.UserquakeEvaluateEventArgs e)
        {
            var userquakeNotification = configuration.UserquakeNotification;

            if (!userquakeNotification.Enabled)
            {
                return;
            }

            if (!userquakeNotification.Show)
            {
                Select("userquake", null, e.StartedAt.ToString());
                return;
            }
            Activate("userquake", null, e.StartedAt.ToString());
        }
Exemple #4
0
        public void MediatorContext_OnNewUserquakeEvaluation(object sender, Client.App.Userquake.UserquakeEvaluateEventArgs e)
        {
            var userquakeNotification = configuration.UserquakeNotification;

            if (!userquakeNotification.Enabled)
            {
                return;
            }
            if (!userquakeNotification.Notice)
            {
                return;
            }

            var areas = e.AreaConfidences.Where(e => e.Value.Confidence >= 0 && userquakeArea.ContainsKey(e.Key)).OrderByDescending(e => e.Value.Confidence).Take(3).Select(e => userquakeArea[e.Key]);

            new ToastContentBuilder()
            .AddText("「揺れた!」報告(地震感知情報)")
            .AddText($"主な地域: {string.Join('、', areas)}")
            .AddArgument("type", "userquake").AddArgument("startedAt", e.StartedAt.ToString())
            .Show();
        }