Ejemplo n.º 1
0
        private void miOpen_Click(object sender, RoutedEventArgs e)
        {
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = ""; // Default file name
            dlg.DefaultExt = ".cool"; // Default file extension
            dlg.Filter = "Cool documents (.cool)|*.cool"; // Filter files by extension
            dlg.Multiselect = false;
            // Show open file dialog box
            Nullable<bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Create tab for existed file
                CoolTabItem tabItem = new CoolTabItem(dlg.FileName);
                this.tc.Items.Add(tabItem);
                this.tc.SelectedItem = tabItem;
            }
        }
Ejemplo n.º 2
0
        private void miNew_Click(object sender, RoutedEventArgs e)
        {
            this.tc.Visibility = System.Windows.Visibility.Visible;

            // Create tab for new file
            CoolTabItem tabItem = new CoolTabItem();
            this.tc.Items.Add(tabItem);
            this.tc.SelectedItem = tabItem;
        }