コード例 #1
0
 async void PlayMedia()
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         Video1.Play();
     });
 }
コード例 #2
0
    void Start()
    {
        // 1- GameObject.Find - Searching for GameObjects in our scene
        GameObject item1GameObject = GameObject.Find("Item1");

        // 2- GameObject.FindGameObjectsWithTag - Searching objects with a specific tag
        GameObject[] items = GameObject.FindGameObjectsWithTag("Item");
        foreach (GameObject item in items)
        {
            Debug.Log(item.name);
        }
        // 3- GameObject.FindObjectOfType - Searching objects of type
        Video1     video1           = GameObject.FindObjectOfType <Video1>();
        GameObject video1GameObject = video1.gameObject;

        Debug.Log(video1GameObject.name);

        // 4- GameObject.CreatePrimitive Create primitives (cube)
        GameObject cubeGameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);

        // 5- GameObject.CreatePrimitive Create primitives (capsule)
        GameObject capsuleGameObject = GameObject.CreatePrimitive(PrimitiveType.Capsule);

        capsuleGameObject.transform.transform.localScale    = new Vector3(2, 2, 2);
        capsuleGameObject.transform.transform.localPosition = new Vector3(2, 2, 2);

        // 6- GameObject.Instantiate to create a 3D model based on a prefab
        GameObject enemyPrefab = Instantiate(gameObjectPrefab, new Vector3(4, 4, 4), Quaternion.identity);

        // 7- GameObject.Destroy destroying a game object
        if (destroyEnemyOnLoad)
        {
            Destroy(enemyPrefab);
        }
    }
コード例 #3
0
        async public void ChangeSource()
        {
            var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

            openPicker.FileTypeFilter.Add(".wmv");
            openPicker.FileTypeFilter.Add(".mp4");
            openPicker.FileTypeFilter.Add(".wma");
            openPicker.FileTypeFilter.Add(".mp3");

            file = await openPicker.PickSingleFileAsync();

            openPicker.ViewMode = PickerViewMode.Thumbnail;
            openPicker.SuggestedStartLocation = PickerLocationId.Desktop;


            // video1 is a MediaElement defined in XAML
            if (null != file)
            {
                var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);

                Video1.SetSource(stream, file.ContentType);
                Songinfo.Text = file.DisplayName;
                Video1.Play();
            }
        }
コード例 #4
0
        private async void NextSong()
        {
            x++;
            var file = playlist[x];

            if (file == null)
            {
                x    = 0;
                file = playlist[x];
                var properties = await file.Properties.GetMusicPropertiesAsync();

                if (file != null)
                {
                    var stream = await file.OpenAsync(FileAccessMode.Read);

                    Songinfo.Text = file.DisplayName;
                    // mediaControl is a MediaElement defined in XAML
                    Video1.SetSource(stream, file.ContentType);
                }
            }
            else
            {
                var properties = await file.Properties.GetMusicPropertiesAsync();

                if (file != null)
                {
                    var stream = await file.OpenAsync(FileAccessMode.Read);

                    Songinfo.Text = file.DisplayName;
                    // mediaControl is a MediaElement defined in XAML
                    Video1.SetSource(stream, file.ContentType);
                }
            }
        }
コード例 #5
0
ファイル: Models.cs プロジェクト: cosmicflutterfish/WebAPI
        public async Task DeleteVideoAsync(CTDbContext context)
        {
            if (Video1 != null)
            {
                await Video1.DeleteFileRecordAsync(context);
            }
            if (Video2 != null)
            {
                await Video2.DeleteFileRecordAsync(context);
            }
            if (ProcessedVideo1 != null)
            {
                await ProcessedVideo1.DeleteFileRecordAsync(context);
            }
            if (ProcessedVideo2 != null)
            {
                await ProcessedVideo2.DeleteFileRecordAsync(context);
            }
            if (Audio != null)
            {
                await Audio.DeleteFileRecordAsync(context);
            }
            var dbVideoRow = await context.Videos.FindAsync(Id);

            if (dbVideoRow != null)
            {
                context.Videos.Remove(dbVideoRow);
                await context.SaveChangesAsync();
            }
        }
コード例 #6
0
        async private void Previous1Song_Click(object sender, RoutedEventArgs e)
        {
            x--;
            if (x < 0)
            {
                x = 0;
                var file       = playlist[x];
                var properties = await file.Properties.GetMusicPropertiesAsync();

                if (file != null)
                {
                    var stream = await file.OpenAsync(FileAccessMode.Read);

                    Songinfo.Text = file.DisplayName;
                    // mediaControl is a MediaElement defined in XAML
                    Video1.SetSource(stream, file.ContentType);
                }
            }
            else
            {
                var file       = playlist[x];
                var properties = await file.Properties.GetMusicPropertiesAsync();

                if (file != null)
                {
                    var stream = await file.OpenAsync(FileAccessMode.Read);

                    Songinfo.Text = file.DisplayName;
                    // mediaControl is a MediaElement defined in XAML
                    Video1.SetSource(stream, file.ContentType);
                }
            }
        }
コード例 #7
0
        async private void AddSong_Click(object sender, RoutedEventArgs e)
        {
            var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

            openPicker.FileTypeFilter.Add(".wmv");
            openPicker.FileTypeFilter.Add(".mp4");
            openPicker.FileTypeFilter.Add(".wma");
            openPicker.FileTypeFilter.Add(".mp3");

            StorageFile file = await openPicker.PickSingleFileAsync();

            openPicker.ViewMode = PickerViewMode.Thumbnail;
            openPicker.SuggestedStartLocation = PickerLocationId.Desktop;


            // video1 is a MediaElement defined in XAML
            if (null != file)
            {
                var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);

                playlist[i] = file;
                int b = i + 1;
                PlaylistSongs.Text += "\n" + b.ToString() + ") " + playlist[i].DisplayName;
                Songinfo.Text       = file.DisplayName;
                // mediaControl is a MediaElement defined in XAML
                Video1.SetSource(stream, file.ContentType);
                i++;
            }
        }
 private void Image1FadeOut_Completed(object sender, EventArgs e)
 {
     AnimatedImage1.Source = null;
     AnimatedImage1.UpdateLayout();
     Video1.Source = null;
     Video1.UpdateLayout();
     GC.Collect();
 }
コード例 #9
0
        async public void ChangeSource()
        {
            var openPicker = new Windows.Storage.Pickers.FileOpenPicker();

            openPicker.FileTypeFilter.Add(".wmv");
            openPicker.FileTypeFilter.Add(".mp4");
            openPicker.FileTypeFilter.Add(".wma");
            openPicker.FileTypeFilter.Add(".mp3");

            //file = await openPicker.PickSingleFileAsync();
            openPicker.ViewMode = PickerViewMode.Thumbnail;
            openPicker.SuggestedStartLocation = PickerLocationId.Desktop;


            var files = await openPicker.PickMultipleFilesAsync();

            if (files.Count > 0)
            {
                // Application now has read/write access to the picked file(s)
                foreach (Windows.Storage.StorageFile file1 in files)
                {
                    var stream = await file1.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);

                    Video1.SetSource(stream, file1.ContentType);
                    playlist[i]   = file1;
                    Songinfo.Text = file1.DisplayName;
                    int n = i + 1;
                    PlaylistSongs.Text += "\n" + n.ToString() + ") " + playlist[i].DisplayName;
                    i++;
                }
            }
            else
            {
                Songinfo.Text = "Operation cancelled.";
            }

            // video1 is a MediaElement defined in XAML
            //if (null != file)
            //{
            //    var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.ReadWrite);
            //    Video1.SetSource(stream, file.ContentType);
            //    playlist[i] = file;
            //    Songinfo.Text = file.DisplayName;
            //    PlaylistSongs.Text += "\n" + "1" + ") " + playlist[i].DisplayName;
            //    i++;
            //    Video1.Play();
            //}
        }
コード例 #10
0
        public FilmAFull()
        {
            InitializeComponent();
            this.WindowStyle        = WindowStyle.None;
            this.WindowState        = WindowState.Maximized;
            ControlPanel.Visibility = Visibility.Hidden;
            // Film jeden = new Film(1, @"C:\Users\Marcin\source\repos\EduAppProba\Grafiki\Dopalacze1_Wplyw_WERSJA2popr2-Ramsar_3000.mp4", "jedynka");
            //Video1.Source = new Uri(jeden.FilmAdress);
            Video1.Play();
            //Video1.Stop();
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            Video1.MouseDown += new MouseButtonEventHandler(video1_MouseMove);
        }
コード例 #11
0
        public FilmA()
        {
            InitializeComponent();
            // Film jeden = new Film(1, @"C:\Users\Marcin\source\repos\EduAppProba\Grafiki\Dopalacze1_Wplyw_WERSJA2popr2-Ramsar_3000.mp4", "jedynka");
            //Video1.Source = new Uri(jeden.FilmAdress);
            Video1.Play();
            Video1.Stop();
            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
            Klik.ImageSource       = new ImageSourceConverter().ConvertFromString(ZbiorDanych.IkonyProgramu[3].IkoAdress) as ImageSource;
            buttonFilm.Click      += new RoutedEventHandler(buttonFilm_Click);
            buttonFilm.MouseEnter += new MouseEventHandler(buttonFilm_MouseEnter);
            buttonFilm.MouseLeave += new MouseEventHandler(buttonFilm_MouseLeave);
            Menu_image.ImageSource = new ImageSourceConverter().ConvertFromString(ZbiorDanych.IkonyProgramu[8].IkoAdress) as ImageSource;
            Menu.MouseEnter       += new MouseEventHandler(menu_MouseEnter);
            Menu.MouseLeave       += new MouseEventHandler(menu_MouseLeave);
        }
コード例 #12
0
 private void Element_MediaEnded(object sender, EventArgs e)
 {
     Video1.Stop();
 }
コード例 #13
0
 private void btnStop_Click(object sender, RoutedEventArgs e)
 {
     Video1.Stop();
 }
コード例 #14
0
 private void btnPause_Click(object sender, RoutedEventArgs e)
 {
     Video1.Pause();
 }
コード例 #15
0
 private void btnPlay_Click(object sender, RoutedEventArgs e)
 {
     Video1.Play();
 }
コード例 #16
0
 private void btnPlay_Click(object sender, RoutedEventArgs e)
 {
     Video1.Play();
     ControlPanel.Visibility = Visibility.Hidden;
 }