Exemple #1
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     player.Stop();
     isPaused = true;
     if (isFullScreen)
     {
         GoFullscreen(false);
     }
 }
Exemple #2
0
        // TODO Check why this is claiming that it's functioning on a different thread yet no thread is made when calling this? Finding this out will determine if the Invokes remain
        public WallpaperForm(Screen monitor, IntPtr workerw)
        {
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            InitializeComponent();

            Load += (s, e) =>
            {
                this.Invoke((MethodInvoker) delegate
                {
                    BackColor = Color.Black;

                    // Sets bounds of the form
                    Width            = monitor.Bounds.Width;
                    Height           = monitor.Bounds.Height;
                    Left             = monitor.Bounds.X + DisplayData.DisplayXAdjustment;
                    Top              = monitor.Bounds.Y + DisplayData.MinDisplayY;
                    pictureBoxBounds = new Rectangle(0, 0, Width, Height);

                    // Sets bounds of the wallpaper
                    pictureBoxWallpaper.Bounds = pictureBoxBounds;
                    panelWallpaper.Bounds      = pictureBoxBounds;

                    // Initializes player
                    player = new MpvPlayer(panelWallpaper.Handle) // handle tells the player to draw itself onto the panelWallpaper
                    {
                        AutoPlay = true,
                        Loop     = true
                    };
                    player.MediaEndedSeeking += (sender, args) => Loops++;

                    ResetWallpaperStyle();

                    // This line makes the form a child of the WorkerW window, thus putting it behind the desktop icons and out of reach
                    // for any user input. The form will just be rendered, no keyboard or mouse input will reach it.
                    // (Would have to use WH_KEYBOARD_LL and WH_MOUSE_LL hooks to capture mouse and keyboard input)
                    Win32.SetParent(Handle, workerw);
                });
            };

            Closing += (s, e) =>
            {
                Controls.Remove(pictureBoxWallpaper);

                player.Stop();

                /*! //the below caused an assertion failed error
                 * await Task.Delay(1000).ConfigureAwait(false);
                 * player.Dispose();
                 */

                Controls.Remove(panelWallpaper);
            };
        }
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            Channels channels = Channels.Get();

            if (chList.SelectedItems.Count > 0)
            {
                ListViewItem item    = chList.SelectedItems[0];
                ChannelInfo  channel = channels.GetChannel(int.Parse(item.SubItems[0].Text));
                if (channel == null)
                {
                    MessageBox.Show(item.SubItems[1].Text);
                }
                else
                {
                    player.Stop();
                    isChannel = channel.ChannelType == ChType.CHANNEL;

                    isPaused = false;
                    Thread.Sleep(500);
                    player.Load(channel.URL);
                    try
                    {
                        string        chName = channel.TVGName.Length < 100 ? channel.TVGName : channel.TVGName.Substring(0, 99);
                        Task <string> stats  = Utils.GetAsync("" + chName);
                    } catch (Exception ex)
                    {
                        Console.WriteLine("HATA GÖNDERME İSTATİSTİKLERİ");
                    }

                    logoChannel.LoadCompleted -= logoLoaded;

                    logoChannel.Image = Image.FromFile("./resources/images/nochannel.png");
                    if (!string.IsNullOrEmpty(channel.TVGLogo))
                    {
                        logoChannel.LoadAsync(channel.TVGLogo);
                        logoChannel.LoadCompleted += logoLoaded;
                    }

                    string title = channel.Title;
                    if (title.Length > 20)
                    {
                        title = title.Substring(0, 20) + "...";
                    }
                    lbChName.Text  = title;
                    currentChannel = channel;
                    currentChType  = channel.ChannelType;
                    SetEPG(channel);
                }
            }
        }
Exemple #4
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                player.Stop();
                Close();
                break;

            case Keys.T:
                TopMost = !TopMost;
                break;

            case Keys.Add:
            case Keys.VolumeUp:
                if (player.Volume + OFFSET < 1)
                {
                    player.Volume += OFFSET;
                }
                break;

            case Keys.Subtract:
            case Keys.VolumeDown:
                if (player.Volume - OFFSET > 0)
                {
                    player.Volume -= OFFSET;
                }
                break;
            }
        }
        bool CloseProject()
        {
            var projectFilename = Path.GetFileName(project.FileName);

            if (project.UnsavedChanges && Dialogs.SaveChanges(projectFilename) == MessageBoxResult.Cancel)
            {
                return(false);
            }

            var editTrack = timeline.Tracks[1];
            var refTrack  = timeline.Tracks[0];

            player.Stop();
            player.PlaylistClear();
            project = new Project();
            LoadSubtitles(project, timeline);
            LoadRefSubtitles(project, timeline);
            viewModel.ActiveItem = null;
            Title = GetTitle(project, listView.SelectedIndex);
            return(true);
        }
Exemple #6
0
 private void ButtonStopOnClick(object sender, RoutedEventArgs e)
 {
     player.Stop();
 }