Ejemplo n.º 1
0
        private static void Init()
        {
            //CreatePresetThemes();

            // Load a double sized font
            FontMaster fontMaster = SadConsole.Global.LoadFont("cp437_10_ext.font");

            Global.FontDefault = fontMaster.GetFont(Font.FontSizes.Two);

            Random = new Random();

            // Create
            TetrisWindow = new TetrisWindow();
            SnakeWindow  = new SnakeWindow();

            WindowTheme Editor = new WindowTheme();

            Editor.FillStyle            = new Cell(Color.Transparent, Color.Black, 219);
            Library.Default.WindowTheme = Editor;
            ThemeEditor = new ThemeEditorWindow(80, 40);

            TilesetViewer = new TilesetViewer();

            MapView = new MapView();


            MainMenu = new MainMenu(80, 40);
            MainMenu.Show();
        }
Ejemplo n.º 2
0
        public InventoryWindow(int width, int height, Point pos) : base(width, height)
        {
            Position = pos;
            Components.Add(new BorderComponent(ConnectedLineThin, Color.White, Color.Black));

            Title          = "Inventory";
            TitleAlignment = HorizontalAlignment.Center;
            CanDrag        = false;
            CloseOnEscKey  = true;

            var theme = new WindowTheme();

            theme.FillStyle.Background = Color.Black;
            Theme = theme;

            _equippedItemsConsole = new EquippedItemsConsole(Width, 10);
            Children.Add(_equippedItemsConsole);

            // TODO: should be moved to it's own class to handle the functionality
            _itemsList = new ListBox(Width - 2, Height - _equippedItemsConsole.Height - 1)
            {
                Position = new Point(1, _equippedItemsConsole.Height)
            };
            _itemsList.SelectedItemExecuted += OnItemClicked;
            Add(_itemsList);
            // Show();
        }
Ejemplo n.º 3
0
 protected void CreateWindowTheme( )
 {
     WindowTheme = new WindowTheme();
     WindowTheme.BorderStyle.Background = ControlBack;
     WindowTheme.BorderStyle.Foreground = TextDark;
     WindowTheme.TitleStyle             = new Cell(TitleText);
     WindowTheme.FillStyle = Appearance_ControlNormal;
 }
Ejemplo n.º 4
0
        private static void SetupTheme()
        {
            WindowTheme windowTheme = new WindowTheme(new Colors());

            Library.Default.WindowTheme = windowTheme;

            Library.Default.Colors.ControlHostBack = Palette.Background;
            Library.Default.Colors.ControlHostFore = Palette.Text;
            Library.Default.Colors.TitleText       = Palette.Text;
        }
Ejemplo n.º 5
0
        private void ApplyWindowTheme()
        {
            var attr = (HideTitle) ?
                       WindowThemeNonClientAttributes.NoDrawCaption | WindowThemeNonClientAttributes.NoDrawIcon :
                       WindowThemeNonClientAttributes.NullAttribute;

            WindowTheme.SetWindowThemeNonClientAttributes(Handle,
                                                          WindowThemeNonClientAttributes.NoDrawCaption | WindowThemeNonClientAttributes.NoDrawIcon,
                                                          attr);
        }
Ejemplo n.º 6
0
        internal static void SaveWindowTheme(BaseWindow?window, Pik.Metro.Theme wTheme, bool isOnlyThisWindow)
        {
            try
            {
                var windowsThemes = LoadWindowsThemes();
                applicationTheme = FindApplication(windowsThemes, applicationName);
                if (applicationTheme == null)
                {
                    applicationTheme = new ApplicationThemes {
                        Name = applicationName
                    };
                    windowsThemes.Applications.Add(applicationTheme);
                }

                if (isOnlyThisWindow && window != null)
                {
                    var windowTheme = FindWindowTheme(window);
                    if (windowTheme == null)
                    {
                        windowTheme = new WindowTheme {
                            Window = GetWindowName(window)
                        };
                        applicationTheme.Windows.Add(windowTheme);
                        AddApplication(windowsThemes, applicationTheme);
                    }

                    windowTheme.Theme = wTheme.Name;
                }
                else
                {
                    var windowTheme = FindWindowTheme(window);
                    if (windowTheme != null)
                    {
                        applicationTheme.Windows.Remove(windowTheme);
                    }

                    theme = wTheme;
                    applicationTheme.Theme = theme.Name;
                    Change?.Invoke(null, EventArgs.Empty);
                }

                var file = GetWindowsThemesFile();
                Save(file, windowsThemes);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "SaveWindowTheme");
            }
        }