コード例 #1
0
        public override void Draw()
        {
            // may be the luck with drawing on two windows parallel-ly ran out...
            bool            isHost = _role == MultiplayerRole.Host;
            MultiplayerData data   = _connection.CurrentData;
            PlayerData      host   = isHost ? data.Host : data.Guest,
                            guest  = isHost ? data.Guest : data.Host;

            // draw player side
            InformationBar.Draw(
                TimeFormatter.GetTime(_connection.TimePlayed),
                (host.Board as MinesweeperBoard).Flag,
                _playerProps.WindowWidth
                );
            DrawBoard(host.Board.DrawableBoard);

            // a line in between screens
            int wW = _playerProps.WindowWidth, wH = _playerProps.WindowHeight;

            SplashKit.DrawLine(Constants.TEXT_COLOR, wW, 0, wW, wH);

            // draw opponent side
            InformationBar.Draw(
                TimeFormatter.GetTime(guest.Time),
                guest.Flag,
                _opponentProps.WindowWidth, true,
                _playerProps.WindowWidth
                );
            DrawBoard(guest.Board.DrawableBoard, true);
        }
コード例 #2
0
        public override void Draw()
        {
            int size = _mode.SquareSize, x = 0, y = 0;
            var p = _properties;

            // draw information bar
            InformationBar.Draw(_stopWatch.GetTime(), (_mode.Board as MinesweeperBoard).Flag);

            // draw each squares on the board
            foreach (string representativeChar in _mode.Board.DrawableBoard)
            {
                // draw the whole square
                Bitmap image = BitmapList.GetBitmap(representativeChar);
                // x and y must all be substracted with its respective offsets
                SplashKit.DrawBitmapOnWindow(
                    SplashKit.CurrentWindow(),
                    image,
                    p.MarginLeft + x * size - p.SquareOffsetX,
                    p.MarginTop + y * size - p.SquareOffsetY,
                    p.SquareOptions
                    );

                // advances to another row
                if (x++ == _mode.Board.Width - 1)
                {
                    x = 0;
                    y++;
                }
            }
        }
コード例 #3
0
        protected override async void HandleInformationBarMenu(InformationBar bar, IntPtr hwndOwner, int id)
        {
            if (id == 1) // first item has id 1, etc.
            {
                await WindowsUtilities.DoModelessAsync(() =>
                {
                    System.Windows.Forms.MessageBox.Show(new Win32Window(hwndOwner), "UAC level is " + DiagnosticsInformation.GetTokenElevationType(), "Registry Folder");
                });

                return;
            }
        }
コード例 #4
0
        protected override InformationBar GetInformationBar()
        {
            if (Hive != RegistryHive.LocalMachine || DiagnosticsInformation.GetTokenElevationType() == TokenElevationType.Full)
            {
                return(null);
            }

            var bar = new InformationBar();

            bar.Guid    = _adminMessageGuid;
            bar.Message = "You must be running with full priviledges to change anything here";
            return(bar);
        }
コード例 #5
0
        protected override void CreateInformationBarMenu(InformationBar bar, ShellMenu appendMenu)
        {
            var item = new ShellMenuItem(appendMenu, "What is my UAC level?");

            appendMenu.Items.Add(item);
        }