//This method continues multiple hour reservation. private void PanelMouseMove(Object sender, MouseEventArgs args) { int row = Grid.GetRow((UIElement)sender); int column = Grid.GetColumn((UIElement)sender); if (sender != null && args.LeftButton == MouseButtonState.Pressed && row != mRow2) { //We need to check if the room is available at the selected time if (mDatabase.IsFree(ref row, mColumn)) { mRow2 = row; DockPanel panel = sender as DockPanel; Panell shift = new Panell(); shift.panel = panel; shift.color = panel.Background; mRows.Add(shift); panel.Background = Brushes.Yellow; } else { mAvailable = false; } } }
//This method starts handling room reservation made by a mouse private void PanelMouseDown(Object sender, MouseButtonEventArgs args) { if (sender != null) { //We need to check if the room is available at the selected time mRow1 = mRow2 = Grid.GetRow((UIElement)sender); mColumn = Grid.GetColumn((UIElement)sender); if (mDatabase.IsFree(ref mRow1, mColumn)) { //Room is available. mAvailable = true; DockPanel panel = sender as DockPanel; Panell shift = new Panell(); shift.panel = panel; shift.color = panel.Background; mRows.Add(shift); panel.Background = Brushes.Yellow; } else { mAvailable = false; } } }
/// <summary> /// Inicialitza una nova instancia de <see cref="Cela"/> /// </summary> /// <param name="panell">Referencia al panell al que pertany</param> /// <param name="row">Fila (Index basat en 0)</param> /// <param name="column">Columne (Index basat en 0)</param> public Cela(Panell panell, int row, int column) { Panell = panell; Row = row; Column = column; }