Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public IntroWindow()
        {
            InitializeComponent();

            if (Settings.Default.datasPath == Settings.Default.defaultDatasPath)
            {
                Settings.Default.datasPath = string.Concat(
                    System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase),
                    Settings.Default.datasPath);
                Settings.Default.datasPath = Settings.Default.datasPath.Replace("file:\\", string.Empty);
                Settings.Default.Save();
            }

            if (!System.IO.Directory.Exists(Settings.Default.datasPath))
            {
                MessageBox.Show($"The {Settings.Default.defaultDatasPath} folder inside the app folder doesn't exist !", "ErsatzCiv");
                Environment.Exit(0);
            }

            (GridContent.Background as ImageBrush).ImageSource = DrawTools.GetBitmap("intro", isJpg: true);
        }
Ejemplo n.º 2
0
        private static Image DrawCitizen(CitizenPivot citizen, int size, double opacity,
                                         Action <object, MouseButtonEventArgs> MouseLeftButtonCallback)
        {
            Style style = new Style
            {
                TargetType = typeof(Image)
            };

            style.Setters.Add(new Setter(OpacityProperty, opacity));

            if (opacity < 1)
            {
                var trigger = new Trigger
                {
                    Property = IsMouseOverProperty,
                    Value    = true
                };
                trigger.Setters.Add(new Setter(OpacityProperty, Convert.ToDouble(1)));
                style.Triggers.Add(trigger);
            }

            var imgCitizen = new Image
            {
                Width   = size,
                Height  = size,
                Source  = DrawTools.GetBitmap(citizen.ToString(), isCitizen: true),
                ToolTip = citizen.ToString(),
                Style   = style,
                Stretch = System.Windows.Media.Stretch.Uniform,
                Tag     = citizen
            };

            if (MouseLeftButtonCallback != null)
            {
                imgCitizen.MouseLeftButtonDown += new MouseButtonEventHandler(MouseLeftButtonCallback);
            }

            return(imgCitizen);
        }