/// <summary>
        /// 検索処理の実行
        /// </summary>
        /// <returns></returns>
        private async Task ExecuteSearch()
        {
            try
            {
                EnableProcessingMode();

                // DBが古い場合はアップグレードする
                if (DatabaseMigration.GetCurrentVersion() < DatabaseContext.Version)
                {
                    DatabaseMigration.UpgradeDatabase();
                }

                var parameter = new ActivityLogSearchParameter
                {
                    IsJoinedRoom                    = joinCheckBox.IsChecked ?? false,
                    IsMetPlayer                     = meetCheckBox.IsChecked ?? false,
                    IsSendInvite                    = sendInvCheckBox.IsChecked ?? false,
                    IsSendRequestInvite             = sendReqInvCheckBox.IsChecked ?? false,
                    IsReceivedInvite                = recvInvCheckBox.IsChecked ?? false,
                    IsReceivedRequestInvite         = recvReqInvCheckBox.IsChecked ?? false,
                    IsSendFriendRequest             = sendFriendReqCheckBox.IsChecked ?? false,
                    IsReceivedFriendRequest         = recvFriendReqCheckBox.IsChecked ?? false,
                    IsAcceptFriendRequest           = acptFriendReqCheckBox.IsChecked ?? false,
                    FromDateTime                    = fromDatePicker.SelectedDate,
                    UntilDateTime                   = untilDatePicker.SelectedDate?.AddDays(1),
                    IsReceivedInviteResponse        = recvInvResCheckBox.IsChecked ?? false,
                    IsReceivedRequestInviteResponse = recvReqInvResCheckBox.IsChecked ?? false,
                    IsPlayedVideo                   = videoCheckBox.IsChecked ?? false,
                };
                var activityLogs = await VRChatActivityLogModel.SearchActivityLogs(parameter);

                var keywords = keywordBox.Text.Split(' ').Where(s => s != string.Empty).ToArray();

                ActivityLogGridModelCollection.Clear();

                foreach (var activityLog in activityLogs)
                {
                    var gridModel = new ActivityLogGridModel(activityLog);

                    if (keywords.Any())
                    {
                        var contained = keywords.All(k => gridModel.Content?.Contains(k, StringComparison.CurrentCultureIgnoreCase) ?? false);
                        if (!contained)
                        {
                            continue;
                        }
                    }

                    ActivityLogGridModelCollection.Add(gridModel);
                }

                DisableProcessingMode();
            }
            catch (Exception)
            {
                MessageBox.Show("エラーが発生しました。プログラムを終了します。", "VRChatActivityLogViewer", MessageBoxButton.OK, MessageBoxImage.Error);
                Application.Current.Shutdown();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Searchボタンクリック時のイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void searchButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                EnableProcessingMode();

                var parameter = new ActivityLogSearchParameter
                {
                    IsJoinedRoom            = joinCheckBox.IsChecked ?? false,
                    IsMetPlayer             = meetCheckBox.IsChecked ?? false,
                    IsSendInvite            = sendInvCheckBox.IsChecked ?? false,
                    IsSendRequestInvite     = sendReqInvCheckBox.IsChecked ?? false,
                    IsReceivedInvite        = recvInvCheckBox.IsChecked ?? false,
                    IsReceivedRequestInvite = recvReqInvCheckBox.IsChecked ?? false,
                    IsSendFriendRequest     = sendFriendReqCheckBox.IsChecked ?? false,
                    IsReceivedFriendRequest = recvFriendReqCheckBox.IsChecked ?? false,
                    IsAcceptFriendRequest   = acptFriendReqCheckBox.IsChecked ?? false,
                    FromDateTime            = fromDatePicker.SelectedDate,
                    UntilDateTime           = untilDatePicker.SelectedDate?.AddDays(1),
                };
                var activityLogs = await VRChatActivityLogModel.SearchActivityLogs(parameter);

                ActivityLogGridModelCollection.Clear();
                foreach (var activityLog in activityLogs)
                {
                    ActivityLogGridModelCollection.Add(new ActivityLogGridModel(activityLog));
                }

                DisableProcessingMode();
            }
            catch (Exception)
            {
                MessageBox.Show("エラーが発生しました。プログラムを終了します。", "VRChatActivityLogViewer");
                Application.Current.Shutdown();
            }
        }