Ejemplo n.º 1
0
        public void setStyle(CharDisplayInfo fs, int count, FormattedText ft)
        {
            if ((fs.Style & (int)ZStyles.BOLDFACE_STYLE) > 0)
            {
                ft.SetFontWeight(FontWeights.Bold);
            }

            if ((fs.Style & (int)ZStyles.REVERSE_STYLE) > 0)
            {
                ft.SetFontWeight(FontWeights.Bold);
                ft.SetForegroundBrush(ZColorCheck.ZColorToBrush(fs.BackgroundColor, ColorType.Background));
            }
            else
            {
                ft.SetForegroundBrush(ZColorCheck.ZColorToBrush(fs.ForegroundColor, ColorType.Foreground));
            }

            if ((fs.Style & (int)ZStyles.EMPHASIS_STYLE) > 0)
            {
                ft.SetFontStyle(FontStyles.Italic);
            }

            if ((fs.Style & (int)ZStyles.FIXED_WIDTH_STYLE) > 0)
            {
                ft.SetFontFamily(_fixedFont.Family);
            }
        }
Ejemplo n.º 2
0
        public bool AreSameColor(ZColorCheck ColorToCompare)
        {
            if (ColorToCompare == null) return false;

            if (ColorToCompare.ColorCode == 0 || _color == 0 && _type == ColorToCompare.Type) return true;

            return (ColorToCompare.ColorCode == _color && ColorToCompare.Type == _type);
        }
Ejemplo n.º 3
0
        public bool AreSameColor(ZColorCheck ColorToCompare)
        {
            if (ColorToCompare == null)
            {
                return(false);
            }

            if (ColorToCompare.ColorCode == 0 || _color == 0 && _type == ColorToCompare.Type)
            {
                return(true);
            }

            return(ColorToCompare.ColorCode == _color && ColorToCompare.Type == _type);
        }
Ejemplo n.º 4
0
        public bool AreSameColor(ZColorCheck colorToCompare)
        {
            if (colorToCompare == null)
            {
                return(false);
            }

            if (colorToCompare.ColorCode == 0 || ColorCode == 0 && Type == colorToCompare.Type)
            {
                return(true);
            }

            return(colorToCompare.ColorCode == ColorCode && colorToCompare.Type == Type);
        }
Ejemplo n.º 5
0
        protected FormattedText buildFormattedText(String Text, FontInfo Font, CharDisplayInfo cdi, DrawingContext dc)
        {
            TextFormattingMode tfm = TextFormattingMode.Display;
            FormattedText      ft  = new FormattedText(Text,
                                                       CultureInfo.CurrentCulture,
                                                       FlowDirection.LeftToRight,
                                                       Font.Typeface,
                                                       Font.PointSize,
                                                       ZColorCheck.ZColorToBrush(cdi.ForegroundColor, ColorType.Foreground),
                                                       _substituion, tfm);

            setStyle(cdi, Text.Length, ft);

            return(ft);
        }
Ejemplo n.º 6
0
        public void ZMachineThread(Object argsO)
        {
            String[] args = (String[])argsO;
            if (args.Length > 0 && args[0] == "last" && LastPlayedGames.Count > 0)
            {
                args[0] = LastPlayedGames[LastPlayedGames.Count - 1];
            }

            try
            {
                Dispatcher.Invoke(new Action(delegate
                {
                    mnuInGame.Visibility = System.Windows.Visibility.Visible;
                    mnuMain.Visibility   = System.Windows.Visibility.Collapsed;
                    _screen.Focus();

                    if (Properties.Settings.Default.ShowDebugMenu == true)
                    {
                        miDebugInfo.Visibility = System.Windows.Visibility.Visible;
                    }
                    else
                    {
                        miDebugInfo.Visibility = System.Windows.Visibility.Collapsed;
                    }
                }));
                Frotz.os_.SetScreen((IZScreen)_screen);

                ZColorCheck.resetDefaults();

                _screen.GameSelected += new EventHandler <GameSelectedEventArgs>(_screen_GameSelected);
                Frotz.Generic.main.MainFunc((String[])args);

                Dispatcher.Invoke(new Action(delegate
                {
                    _screen.Reset();
                }));

                if (closeOnQuit)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        this.Close();
                    }));
                }
            }
            catch (ZMachineException)
            { // Noop
            }
            catch (ThreadAbortException)
            { // TODO It may be wise to handle this
            }
            catch (Exception ex)
            {
                MessageBox.Show("EX:" + ex);
            }
            finally
            {
                _screen.GameSelected -= new EventHandler <GameSelectedEventArgs>(_screen_GameSelected);
                Dispatcher.Invoke(new Action(delegate
                {
                    buildMainMenu();

                    mnuInGame.Visibility = System.Windows.Visibility.Collapsed;
                    mnuMain.Visibility   = System.Windows.Visibility.Visible;

                    this.Title = "FrotzNET";
                }));
            }
        }