Ejemplo n.º 1
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserControl usc = null;

            GridMain.Children.Clear();

            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "ItemHome":
                usc = new UserControlHome();
                GridMain.Children.Add(usc);
                break;

            case "ItemCreate":
                usc = new UserControlCreate();

                GridMain.Children.Add(usc);
                break;

            case "ItemImport":
                usc = new UserControlImport();
                GridMain.Children.Add(usc);
                break;

            case "ItemConsole":
                usc = new UserControlConsole();
                GridMain.Children.Add(usc);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserControl usc = null;

            GridMain.Children.Clear();

            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "Home":
                WriteGrid.Visibility = Visibility.Collapsed;
                WriteGrid.Visibility = Visibility.Visible;
                break;

            case "Save":
                SaveFileDialog saveFileDialog = new SaveFileDialog();
                saveFileDialog.Filter = "Text Files|*.txt";
                if (saveFileDialog.ShowDialog() == true)
                {
                    System.IO.File.WriteAllText(saveFileDialog.FileName, textBox.Text);
                }
                break;

            case "OpenFile":
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Text Files|*.txt";
                if (openFileDialog.ShowDialog() == true)
                {
                    textBox.Text = File.ReadAllText(openFileDialog.FileName);
                }
                break;

            case "About":
                usc = new UserControlCreate();
                GridMain.Children.Add(usc);
                WriteGrid.Visibility = Visibility.Hidden;
                break;

            default:
                break;
            }
        }