Esempio n. 1
0
        public CardControl()
        {
            InitializeComponent();
            if (mouseClickHandler == null)
                mouseClickHandler = new MouseClickHandler(
                    this.Dispatcher,
                    MouseButtonUpAction,
                    MouseButtonDoubleClickAction);
            if (DesignerProperties.GetIsInDesignMode(this)) return;
            Program.GameEngine.ComposeParts(this);

            //fix MAINWINDOW bug
            _mainWin = WindowManager.PlayWindow;
            int markerSize = Program.GameEngine.Definition.MarkerSize;
            if (markerSize == 0) markerSize = 20;
            markers.Margin = new Thickness(markerSize / 8);
            peekEyeIcon.Width = peekers.MinHeight = markerSize;
            peekers.SetValue(TextBlock.FontSizeProperty, markerSize * 0.8);
            if (Program.GameEngine.Definition.CardCornerRadius > 0)
                img.Clip = new RectangleGeometry();
            AddHandler(MarkerControl.MarkerDroppedEvent, new EventHandler<MarkerEventArgs>(MarkerDropped));
            AddHandler(TableControl.TableKeyEvent, new EventHandler<TableKeyEventArgs>(TableKeyDown));
            DataContextChanged += CardChangedHandler;
            Unloaded += RemoveCardHandler;
            Loaded += RestoreCardHandler;
            Loaded += AnimateLoad;
            SizeChanged += delegate
                               {
                                   // if only height is set, set width accordingly so that slight differences in scans size
                                   // don't propagate to the layout
                                   if (double.IsNaN(Width) && !double.IsNaN(Height))
                                   {
                                       Width = Program.GameEngine.Definition.CardWidth * Height / Program.GameEngine.Definition.CardHeight;
                                   }
                                   target.Height = target.Width = Math.Min(Height, Width);
                                   peekers.Margin = new Thickness(ActualWidth - 1, 8, -200, 0);
                               };
        }
Esempio n. 2
0
        public CardControl()
        {
            InitializeComponent();
            if (mouseClickHandler == null)
                mouseClickHandler = new MouseClickHandler(
                    this.Dispatcher,
                    MouseButtonUpAction,
                    MouseButtonDoubleClickAction);
            if (DesignerProperties.GetIsInDesignMode(this)) return;
            Program.GameEngine.ComposeParts(this);

            //fix MAINWINDOW bug
            _mainWin = WindowManager.PlayWindow;
            int markerSize = Program.GameEngine.Definition.MarkerSize;
            if (markerSize == 0) markerSize = 20;
            markers.Margin = new Thickness(markerSize / 8);
            peekEyeIcon.Width = peekers.MinHeight = markerSize;
            anchoredIcon.Width = markerSize;
            peekers.SetValue(TextBlock.FontSizeProperty, markerSize * 0.8);
            //if (Program.GameEngine.Definition.CardCornerRadius > 0)
            img.Clip = new RectangleGeometry();
            AddHandler(MarkerControl.MarkerDroppedEvent, new EventHandler<MarkerEventArgs>(MarkerDropped));
            AddHandler(TableControl.TableKeyEvent, new EventHandler<TableKeyEventArgs>(TableKeyDown));
            DataContextChanged += CardChangedHandler;
            Unloaded += RemoveCardHandler;
            Loaded += RestoreCardHandler;
            Loaded += AnimateLoad;
            SizeChanged += OnSizeChanged;
        }