Beispiel #1
0
        public VideoPage()
        {
            InitializeComponent();
            _autoPlay = SettingsHelper.GetIsAutoPlayVideo();
            Pivot.SelectionChanged += PivotOnSelectionChanged;
            SubscribePlayerEvents(player);
            player.AutoPlay = _autoPlay;

            PhoneApplicationService.Current.Deactivated += Current_Deactivated;
            PhoneApplicationService.Current.Activated   += Current_Activated;
            LayoutRoot.SizeChanged += OnLayoutRootSizeChanged;

            _sensor = SimpleOrientationSensor.GetDefault();

            _sendApplicationBar       = new ApplicationBar();
            _sendApplicationBarButton = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Send.png", AppResources.Send, Send_Click);
            _sendApplicationBar.Buttons.Add(_sendApplicationBarButton);

            _currentApplicationBar      = new ApplicationBar();
            _currentApplicationBar.Mode = ApplicationBarMode.Minimized;
            _currentApplicationBar.Buttons.Add(ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Home.png", AppResources.Home, Home_Click));
            //_currentApplicationBar.Buttons.Add(ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Refresh.png", AppResources.Refresh, Refresh_Click));
            _currentApplicationBar.MenuItems.Add(ApplicationBarHelper.CreateAApplicationBarMenuItem(AppResources.CopyVideoLink, CopyVideoUrl_Click));

            _favoritesApplicationBarButton     = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.StarAdd.png", AppResources.AddToFavorites, AddToFavorites_Click);
            _addToPlaylistApplicationBarButton = ApplicationBarHelper.CreateApplicationBarIconButton("/Toolkit.Content/ApplicationBar.Add.png", AppResources.AddToPlaylist, AddToPlaylist_Click);

            ApplicationBar = _currentApplicationBar;
        }
Beispiel #2
0
        public MapControl()
        {
            Background = new SolidColorBrush(Colors.White); // DON'T REMOVE! Touch events do not work without a background

            Children.Add(_renderTarget);
            Children.Add(_bboxRect);

            _renderTarget.PaintSurface += _renderTarget_PaintSurface;

            Map = new Map();

            Loaded += MapControlLoaded;

            SizeChanged += MapControlSizeChanged;
            CompositionTarget.Rendering += CompositionTarget_Rendering;
            _renderer            = new MapRenderer();
            PointerWheelChanged += MapControl_PointerWheelChanged;

            ManipulationMode             = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Rotate;
            ManipulationDelta           += OnManipulationDelta;
            ManipulationCompleted       += OnManipulationCompleted;
            ManipulationInertiaStarting += OnManipulationInertiaStarting;

            Tapped += OnTapped;

            var orientationSensor = SimpleOrientationSensor.GetDefault();

            if (orientationSensor != null)
            {
                orientationSensor.OrientationChanged += (sender, args) =>
                                                        Task.Run(() => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Refresh))
                                                        .ConfigureAwait(false);
            }
        }
Beispiel #3
0
        //Declare MediaCapture object globally


        async private void Start_Capture_Preview_Click()
        {
            var captureManager = App.CaptureManager;    //Define MediaCapture object
            await captureManager.InitializeAsync();     //Initialize MediaCapture and

            capturePreview.Source = captureManager;     //Start preiving on CaptureElement
            captureManager.SetPreviewRotation(VideoRotation.Clockwise90Degrees);

            await captureManager.StartPreviewAsync();   //Start camera capturing

            SimpleOrientationSensor sensor = SimpleOrientationSensor.GetDefault();

            sensor.OrientationChanged += (s, arg) =>
            {
                switch (arg.Orientation)
                {
                case SimpleOrientation.Rotated90DegreesCounterclockwise:
                    captureManager.SetPreviewRotation(VideoRotation.None);
                    break;

                case SimpleOrientation.Rotated180DegreesCounterclockwise:
                case SimpleOrientation.Rotated270DegreesCounterclockwise:
                    captureManager.SetPreviewRotation(VideoRotation.Clockwise180Degrees);
                    break;

                default:
                    captureManager.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
                    break;
                }
            };
        }
Beispiel #4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            OrientationSensor = OrientationSensor.GetDefault();
            if (OrientationSensor == null)
            {
                SimpleOrientationSensor = SimpleOrientationSensor.GetDefault();
                if (SimpleOrientationSensor == null)
                {
                    throw new Exception("No way of determining orientation");
                }
            }

            TouchPanel.EnabledGestures = GestureType.Hold | GestureType.Flick | GestureType.HorizontalDrag | GestureType.VerticalDrag | GestureType.DragComplete;

            vertexBuffer = new DynamicVertexBuffer(graphics.GraphicsDevice, typeof(VertexPositionColor), 8, BufferUsage.WriteOnly);
            indexBuffer  = new DynamicIndexBuffer(graphics.GraphicsDevice, typeof(ushort), 36, BufferUsage.WriteOnly);

            basicEffect = new BasicEffect(graphics.GraphicsDevice); //(device, null);
            basicEffect.LightingEnabled    = false;
            basicEffect.VertexColorEnabled = true;
            basicEffect.TextureEnabled     = false;

            DepthStencilState depthBufferState = new DepthStencilState();

            depthBufferState.DepthBufferEnable = true;
            GraphicsDevice.DepthStencilState   = depthBufferState;

            TetrisState.Initialize(graphics.GraphicsDevice);

            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SuppressSystemOverlays = true;
            graphics.SupportedOrientations = DisplayOrientation.Portrait;

            base.Initialize();
        }
Beispiel #5
0
        public MapControl()
        {
            Background = new SolidColorBrush(Colors.White); // DON'T REMOVE! Touch events do not work without a background

            Children.Add(_canvas);
            Children.Add(_selectRectangle);

            _canvas.IgnorePixelScaling = true;
            _canvas.PaintSurface      += Canvas_PaintSurface;

            Map = new Map();

            Loaded += MapControlLoaded;

            SizeChanged += MapControlSizeChanged;

            PointerWheelChanged += MapControl_PointerWheelChanged;

            ManipulationMode       = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.Rotate;
            ManipulationStarted   += OnManipulationStarted;
            ManipulationDelta     += OnManipulationDelta;
            ManipulationCompleted += OnManipulationCompleted;

            ManipulationInertiaStarting += OnManipulationInertiaStarting;

            Tapped       += OnSingleTapped;
            DoubleTapped += OnDoubleTapped;

            var orientationSensor = SimpleOrientationSensor.GetDefault();

            if (orientationSensor != null)
            {
                orientationSensor.OrientationChanged += (sender, args) => Refresh();
            }
        }
Beispiel #6
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     //获取参数打开视频
     param            = e.Parameter as MediaPlayerSource;
     PlayerTitle.Text = param.Title + '-' + param.PartTitle;
     //加载弹幕
     LoadDanmaku();
     //播放视频
     Play();
     //设置屏幕方向
     DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
     //获取方向传感器
     simpleorientation = SimpleOrientationSensor.GetDefault();
     if (simpleorientation == null)
     {
         SettingsRow0.Visibility = Visibility.Collapsed;
     }
     //这两个东西有最小值,加载会出发ValueChanged事件,这里等它加载完再添加委托
     DanmakuSizeSlider.Loaded  += ((sender, args) => DanmakuSizeSlider.ValueChanged += DanmakuSizeSlider_ValueChanged);
     DanmakuSpeedSlider.Loaded += ((sender, args) => DanmakuSpeedSlider.ValueChanged += DanmakuSpeedSlider_ValueChanged);
     StatusText.Text            = "";
     Status.Visibility          = Visibility.Visible;
     //设置可拖动区域
     Window.Current.SetTitleBar(DraggableArea);
     //设置一些控件的初始值
     SetValues();
 }
Beispiel #7
0
        public MainPage()
        {
            this.InitializeComponent();

            sensor = SimpleOrientationSensor.GetDefault();
            sensor.OrientationChanged += Sensor_OrientationChanged;
        }
Beispiel #8
0
 public override void OnAttachedToWindow()
 {
     base.OnAttachedToWindow();
     // Cannot call this in ctor: see
     // https://stackoverflow.com/questions/10593022/monodroid-error-when-calling-constructor-of-custom-view-twodscrollview#10603714
     RaiseConfigurationChanges();
     SimpleOrientationSensor.GetDefault().OrientationChanged += OnSensorOrientationChanged;
 }
Beispiel #9
0
 private void InitializeSensor()
 {
     _sensor = SimpleOrientationSensor.GetDefault();
     if (_sensor != null)
     {
         _sensor.OrientationChanged += OrientationChanged;
     }
 }
Beispiel #10
0
 public MainPage()
 {
     InitializeComponent();
     _orientation = SimpleOrientationSensor.GetDefault();
     if (_orientation != null)
     {
         _orientation.OrientationChanged += Orientation_OrientationChanged;
     }
 }
 public MainPage()
 {
     this.InitializeComponent();
     simpleorientation = SimpleOrientationSensor.GetDefault();
     if (simpleorientation != null)
     {
         simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
     }
 }
Beispiel #12
0
        public Scenario1_DataEvents()
        {
            this.InitializeComponent();

            _sensor = SimpleOrientationSensor.GetDefault();
            if (_sensor == null)
            {
                rootPage.NotifyUser("No simple orientation sensor found", NotifyType.ErrorMessage);
            }
        }
Beispiel #13
0
 public OrientationTests()
 {
     this.InitializeComponent();
     lastTime     = DateTime.UtcNow.ToUnixTimeMilliseconds();
     this.Loaded += (s, e) =>
     {
         var sensor = SimpleOrientationSensor.GetDefault();
         if (sensor is { })
         {
             sensor.OrientationChanged += OnSensorOrientationChanged;
         }
        public void RemoveCanvas()
        {
            this.ManipulationDelta -= CanvasWrapper_ManipulationDelta;
            SimpleOrientationSensor sensor = SimpleOrientationSensor.GetDefault();

            if (sensor != null)
            {
                sensor.OrientationChanged -= Sensor_OrientationChanged;
            }
            this.GetCanvas()?.RemoveFromVisualTree();
            this.Children.Clear();
        }
        public void SetCanvas(CanvasControl canvas)
        {
            this.Children.Clear();
            this.Children.Add(canvas);
            this.ManipulationDelta += CanvasWrapper_ManipulationDelta;
            SimpleOrientationSensor sensor = SimpleOrientationSensor.GetDefault();

            if (sensor != null)
            {
                sensor.OrientationChanged += Sensor_OrientationChanged;
            }
        }
        public void SetCameraEnclosureLocation(EnclosureLocation cameraEnclosureLocation)
        {
            _displayInformation = DisplayInformation.GetForCurrentView();
            _orientationSensor  = SimpleOrientationSensor.GetDefault();

            _cameraEnclosureLocation = cameraEnclosureLocation;
            if (!IsEnclosureLocationExternal(_cameraEnclosureLocation) && _orientationSensor != null)
            {
                _orientationSensor.OrientationChanged += SimpleOrientationSensor_OrientationChanged;
            }
            _displayInformation.OrientationChanged += DisplayInformation_OrientationChanged;
        }
Beispiel #17
0
        public Scenario1()
        {
            this.InitializeComponent();

            //<SnippetGetDefaultCS>
            _sensor = SimpleOrientationSensor.GetDefault();
            //</SnippetGetDefaultCS>

            if (_sensor == null)
            {
                rootPage.NotifyUser("No simple orientation sensor found", NotifyType.StatusMessage);
            }
        }
Beispiel #18
0
        //Constructor for GameOver.xaml
        public GameOver()
        {
            this.InitializeComponent();
            copyDatabase();                                            //Copy the database so it can be found locally

            _simpleorientation = SimpleOrientationSensor.GetDefault(); //Get a default version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }
        }//end constructor
Beispiel #19
0
        protected override void OnWindowCreated(WindowCreatedEventArgs args)
        {
            base.OnWindowCreated(args);
            //SearchPane searchPane = SearchPane.GetForCurrentView();
            //searchPane.SuggestionsRequested += OnSearchPaneSuggestionsRequested;

            var sensor = SimpleOrientationSensor.GetDefault();

            if (sensor != null)
            {
                sensor.OrientationChanged += Sensor_OrientationChanged;;
            }
        }
Beispiel #20
0
        public MapControl()
        {
            _renderTarget = new Canvas
            {
                VerticalAlignment   = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Background          = new SolidColorBrush(Colors.Transparent)
            };

            Children.Add(_renderTarget);

            _bboxRect = new Rectangle
            {
                Fill            = new SolidColorBrush(Colors.Red),
                Stroke          = new SolidColorBrush(Colors.Black),
                StrokeThickness = 3,
                RadiusX         = 0.5,
                RadiusY         = 0.5,
                StrokeDashArray = new DoubleCollection {
                    3.0
                },
                Opacity             = 0.3,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Visibility          = Visibility.Collapsed
            };
            Children.Add(_bboxRect);

            Map     = new Map();
            Loaded += MapControlLoaded;

            SizeChanged += MapControlSizeChanged;
            CompositionTarget.Rendering += CompositionTarget_Rendering;
            _renderer            = new MapRenderer();
            PointerWheelChanged += MapControl_PointerWheelChanged;

            ManipulationMode             = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
            ManipulationDelta           += OnManipulationDelta;
            ManipulationCompleted       += OnManipulationCompleted;
            ManipulationInertiaStarting += OnManipulationInertiaStarting;

            var orientationSensor = SimpleOrientationSensor.GetDefault();

            if (orientationSensor != null)
            {
                orientationSensor.OrientationChanged += (sender, args) =>
                                                        Task.Run(() => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, Refresh))
                                                        .ConfigureAwait(false);
            }
        }
Beispiel #21
0
 override protected void OnNavigatedTo(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     displayOrientation = ApplicationView.GetForCurrentView().Orientation;
     displayInformation = DisplayInformation.GetForCurrentView();
     deviceOrientation  = SimpleOrientation.NotRotated;
     orientationSensor  = SimpleOrientationSensor.GetDefault();
     if (orientationSensor != null)
     {
         deviceOrientation = orientationSensor.GetCurrentOrientation();
         orientationSensor.OrientationChanged += OrientationSensor_OrientationChanged;
     }
     Window.Current.SizeChanged += Current_SizeChanged;
 }
Beispiel #22
0
        public FeaturedBookList()
        {
            this.InitializeComponent();

            NavigationCacheMode         = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
            Window.Current.SizeChanged += VisualStateChanged;

            _simpleorientation = SimpleOrientationSensor.GetDefault();

            // Assign an event handler for the sensor orientation-changed event.
            // Check to make sure the sensor is available on the device first.
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }
        }
Beispiel #23
0
        //Constructor for HighScores.xaml
        public HighScores()
        {
            this.InitializeComponent();
            copyDatabase();                                     //Copys the database file so it can be found locally in the application

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }
        }//end of constructor
Beispiel #24
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape | DisplayOrientations.LandscapeFlipped | DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;
     acc = Accelerometer.GetDefault();
     //act = ActivitySensor.GetDefaultAsync().GetResults();
     alt  = Altimeter.GetDefault();
     baro = Barometer.GetDefault();
     comp = Compass.GetDefault();
     gyro = Gyrometer.GetDefault();
     //has = HingeAngleSensor.GetDefaultAsync().GetResults();
     inc = Inclinometer.GetDefault();
     mm  = Magnetometer.GetDefault();
     os  = OrientationSensor.GetDefault();
     //pm = Pedometer.GetDefaultAsync().GetResults();
     //ps = ProximitySensor.FromId(ProximitySensor.GetDeviceSelector());
     sos = SimpleOrientationSensor.GetDefault();
 }
        public CameraPage()
        {
            this.InitializeComponent();
            Application.Current.Resuming      += new EventHandler <object>(AppResume);
            HardwareButtons.BackPressed       += HardwareButtons_BackPressed;
            HardwareButtons.CameraPressed     += HardwareButtons_CameraPressed;
            HardwareButtons.CameraHalfPressed += HardwareButtons_CameraHalfPressed;
            HardwareButtons.CameraReleased    += HardwareButtons_CameraHalfPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }

            //DisableNotificationsBar();
        }
        //Constructor
        public HighScoresMenu()
        {
            this.InitializeComponent();
            createGameOptionList();                                         //Populate list with high score menu options
            highscoreOptionsList.ItemsSource = highscoreOptions;            //Make list of GameTypes the item source for the list

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }
        }//end HighScoresMenu constructor
        //Constructor
        public MainPage()
        {
            this.InitializeComponent();
            createGameOptionList();                                 //Populate the list of GameTypes.
            gameOptionsList.ItemsSource = gameOptions;              //Pass the GameType list as the listboxes item source

            //Add event listener for the back hardware button
            HardwareButtons.BackPressed += HardwareButtons_BackPressed;

            _simpleorientation = SimpleOrientationSensor.GetDefault();      //Get a defualt version of an orientation sensor.

            // Assign an event handler for the sensor orientation-changed event
            if (_simpleorientation != null)
            {
                _simpleorientation.OrientationChanged += new TypedEventHandler <SimpleOrientationSensor, SimpleOrientationSensorOrientationChangedEventArgs>(OrientationChanged);
            }

            //this.NavigationCacheMode = NavigationCacheMode.Required;
        }//end MainPage() constructor
Beispiel #28
0
        private void ConfigureSimpleOrientation()
        {
            // Get the reference to the sensor and see if it is available
            _simpleOrientation = SimpleOrientationSensor.GetDefault();
            if (_simpleOrientation == null)
            {
                return;
            }

            _sensorSettings.IsSimpleOrientationAvailable = true;

            // NOTE - Simple Orientation does not offer a minimum interval setting
            _simpleOrientation.OrientationChanged
                += SimpleOrientationOnOrientationChanged;

            // Read the initial sensor value
            _sensorSettings.LatestSimpleOrientationReading
                = _simpleOrientation.GetCurrentOrientation();
        }
Beispiel #29
0
        public InCall()
        {
            this.InitializeComponent();
            this.DataContext = new InCallModel();
            askingVideo      = false;

            if (LinphoneManager.Instance.IsVideoAvailable)
            {
                StartVideoStream();
                VideoGrid.Visibility = Visibility.Collapsed;
            }

            if (LinphoneManager.Instance.Core.CurrentCall.State == CallState.StreamsRunning)
            {
                Status.Text = "00:00:00";
            }

            displayOrientation = ApplicationView.GetForCurrentView().Orientation;
            displayInformation = DisplayInformation.GetForCurrentView();
            deviceOrientation  = SimpleOrientation.NotRotated;
            orientationSensor  = SimpleOrientationSensor.GetDefault();
            if (orientationSensor != null)
            {
                deviceOrientation = orientationSensor.GetCurrentOrientation();
                SetVideoOrientation();
                orientationSensor.OrientationChanged += OrientationSensor_OrientationChanged;
            }

            buttons.HangUpClick    += buttons_HangUpClick;
            buttons.StatsClick     += buttons_StatsClick;
            buttons.CameraClick    += buttons_CameraClick;
            buttons.PauseClick     += buttons_PauseClick;
            buttons.SpeakerClick   += buttons_SpeakerClick;
            buttons.MuteClick      += buttons_MuteClick;
            buttons.VideoClick     += buttons_VideoClick;
            buttons.BluetoothClick += buttons_BluetoothClick;
            buttons.DialpadClick   += buttons_DialpadClick;

            // Handling event when app will be suspended
            Application.Current.Suspending += new SuspendingEventHandler(App_Suspended);
            Application.Current.Resuming   += new EventHandler <object>(App_Resumed);
            pausedCall = null;
        }
Beispiel #30
0
            public override void readData(IMethodResult oResult)
            {
                Dictionary <string, string> result = new Dictionary <string, string>();

                try
                {
                    _screenOrientation = SimpleOrientationSensor.GetDefault().GetCurrentOrientation();
                    result.Add("status", SENSOR_STATUS_OK);
                    switch (_screenOrientation)
                    {
                    case SimpleOrientation.Faceup:
                        result.Add("deviceorientation_value", NORMAL);
                        break;

                    case SimpleOrientation.Rotated180DegreesCounterclockwise:
                        result.Add("deviceorientation_value", UPSIDE_DOWN);
                        break;

                    case SimpleOrientation.Rotated90DegreesCounterclockwise:
                        result.Add("deviceorientation_value", LANDSCAPE_RIGHT);
                        break;

                    case SimpleOrientation.Rotated270DegreesCounterclockwise:
                        result.Add("deviceorientation_value", LANDSCAPE_LEFT);
                        break;

                    default:
                        result.Add("deviceorientation_value", NORMAL);
                        break;
                    }

                    result.Add("type", type);
                }
                catch (Exception e) {
                    _screenOrientation = SimpleOrientation.Faceup;
                    result.Add("status", SENSOR_STATUS_ERROR);
                    result.Add("message", e.Message);
                }


                oResult.set(result);
            }