Beispiel #1
0
		private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			int index = ListViewMenu.SelectedIndex;
			MoveCursorMenu(ref index);

			switch (index)
			{
				case 0:
					GridPrincipal.Children.Clear();
					//GridPrincipal.Children.Add(new UseControlReservation());
					stPages.Visibility = Visibility.Collapsed;
					stAddEdit.Visibility = Visibility.Collapsed;
					svReserv.Visibility = Visibility.Collapsed;
					stAddEditRemRes.Visibility = Visibility.Collapsed;
					stSearch.Visibility = Visibility.Collapsed;
					svHistory.Visibility = Visibility.Collapsed;
					svReservUser.Visibility = Visibility.Collapsed;
					svHistoryAdmin.Visibility = Visibility.Collapsed;
					svClentsAdmin.Visibility = Visibility.Collapsed;
					break;
				case 1:
					GridPrincipal.Children.Clear();
					appviemodel.CarAct.RefreshPages();
					GridPrincipal.Children.Add(new UserControl1(appviemodel));
					stPages.Visibility = Visibility.Visible;
					if (appviemodel.IsAdmin)
						stAddEdit.Visibility = Visibility.Visible;
					svReserv.Visibility = Visibility.Collapsed;
					stAddEditRemRes.Visibility = Visibility.Collapsed;
					stSearch.Visibility = Visibility.Visible;
					svHistory.Visibility = Visibility.Collapsed;
					svReservUser.Visibility = Visibility.Collapsed;
					svHistoryAdmin.Visibility = Visibility.Collapsed;
					svClentsAdmin.Visibility = Visibility.Collapsed;
					break;
				case 2:
					GridPrincipal.Children.Clear();
					stPages.Visibility = Visibility.Collapsed;
					stAddEdit.Visibility = Visibility.Collapsed;
					if (appviemodel.IsAdmin)
						svReserv.Visibility = Visibility.Visible;
					else
						svReservUser.Visibility = Visibility.Visible;
					stAddEditRemRes.Visibility = Visibility.Visible;
					stSearch.Visibility = Visibility.Collapsed;
					svHistory.Visibility = Visibility.Collapsed;
					svHistoryAdmin.Visibility = Visibility.Collapsed;
					svClentsAdmin.Visibility = Visibility.Collapsed;
					break;
				case 3:
					GridPrincipal.Children.Clear();
					stPages.Visibility = Visibility.Collapsed;
					stAddEdit.Visibility = Visibility.Collapsed;
					svReserv.Visibility = Visibility.Collapsed;
					stAddEditRemRes.Visibility = Visibility.Collapsed;
					stSearch.Visibility = Visibility.Collapsed;
					svReservUser.Visibility = Visibility.Collapsed;
					svHistoryAdmin.Visibility = Visibility.Collapsed;
					svClentsAdmin.Visibility = Visibility.Collapsed;
					if (appviemodel.IsAdmin)
					{
						NewCustomer nc = new NewCustomer(appviemodel);
						nc.ShowDialog();
					}
					else
					{
						svHistory.Visibility = Visibility.Visible;
					}
					break;
				case 4:
					GridPrincipal.Children.Clear();
					stPages.Visibility = Visibility.Collapsed;
					stAddEdit.Visibility = Visibility.Collapsed;
					svReserv.Visibility = Visibility.Collapsed;
					stAddEditRemRes.Visibility = Visibility.Collapsed;
					stSearch.Visibility = Visibility.Collapsed;
					svReservUser.Visibility = Visibility.Collapsed;
					svClentsAdmin.Visibility = Visibility.Collapsed;
					if (appviemodel.IsAdmin)
					{
						svHistoryAdmin.Visibility = Visibility.Visible;
					}
					break;
				case 5:
					GridPrincipal.Children.Clear();
					stPages.Visibility = Visibility.Collapsed;
					stAddEdit.Visibility = Visibility.Collapsed;
					svReserv.Visibility = Visibility.Collapsed;
					stAddEditRemRes.Visibility = Visibility.Collapsed;
					stSearch.Visibility = Visibility.Collapsed;
					svReservUser.Visibility = Visibility.Collapsed;
					svHistoryAdmin.Visibility = Visibility.Collapsed;
					if (appviemodel.IsAdmin)
					{
						svClentsAdmin.Visibility = Visibility.Visible;
					}
					break;

				default:
					break;
			}
		}
        private void btAddNewCus_Click(object sender, RoutedEventArgs e)
        {
            NewCustomer nc = new NewCustomer(appviemodel);

            nc.Show();
        }