public NotificationsPageViewModel(INavigationService navigationService, IWebApiRestClient webApiRestClient) { _navigationService = navigationService; _webApiRestClient = webApiRestClient; toastMessage = DependencyService.Get <ToastMessage>(); notificationDBService = DependencyService.Get <INotificationDBService>(); AddNotify = new Command(add_click); var IsNotificationDBExist = notificationDBService.IsNotificationDbPresentInDB(); if (IsNotificationDBExist) { IEnumerable <NotificationModel> notifications = notificationDBService.ReadAllItems(); foreach (var item in notifications) { NotificationList.Add(item); } } MessagingCenter.Subscribe <string>(this, "Notification Recieved", (sender) => { var data = sender; var newjob = new NotificationModel() { Text = data, Icon = "logo.png", Time = "Now" }; NotificationList.Add(newjob); notificationDBService.CreateNotificationModeInDB(newjob); toastMessage.Show("You have recieved a new notification."); }); }
private async void MarkAttendance_Clicked(object sender, EventArgs e) { try { if (!IsMarkedToday(attendanceList) || !IsWeekEnd()) { var attendance = new Attendance(); attendance.Id = string.Empty; attendance.Date = DateTime.Now.ToShortDateString(); attendance.IsPresent = true; attendance.Username = currentUser; await firebase.Child("Attendance").PostAsync <Attendance>(attendance); ToastMessage.Show("Attendance marked successfully..."); MarkAttendance.IsEnabled = false; animationView.IsVisible = true; } else { MarkAttendance.IsEnabled = false; } } catch (Exception ex) { //await DisplayAlert("error", ex.StackTrace, "ok"); //await DisplayAlert("message", ex.Message, "ok"); ToastMessage.Show(ex.Message); } }
protected async override void OnAppearing() { try { TodayDate = DateTime.Now.ToShortDateString(); animationView.IsVisible = false; firebase = new FirebaseClient(App.FirebaseUrl); currentUser = Application.Current.Properties["currentUser"].ToString(); attendanceList = await firebase.Child("Attendance").OnceAsync <Attendance>(); if (IsWeekEnd()) { ToastMessage.Show("cannot mark attendance on weekends"); MarkAttendance.IsEnabled = false; } if (IsMarkedToday(attendanceList)) { ToastMessage.Show("cannot mark attendance twice a day"); MarkAttendance.IsEnabled = false; } base.OnAppearing(); } catch (Exception ex) { //await DisplayAlert("error", ex.StackTrace, "ok"); //await DisplayAlert("message", ex.Message, "ok"); ToastMessage.Show(ex.Message); } }
protected async override void OnAppearing() { try { Attendance = new ObservableCollection <Attendance>(); firebase = new FirebaseClient(App.FirebaseUrl); var hasCurrentUser = Application.Current.Properties.ContainsKey("currentUser"); if (hasCurrentUser) { currentUser = Application.Current.Properties["currentUser"].ToString(); attendanceFromFirebase = await firebase.Child("Attendance").OnceAsync <Attendance>(); } if (attendanceFromFirebase.Count <= 0) { isResultFound = false; } else { isResultFound = true; } AttendanceList.ItemsSource = GetAttendanceList(); base.OnAppearing(); } catch (Exception ex) { ToastMessage.Show(ex.Message); //await DisplayAlert("error", ex.StackTrace, "ok"); //await DisplayAlert("message", ex.Message, "ok"); } }
//------------------------------------------------------------- // 概要:レス書き込み //------------------------------------------------------------- private void WriteRes() { if (!writeResWorker.IsBusy) { ToastMessage.Show("書き込み中..."); writeResWorker.RunWorkerAsync(); // 書き込み欄を無効 writeFieldTextBox.Enabled = false; } }
private void NameTextBox_TextEdited(string oldText, string newText, ref bool cancelEdit) { newText = FilterName(newText); if (Data != null) { if (!Data.SetName(newText)) { ToastMessage.Show("이미 존재하거나 올바르지 않은 이름입니다."); cancelEdit = true; } } }
protected async override void OnAppearing() { try { usersList = await firebase.Child("Users").OnceAsync <User>(); base.OnAppearing(); } catch (Exception e) { ToastMessage.Show(e.Message); //await DisplayAlert("message", e.Message, "ok"); //await DisplayAlert("error", e.StackTrace, "ok"); } }
IEnumerator DownloadDataFromServer(string userName, int year, int month, Action <string> completed) { string body = $"STR={userName}&MM2={month}&YY2={year}&item2=教師"; var uploadHandler = new UploadHandlerRaw(big5.GetBytes(body)); var downloadHandler = new DownloadHandlerBuffer(); using (var request = new UnityWebRequest(host + "query_tea.asp", UnityWebRequest.kHttpVerbPOST, downloadHandler, uploadHandler)) { request.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded"); yield return(request.SendWebRequest()); if (request.error != null) { ToastMessage.Show(request.error); yield break; } completed?.Invoke(big5.GetString(request.downloadHandler.data)); } }
public void Save() { if (dataInfo == null) { SaveAs(); } else { try { //Success JObject jRoot = new JObject(); jRoot.Add("Version", "1"); jRoot.Add("GUID", Bgoon.Security.Encrypt.GererateHash(8)); JArray jPoints = new JArray(); jRoot.Add("Points", jPoints); for (int pointI = 0; pointI < pointList.Count; ++pointI) { GPoint point = pointList[pointI]; JObject jPoint = new JObject(); jPoint.Add("p0", point.points[0].Value.ToString()); jPoint.Add("p1", point.points[1].Value.ToString()); jPoint.Add("p2", point.points[2].Value.ToString()); jPoints.Add(jPoint); } string jsonString = jRoot.ToString(); dataInfo.Directory.Create(); jsonString.SaveText(dataInfo.FullName); FileInfo binaryInfo = new FileInfo(Path.Combine(dataInfo.Directory.FullName, Path.GetFileNameWithoutExtension(dataInfo.FullName) + "." + IOInfo.BinaryExtension)); jsonString.SaveText(binaryInfo.FullName); ToastMessage.Show("저장되었습니다."); SetSavedFlag(); } catch (Exception ex) { MessageBox.Show("저장하는 도중 오류가 발생했습니다." + Environment.NewLine + ex.ToString()); } } }
private async void btnCreateUser_Clicked(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(username_.Text) || string.IsNullOrEmpty(password_.Text) || string.IsNullOrEmpty(email_.Text)) { ToastMessage.Show("All fields are required..."); } else if (!string.Equals(password_.Text, confirmPassword_.Text)) { ToastMessage.Show("Password mismatch"); } else { var usernameAvailable = IsUsernameAvailable(username_.Text); if (usernameAvailable) { var newUser = new User(); newUser.Id = string.Empty; newUser.Username = username_.Text; newUser.Password = password_.Text; newUser.Email = email_.Text; await firebase.Child("Users").PostAsync <User>(newUser); ToastMessage.Show("new user created..."); await Navigation.PushModalAsync(new LoginPage()); } else { ToastMessage.Show("Username is taken,try again.."); } } } catch (Exception ex) { ToastMessage.Show(ex.Message); //await DisplayAlert("error", ex.StackTrace, "ok"); //await DisplayAlert("message", ex.Message, "ok"); } }
public bool IsUsernameAvailable(string username) { try { var userCount = usersList.Where(a => a.Object.Username == username).Count(); if (userCount > 0) { return(false); } else { return(true); } } catch (Exception e) { ToastMessage.Show(e.Message); //DisplayAlert("error", e.StackTrace, "ok"); //DisplayAlert("message", e.Message, "ok"); return(false); } }
public bool isAuthenticated(string username, string password) { try { var isAuth = usersList.Where(a => a.Object.Username == username && a.Object.Password == password).Count(); if (isAuth > 0) { return(true); } else { return(false); } } catch (Exception e) { ToastMessage.Show(e.Message); //DisplayAlert("message", e.Message, "ok"); //DisplayAlert("error", e.StackTrace, "ok"); return(false); } }
private async Task btnSignIn_Clicked(object sender, EventArgs e) { if (isTapped) { isRemembered = true; //Application.Current.Properties["username"] = username_.Text; Application.Current.Properties["currentUser"] = username_.Text; Application.Current.Properties["rememberMe"] = isRemembered; await Application.Current.SavePropertiesAsync(); } else { isRemembered = false; Application.Current.Properties["rememberMe"] = isRemembered; Application.Current.Properties["currentUser"] = username_.Text; await Application.Current.SavePropertiesAsync(); } if (!string.IsNullOrEmpty(username_.Text) && !string.IsNullOrEmpty(password_.Text)) { animationView.IsVisible = true; var auth = isAuthenticated(username_.Text, password_.Text); if (auth) { animationView.IsVisible = false; ToastMessage.Show("Login successful.."); await Navigation.PushModalAsync(new MainPage()); } else { animationView.IsVisible = false; ToastMessage.Show("Invalid username or password..."); } } }
private void MotionListView_MessageOccured(string message) { ToastMessage.Show(message); }
//------------------------------------------------------------- // イベントの初期化 //------------------------------------------------------------- private void InitEvent() { // スレッドビューワを開く openViewerToolStripButton.Click += (sender, e) => shortcut.ExecCommand(Commands.OpenPeerstViewer); // 最小化ボタン minToolStripButton.Click += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.MinButtonClick); // 最大化ボタン maxToolStripButton.Click += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.MaxButtonClick); // 閉じるボタン closeToolStripButton.Click += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.CloseButtonClick); // 音量クリック statusBar.VolumeClick += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.Mute); // ダブルクリック pecaPlayer.DoubleClickEvent += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.DoubleClick); // マウスホイール MouseWheel += (sender, e) => { if ((Control.MouseButtons & MouseButtons.Right) == MouseButtons.Right) { // 右クリックマウスホイール if (e.Delta > 0) { shortcut.RaiseEvent(ShortcutEvents.RightClickWheelUp); } else if (e.Delta < 0) { shortcut.RaiseEvent(ShortcutEvents.RightClickWheelDown); } } else { // マウスホイール if (e.Delta > 0) { shortcut.RaiseEvent(ShortcutEvents.WheelUp); } else if (e.Delta < 0) { shortcut.RaiseEvent(ShortcutEvents.WheelDown); } } }; // チャンネル情報更新 bool isFirst = true; pecaPlayer.ChannelInfoChange += (sender, e) => { ChannelInfo info = pecaPlayer.ChannelInfo; // TODO 文字が空の場合は、スペースを空けない UpdateChannelDetail(info); // タイトル設定 string chName = getChannelName(info); Win32API.SetWindowText(Handle, String.Format("{0} - PeerstPlayer", chName)); // 初回のみの設定 if (isFirst) { // コンタクトURL設定 // TODO コンタクトURLが変更されたら、通知後にURL変更 // コンタクトURLが空の場合、引数からコンタクトURLを取得する if (string.IsNullOrEmpty(info.Url)) { var commandLine = Environment.GetCommandLineArgs(); if (Environment.GetCommandLineArgs().Length > 4) { var url = commandLine[4]; statusBar.SelectThreadUrl = url; } else { // コンタクトURLが空の場合 statusBar.SelectThreadUrl = String.Empty; } } else { statusBar.SelectThreadUrl = info.Url; } isFirst = false; } }; // ステータスバーのサイズ変更 statusBar.HeightChanged += (sender, e) => { // 最大化時はサイズ変更しない if (WindowState == FormWindowState.Maximized) { return; } // Formサイズ変更 if (FrameInvisible) { Size = new Size(pecaPlayer.Width, pecaPlayer.Height + statusBar.Height); } else { ClientSize = new Size(ClientSize.Width, (pecaPlayer.Height + statusBar.Height)); } }; // ステータスバーのクリックイベント statusBar.ChannelDetailClick += (sender, e) => { if (e.Button == MouseButtons.Left) { shortcut.RaiseEvent(ShortcutEvents.StatusbarLeftClick); } else if (e.Button == MouseButtons.Right) { shortcut.RaiseEvent(ShortcutEvents.StatusbarRightClick); } }; // サイズ変更 SizeChanged += (sender, e) => { if ((ClientSize.Width) == 0 || (ClientSize.Height == 0)) { return; } // 幅 pecaPlayer.Width = ClientSize.Width; statusBar.Width = ClientSize.Width; // 高さ pecaPlayer.Height = ClientSize.Height - statusBar.Height; statusBar.Top = pecaPlayer.Bottom; }; // 動画サイズ変更 pecaPlayer.MovieSizeChange += (sender, e) => { // Formサイズ変更 if (FrameInvisible) { Size = new Size(pecaPlayer.Width, pecaPlayer.Height + statusBar.Height); } else { ClientSize = new Size(pecaPlayer.Width, pecaPlayer.Height + statusBar.Height); } // 幅 statusBar.Width = pecaPlayer.Width; // 高さ statusBar.Top = pecaPlayer.Bottom; }; // 音量変更イベント pecaPlayer.VolumeChange += (sender, e) => statusBar.Volume = (pecaPlayer.Mute ? "-" : pecaPlayer.Volume.ToString()); // スレッドタイトル右クリックイベント statusBar.ThreadTitleRightClick += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.ThreadTitleRightClick); // マウスジェスチャー MouseGesture mouseGesture = new MouseGesture(); mouseGesture.Interval = PlayerSettings.MouseGestureInterval; bool isGesturing = false; // タイマーイベント Timer timer = new Timer(); timer.Interval = MovieStatusUpdateInterval; timer.Tick += (sender, e) => { // 自動表示ボタンの表示切り替え if (toolStrip.Visible && !IsVisibleToolStrip(PointToClient(MousePosition))) { toolStrip.Visible = false; } // 画面外に出たらマウスジェスチャー解除 if (!RectangleToScreen(ClientRectangle).Contains(MousePosition)) { isGesturing = false; } // 動画ステータスを表示 if (pecaPlayer.Duration.Length == 0) { switch (pecaPlayer.PlayState) { case WMPPlayState.wmppsUndefined: statusBar.MovieStatus = ""; break; case WMPPlayState.wmppsStopped: statusBar.MovieStatus = "停止"; break; case WMPPlayState.wmppsPaused: statusBar.MovieStatus = "一時停止"; break; case WMPPlayState.wmppsPlaying: statusBar.MovieStatus = "再生中"; break; case WMPPlayState.wmppsScanForward: statusBar.MovieStatus = "早送り"; break; case WMPPlayState.wmppsScanReverse: statusBar.MovieStatus = "巻き戻し"; break; case WMPPlayState.wmppsWaiting: statusBar.MovieStatus = "接続待機"; break; case WMPPlayState.wmppsMediaEnded: statusBar.MovieStatus = "再生完了"; break; case WMPPlayState.wmppsTransitioning: statusBar.MovieStatus = "準備中"; break; case WMPPlayState.wmppsReady: statusBar.MovieStatus = "準備完了"; break; case WMPPlayState.wmppsReconnecting: statusBar.MovieStatus = "再接続"; break; case WMPPlayState.wmppsBuffering: statusBar.MovieStatus = string.Format("バッファ{0}%", pecaPlayer.BufferingProgress); break; } } // 再生時間を表示 else { statusBar.MovieStatus = pecaPlayer.Duration; } // 動画情報を更新 ChannelInfo info = pecaPlayer.ChannelInfo ?? new ChannelInfo(); statusBar.UpdateMovieInfo( new MovieInfo() { NowFps = pecaPlayer.NowFrameRate, Fps = pecaPlayer.FrameRate, NowBitrate = pecaPlayer.NowBitrate, Bitrate = pecaPlayer.Bitrate, ListenerNumber = info.Listeners, RelayNumber = info.Relays, Status = info.Status, StreamType = info.Type, }); }; timer.Start(); // マウスダウンイベント pecaPlayer.MouseDownEvent += (sender, e) => { if (e.nButton == (short)Keys.LButton) { // マウスドラッグ FormUtility.WindowDragStart(this.Handle); } else if (e.nButton == (short)Keys.RButton) { // マウスジェスチャー開始 mouseGesture.Start(); isGesturing = true; } else if (e.nButton == (short)Keys.MButton) { // 中クリック shortcut.RaiseEvent(ShortcutEvents.MiddleClick); } }; // マウスアップイベント pecaPlayer.MouseUpEvent += (sender, e) => { if (e.nButton == (short)Keys.RButton) { // チャンネル詳細を再描画 ChannelInfo info = pecaPlayer.ChannelInfo; if (info != null) { UpdateChannelDetail(info); } // マウスジェスチャーが実行されていなければ string gesture = mouseGesture.ToString(); if (string.IsNullOrEmpty(gesture)) { // コンテキストメニュー表示 contextMenuStrip.Show(MousePosition); } else if (isGesturing) { // マウスジェスチャー実行 shortcut.ExecGesture(gesture); } isGesturing = false; } }; // マウス移動イベント pecaPlayer.MouseMoveEvent += (sender, e) => { // 自動表示ボタンの表示切り替え if (toolStrip.Visible != IsVisibleToolStrip(new Point(e.fX, e.fY))) { toolStrip.Visible = !toolStrip.Visible; } if (isGesturing) { // ジェスチャー表示 mouseGesture.Moving(new Point(e.fX, e.fY)); string gesture = mouseGesture.ToString(); string detail = shortcut.GetGestureDetail(gesture); if (!String.IsNullOrEmpty(gesture)) { string message = string.Format("ジェスチャ: {0} {1}", gesture, (String.IsNullOrEmpty(detail) ? "" : "(" + detail + ")")); ToastMessage.Show(message); } } }; // キー押下イベント pecaPlayer.KeyDownEvent += (sender, e) => shortcut.RaiseKeyEvent(e); // ステータスバー マウスホバーイベント statusBar.MouseHoverEvent += (sender, e) => shortcut.RaiseEvent(ShortcutEvents.StatusbarHover); // 終了処理 FormClosed += (sender, e) => { Logger.Instance.Debug("FormClosed"); pecaPlayer.Close(); statusBar.Close(); }; // グローウィンドウの弊害で消えなくなっていたので自分で消えるようにする Deactivate += (sender, e) => { contextMenuStrip.Hide(); }; // 動画再生イベント pecaPlayer.MovieStart += (sender, e) => { pecaPlayer.UpdateChannelInfo(); shortcut.ExecCommand(PlayerSettings.MovieStartCommand); }; // コマンド実行内容の表示 shortcut.CommandExecuted += (sender, e) => { CommnadExecutedEventArgs args = (CommnadExecutedEventArgs)e; // ステータスバー表示切り替えはメッセージを出さない if (args.Command != Commands.VisibleStatusBar) { ToastMessage.Show(string.Format("コマンド: {0}", args.Detail)); } }; //----------------------------------------------------- // コンテキストメニュー //----------------------------------------------------- // 拡大率 scale25PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale25Per); scale50PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale50Per); scale75PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale75Per); scale100PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale100Per); scale150PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale150Per); scale200PerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowScale200Per); // サイズ変更 size160x120ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowSize160x120); size320x240ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowSize320x240); size480x360ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowSize480x360); size640x480ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowSize640x480); size800x600ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WindowSize800x600); fitMovieSizeToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.FitMovieSize); // 画面分割 screenSplitWidthx5ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitWidthx5); screenSplitWidthx4ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitWidthx4); screenSplitWidthx3ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitWidthx3); screenSplitWidthx2ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitWidthx2); screenSplitHeightx5ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitHeightx5); screenSplitHeightx4ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitHeightx4); screenSplitHeightx3ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitHeightx3); screenSplitHeightx2ToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.ScreenSplitHeightx2); // 機能 topMostToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.TopMost); updateChannelInfoToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.UpdateChannelInfo); bumpToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.Bump); functionToolStripMenuItem.DropDownOpening += (sender, e) => topMostToolStripMenuItem.Checked = TopMost; screenshotToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.Screenshot); openScreenshotFolderToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.OpenScreenshotFolder); retryPlayerToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.RetryPlayer); // ファイルから開く openFromFileToolStripMenuItem.Click += (sender, e) => { var dialog = new OpenFileDialog(); if (dialog.ShowDialog() == DialogResult.OK) { // TODO スレッド選択を解除 // TODO ステータスバーを変更 Open(dialog.FileName); } }; // URLから開く openFromUrlToolStripTextBox.KeyDown += (sender, e) => { if (e.KeyCode == Keys.Return) { // TODO FLV or WMVの判定をして、PecaPlayerコントロールを再初期化する // TODO スレッド選択を解除 + 新しいスレッドへ移動 // TODO ステータスバーを変更 Open(((ToolStripTextBox)sender).Text); contextMenuStrip.Close(); } }; // クリップボードから開く openFromClipboardToolStripMenuItem.Click += (sender, e) => { try { if (Clipboard.ContainsText()) { // TODO FLV or WMVの判定をして、PecaPlayerコントロールを再初期化する // TODO スレッド選択を解除 + 新しいスレッドへ移動 // TODO ステータスバーを変更 Open(Clipboard.GetText()); } } catch (System.Runtime.InteropServices.ExternalException) { MessageBox.Show("クリップボードのオープンに失敗しました"); } }; // 音量 volumeUpToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.VolumeUp); volumeDownToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.VolumeDown); muteToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.Mute); volumeBalanceLeftToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.VolumeBalanceLeft); volumeBalanceMiddleToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.VolumeBalanceMiddle); volumeBalanceRightToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.VolumeBalanceRight); volumeToolStripMenuItem.DropDownOpening += (sender, e) => muteToolStripMenuItem.Checked = pecaPlayer.Mute; volumeToolStripMenuItem.DropDownOpening += (sender, e) => volumeBalanceLeftToolStripMenuItem.Checked = (pecaPlayer.VolumeBalance == VolumeBalanceCommandArgs.BalanceLeft); volumeToolStripMenuItem.DropDownOpening += (sender, e) => volumeBalanceMiddleToolStripMenuItem.Checked = (pecaPlayer.VolumeBalance == VolumeBalanceCommandArgs.BalanceMiddle); volumeToolStripMenuItem.DropDownOpening += (sender, e) => volumeBalanceRightToolStripMenuItem.Checked = (pecaPlayer.VolumeBalance == VolumeBalanceCommandArgs.BalanceRight); // 設定メニュー押下 settingToolStripMenuItem.Click += (sender, e) => { PlayerSettingView view = new PlayerSettingView(shortcut); view.TopMost = TopMost; view.ShowDialog(); }; // WMPメニュー押下 wmpMenuToolStripMenuItem.Click += (sender, e) => shortcut.ExecCommand(Commands.WmpMenu); // 動画情報表示押下 showDebugToolStripMenuItem.Click += (sender, e) => pecaPlayer.ShowDebug(); }
//------------------------------------------------------------- // 概要:コンストラクタ // 詳細:イベントの設定 //------------------------------------------------------------- public WriteFieldControl() { InitializeComponent(); // 選択スレッドのクリックイベント selectThreadLabel.MouseDown += (sender, e) => { if (e.Button == MouseButtons.Left) { // 選択スレッド画面を開く threadSelectView.TopMost = ParentForm.TopMost; threadSelectView.Open(); } else if (e.Button == MouseButtons.Right) { RightClick(sender, e); } }; // 新着レス表示処理 string newRes = ""; showNewResWorker.WorkerSupportsCancellation = true; // キャンセル処理を許可 showNewResWorker.DoWork += (sender, e) => { newRes = ReadNewRes(); }; showNewResWorker.RunWorkerCompleted += (sender, e) => { newResToolTip.SetToolTip(selectThreadLabel, newRes); }; // マウスオーバー時に新着レス表示 selectThreadLabel.MouseHover += (sender, e) => { // 新着レス表示の実行 if (!showNewResWorker.IsBusy) { showNewResWorker.RunWorkerAsync(); } }; // レス書き込み処理 writeResWorker.WorkerSupportsCancellation = true; writeResWorker.DoWork += (sender, e) => { string message = writeFieldTextBox.Text; WriteResResult result = new WriteResResult(); result.WriteResult = true; result.Message = message; // レス書き込み try { Logger.Instance.InfoFormat("レス書き込み [掲示板:{0} スレッド:{1}, 本文:{2}]", operationBbs.BbsInfo.BbsName, operationBbs.SelectThread.ThreadTitle, message); operationBbs.Write("", "sage", message); Logger.Instance.InfoFormat("レス書き込み:成功 [掲示板:{0} スレッド:{1}, 本文:{2}]", operationBbs.BbsInfo.BbsName, operationBbs.SelectThread.ThreadTitle, message); } catch (Exception ex) { result.WriteResult = false; result.Exception = ex; Logger.Instance.ErrorFormat("レス書き込み:失敗 [エラー内容{0} 掲示板:{1} スレッド:{2}, 本文:{3}]", ex.Message, operationBbs.BbsInfo.BbsName, operationBbs.SelectThread.ThreadTitle, message); } finally { e.Result = result; } }; // 書き込み完了処理 writeResWorker.RunWorkerCompleted += (sender, e) => { WriteResResult result = (WriteResResult)e.Result; // 書き込み欄を有効 writeFieldTextBox.Enabled = true; writeFieldTextBox.WatermarkText = "書き込み内容を入力してください"; // 書き込み成功 if (result.WriteResult) { ToastMessage.Show("レス書き込みが完了しました。"); writeFieldTextBox.Text = ""; } // 書き込み失敗 else { ToastMessage.Show(string.Format("レス書き込みに失敗しました。[{0}]", result.Exception.Message)); writeFieldTextBox.Text = result.Message; Logger.Instance.ErrorFormat("{0}\n\n掲示板:{1}\nスレッド:{2}\n本文:{3}", result.Exception.Message, operationBbs.BbsInfo.BbsName, operationBbs.SelectThread.ThreadTitle, result.Message); } // 書き込み欄をフォーカス writeFieldTextBox.Focus(); }; // 書き込みボタン押下 writeButton.Click += (sender, e) => { // レス書き込み WriteRes(); }; // スレッド変更イベント threadSelectView.ThreadChange += (sender, e) => { // スレッド情報の更新 ThreadSelectEventArgs args = (ThreadSelectEventArgs)e; operationBbs = args.OperationBbs; UpdateThreadTitle(); }; // スレッドタイトルの更新 operationBbs.ThreadListChange += (sender, e) => UpdateThreadTitle(); // 高さ自動調節 writeFieldTextBox_TextChanged(this, new EventArgs()); // 選択スレッドのレス数の更新 Timer timer = new Timer(); timer.Interval = UpdateThreadResCount; timer.Tick += (sender, e) => { operationBbs.UpdateThreadList(); UpdateThreadTitle(); }; timer.Start(); // サイズ変更時に高さの自動調節 SizeChanged += (sender, e) => { if (Visible) { Height = selectThreadLabel.Height + writeFieldTextBox.PreferredSize.Height; } else { Height = 0; } }; }
public ObservableCollection <Attendance> GetAttendanceList(string searchDate = "") { try { if (!string.IsNullOrEmpty(searchDate) && !string.IsNullOrWhiteSpace(searchDate)) { var modifiedList = new List <Attendance_>(); var attendance_ = new Attendance_(); var currentUserAndSearchAttendance = attendanceFromFirebase.Where(a => a.Object.Date == searchDate && a.Object.Username == currentUser).ToList(); if (currentUserAndSearchAttendance.Count <= 0) { NoResultFoundLabel.IsVisible = true; } else { NoResultFoundLabel.IsVisible = false; } foreach (var item in currentUserAndSearchAttendance) { attendance_.Date = DateTime.Parse(item.Object.Date); attendance_.Username = item.Object.Username; attendance_.IsPresent = item.Object.IsPresent; modifiedList.Add(attendance_); } var date = DateTime.Parse(searchDate); var filteredSearch = modifiedList.Where(a => a.Date >= date).ToList(); Attendance = new ObservableCollection <Attendance>(); var entry = new Attendance(); foreach (var data in filteredSearch) { entry.Username = currentUser; entry.IsPresent = data.IsPresent; entry.Date = data.Date.ToShortDateString(); Attendance.Add(entry); } return(Attendance); } else { Attendance = new ObservableCollection <Attendance>(); var entry = new Attendance(); var currentUserAttendance = attendanceFromFirebase.Where(a => a.Object.Username == currentUser).ToList(); if (currentUserAttendance.Count <= 0) { NoResultFoundLabel.IsVisible = true; } else { NoResultFoundLabel.IsVisible = false; } foreach (var data in currentUserAttendance) { entry.Username = currentUser; entry.IsPresent = data.Object.IsPresent; entry.Date = data.Object.Date; Attendance.Add(entry); } return(Attendance); } } catch (Exception ex) { ToastMessage.Show(ex.Message); //DisplayAlert("error", ex.StackTrace, "ok"); //DisplayAlert("message", ex.Message, "ok"); return(null); } }