示例#1
0
        private void Back_btn_Click(object sender, RoutedEventArgs e)//Opens RootWindow and closes the current widnow
        {
            RootWindow instance = new RootWindow();

            instance.Show();
            this.Close();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)//Gets all files with .txt extension in the Saves folder and dispays them in a ListBox
        {
            string        PathToSaves = RootWindow.GetPathToSaves();
            DirectoryInfo r           = new DirectoryInfo(PathToSaves);

            FileInfo[]    s            = r.GetFiles("*.txt");
            List <string> NamesOfSaves = new List <string>();

            foreach (FileInfo file in s)
            {
                NamesOfSaves.Add(file.Name + "\nDate Created: " + file.CreationTime);
            }
            ListBox_AvailableSaves.ItemsSource = NamesOfSaves;
            ListBox_AvailableSaves.FontSize    = 20;
            ListBox_AvailableSaves.FontWeight  = FontWeights.Bold;
            PathChosen              = PathToSaves;
            LoadSaveFile_btn.Click += LoadSaveFile_btn_Click;
        }
示例#3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.RootMenu = ((Project_ChessWithInterface.RootWindow)(target));
                return;

            case 2:
                this.newGame_btn = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.loadGame_btn = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.gameArchive_btn = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }