Exemplo n.º 1
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width = SystemMetrics.ScreenWidth;

            int buttonWidth = SystemMetrics.ScreenWidth / 4;
            int buttonHeight = 20;

            // Create a panel to hold the list view and buttons.
            StackPanel stackPanel = new StackPanel();
            stackPanel.Orientation = Orientation.Vertical;

            // Create a panel to hold the buttons.
            StackPanel buttonPanel = new StackPanel();
            buttonPanel.Orientation = Orientation.Horizontal;

            ButtonControl newFileButton = new ButtonControl("New File", buttonWidth, buttonHeight);
            newFileButton.TouchDown += new TouchEventHandler(OnNewFile);
            buttonPanel.Children.Add(newFileButton);

            ButtonControl newDirButton = new ButtonControl("New Dir", buttonWidth, buttonHeight);
            newDirButton.TouchDown += new TouchEventHandler(OnNewDirectory);
            buttonPanel.Children.Add(newDirButton);

            ButtonControl deleteButton = new ButtonControl("Delete", buttonWidth, buttonHeight);
            deleteButton.TouchDown += new TouchEventHandler(OnDeleteFile);
            buttonPanel.Children.Add(deleteButton);

            ButtonControl formatButton = new ButtonControl("Format", buttonWidth, buttonHeight);
            formatButton.TouchDown += new TouchEventHandler(OnFormat);
            buttonPanel.Children.Add(formatButton);

            // Create the list view.
            _listView = new ListView(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight - buttonHeight);
            _listView.AddColumn("Name", 200);
            _listView.AddColumn("Size", 80);
            _listView.AddColumn("Created", 80);
            _listView.SelectionChanged += new SelectionChangedEventHandler(OnItemSelected);

            stackPanel.Children.Add(buttonPanel);
            stackPanel.Children.Add(_listView);
            mainWindow.Child = stackPanel;

            // Refresh the directory and file list
            RefreshList();

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return mainWindow;
        }
Exemplo n.º 2
0
        public Window CreateWindow()
        {
            // Create a window object and set its size to the
            // size of the display.
            mainWindow        = new Window();
            mainWindow.Height = SystemMetrics.ScreenHeight;
            mainWindow.Width  = SystemMetrics.ScreenWidth;

            int buttonWidth  = SystemMetrics.ScreenWidth / 4;
            int buttonHeight = 20;

            // Create a panel to hold the list view and buttons.
            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;

            // Create a panel to hold the buttons.
            StackPanel buttonPanel = new StackPanel();

            buttonPanel.Orientation = Orientation.Horizontal;

            ButtonControl newFileButton = new ButtonControl("New File", buttonWidth, buttonHeight);

            newFileButton.TouchDown += new TouchEventHandler(OnNewFile);
            buttonPanel.Children.Add(newFileButton);

            ButtonControl newDirButton = new ButtonControl("New Dir", buttonWidth, buttonHeight);

            newDirButton.TouchDown += new TouchEventHandler(OnNewDirectory);
            buttonPanel.Children.Add(newDirButton);

            ButtonControl deleteButton = new ButtonControl("Delete", buttonWidth, buttonHeight);

            deleteButton.TouchDown += new TouchEventHandler(OnDeleteFile);
            buttonPanel.Children.Add(deleteButton);

            ButtonControl formatButton = new ButtonControl("Format", buttonWidth, buttonHeight);

            formatButton.TouchDown += new TouchEventHandler(OnFormat);
            buttonPanel.Children.Add(formatButton);

            // Create the list view.
            _listView = new ListView(SystemMetrics.ScreenWidth, SystemMetrics.ScreenHeight - buttonHeight);
            _listView.AddColumn("Name", 200);
            _listView.AddColumn("Size", 80);
            _listView.AddColumn("Created", 80);
            _listView.SelectionChanged += new SelectionChangedEventHandler(OnItemSelected);

            stackPanel.Children.Add(buttonPanel);
            stackPanel.Children.Add(_listView);
            mainWindow.Child = stackPanel;

            // Refresh the directory and file list
            RefreshList();

            // Set the window visibility to visible.
            mainWindow.Visibility = Visibility.Visible;

            // Attach the button focus to the window.
            Buttons.Focus(mainWindow);

            return(mainWindow);
        }