private void AddNewShutickyWindow(ShutickySetting shutickySetting) { if (shutickySetting == null) { return; } //他の付箋と左上角の座標が重ならないように新規座標を計算 //ただし、画面外に行ってしまわないように、 var newPos = GetNewPositionTuple(shutickySetting.Position_X, shutickySetting.Position_Y); shutickySetting.Position_X = newPos.x; shutickySetting.Position_Y = newPos.y; var newShutickyWindow = new ShutickyWindow(shutickySetting); //イベントハンドラをセット AddEventHandlersToShutickyWindow(newShutickyWindow); //付箋ウィンドウのリストに登録 _shutickyWindows.Add(newShutickyWindow); //セッティングファイルを書き込み WriteShutickySettingListXML(_shutickySettingFilePath); //RTFを作成。 newShutickyWindow.SaveRTF(); }
private void AddEventHandlersToShutickyWindow(ShutickyWindow shutickyWindow) { if (shutickyWindow == null) { return; } shutickyWindow.Closed += ShutickyWindowClosed; shutickyWindow.Deactivated += ShutickyWindowDeactivated; shutickyWindow.DeleteButtonClicked += ShutickyWindowDeleteButtonClicked; shutickyWindow.TitleLostFocus += ShutickyWindowTitleLostFocus; shutickyWindow.SaveButtonClicked += ShutickyWindowSaveButtonClicked; shutickyWindow.CloseButtonClicked += ShutickyWindowCloseButtonClicked; shutickyWindow.NewShutickyButtonClicked += ShutickyWindowNewButtonClicked; shutickyWindow.MinimizeButtonClicked += ShutickyWindowMinimizeButtonClicked; }
private void AddExistShutickyWindow(ShutickySetting shutickySetting) { if (shutickySetting == null) { return; } //付箋が画面外にある場合は現在のウィンドウ内に収まるように調整 var newPos = AdjustWindowPositionTuple(shutickySetting.Position_X, shutickySetting.Position_Y); shutickySetting.Position_X = newPos.x; shutickySetting.Position_Y = newPos.y; //付箋ウィンドウをインスタンス化 var shutickyWindow = new ShutickyWindow(shutickySetting); //イベントハンドラを登録 AddEventHandlersToShutickyWindow(shutickyWindow); //付箋ウィンドウのリストに登録 _shutickyWindows.Add(shutickyWindow); //セッティングファイルを書き込み WriteShutickySettingListXML(_shutickySettingFilePath); }