コード例 #1
0
        // --------------------------------------------------------------------------
        /// <summary>
        /// ctor
        /// </summary>
        // --------------------------------------------------------------------------
        public NotificationWidget(TimerInstance data, AppModel appModel, double location)
        {
            InitializeComponent();
            this._data       = data;
            this._appModel   = appModel;
            this.DataContext = data;
            LocationTheta    = location;
            data.OnDismiss  += () => this.Close();

            this.Loaded += (a, b) =>
            {
                _draggingLogic = new DraggingLogic(this, this);
                _draggingLogic.OnPositionChanged += (xm, ym) =>
                {
                    Center = new Point(Center.X + xm / _draggingLogic.DpiCorrectionX, Center.Y + ym / _draggingLogic.DpiCorrectionY);
                };
            };
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: nebosite/talisman
        // --------------------------------------------------------------------------
        /// <summary>
        /// ctor
        /// </summary>
        // --------------------------------------------------------------------------
        public MainWindow()
        {
            _theModel = new AppModel((runme) =>
            {
                Dispatcher.Invoke(runme);
            });
            _theModel.OnCenter += HandleOnCenter;

            InitializeComponent();
            CompositionTarget.Rendering += AnimateFrame;
            this.Loaded              += MainWindow_Loaded;
            this.DataContext          = _theModel;
            _theModel.OnNotification += HandleNewNotification;

            int maxLocations = 10;
            var thetaSlice   = (Math.PI * 2) / maxLocations;

            for (int i = 0; i < maxLocations; i++)
            {
                _emptyNotificationLocations.Add(thetaSlice * i);
            }
        }