private void ButtonMenuItem_Click(object sender, RoutedEventArgs e) { if (GridMenu.Width == 250) { ButtonCloseMenu.Visibility = Visibility.Collapsed; ButtonOpenMenu.Visibility = Visibility.Visible; ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }
private void ListView_MouseDoubleClick_2(object sender, MouseButtonEventArgs e) { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "salvar": ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "Salvar Arquivo Texto"; saveFileDialog.Filter = "Text File|.txt"; saveFileDialog.FilterIndex = 0; saveFileDialog.DefaultExt = ".txt"; saveFileDialog.RestoreDirectory = true; if (saveFileDialog.ShowDialog() == true) { FileStream stream1 = new FileStream(saveFileDialog.FileName, FileMode.OpenOrCreate); StreamWriter writer = new StreamWriter(stream1); writer.Write(txtArquivo.Text); writer.Close(); stream1.Close(); MessageBox.Show("salvo"); } break; case "abrir": ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == true) { txtArquivo.Text = ""; Stream stream = File.Open(openFileDialog.FileName, FileMode.Open); StreamReader reader = new StreamReader(stream); string linha; while ((linha = reader.ReadLine()) != null) { txtArquivo.AppendText(linha); txtArquivo.AppendText(Environment.NewLine); } reader.Close(); stream.Close(); } break; } }
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { UserControl usc = null; GridPrincipal.Children.Clear(); switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "Principal": fechar.Foreground = Brushes.White; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } imgFundo.Visibility = Visibility.Visible; break; case "cadVeiculo": usc = new UserControlCadVeiculo(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadMultas": usc = new UserControlCadMulta(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadViagem": usc = new UserControlCadViagem(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadPecas": usc = new CadPeca(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadMovimento": usc = new AdicionarPeca(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadManutencao": usc = new CadManutencao(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadSeguro": usc = new CadSeguro(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadMotorista": usc = new Controle_Motorista(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; case "cadAbastecimento": usc = new CadAbastecimento(); fechar.Foreground = Brushes.Black; imgFundo.Visibility = Visibility.Collapsed; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } GridPrincipal.Children.Add(usc); break; } }
private void GridMenu_MouseLeave(object sender, MouseEventArgs e) { ButtonCloseMenu.Visibility = Visibility.Collapsed; ButtonOpenMenu.Visibility = Visibility.Visible; ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent)); }
private void Side_Menu_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (!demoOn) { if (Side_Menu != null && Frame_Change != null) { if (Schedule_Item.IsSelected) { if (GridMenu.Width == 200) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } Frame_Change.Navigate(new Uri("Pages/Schedule.xaml", UriKind.Relative)); Section_Label.Text = "Raspored"; } else if (Appointments.IsSelected) { if (GridMenu.Width == 200) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } if (appointmentController.NotFinishedByDoctorAndDay(MainWindow.doctor, DateTime.Today).ToList().Count == 0) { Frame_Change.Navigate(new Uri("Pages/NemaPregleda.xaml", UriKind.Relative)); } else { Frame_Change.Navigate(new Uri("Pages/Appointments.xaml", UriKind.Relative)); } Section_Label.Text = "Pregledi"; } else if (Patients.IsSelected) { if (GridMenu.Width == 200) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } Frame_Change.Navigate(new Uri("Pages/Patients.xaml", UriKind.Relative)); Section_Label.Text = "Pacijenti"; } else if (Medications.IsSelected) { if (GridMenu.Width == 200) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } Frame_Change.Navigate(new Uri("Pages/Medications.xaml", UriKind.Relative)); Section_Label.Text = "Lekovi"; } else if (Blog.IsSelected) { if (GridMenu.Width == 200) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } Frame_Change.Navigate(new Uri("Pages/Blog.xaml", UriKind.Relative)); Section_Label.Text = "Blog"; } } } }
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (((ListViewItem)((ListView)sender).SelectedItem).Name) { case "Principal": fechar.Foreground = Brushes.White; if (ButtonCloseMenu.Visibility == Visibility.Visible) { ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } break; case "cadastrar": ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); if (Campovazio()) { MessageBox.Show("preencha os campos para prosseguir!"); } else { CadPecas(); timedao.Cadastrartime(time); Limpar(); dgListar.ItemsSource = null; dgListar.ItemsSource = timedao.ListarTime(); MessageBox.Show("Cadastrado"); } break; case "alterar": ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); if (Campovazio()) { MessageBox.Show("preencha os campos para prosseguir!"); } else { if (MessageBox.Show("Deseja realmente alterar o time ?", "Confirmação", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { CadPecas(); timedao.AlterarTime(time); Limpar(); dgListar.ItemsSource = null; dgListar.ItemsSource = timedao.ListarTime(); MessageBox.Show("Alterado"); } } break; case "excluir": ButtonCloseMenu.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); if (MessageBox.Show("Deseja realmente alterar o time ?", "Confirmação", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { time = dgListar.SelectedItem as Time; timedao.Excluirtime(time); dgListar.ItemsSource = null; dgListar.ItemsSource = timedao.ListarTime(); MessageBox.Show("Excluido"); } break; } }