Ejemplo n.º 1
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            UpdateUserList();

            if (Request.QueryString["id"] != null && Request.QueryString["id"].ToString() != "")
            {
                new LogEntry(Log.Debug)
                {
                    text = "Manage_Media userId = " + Request.QueryString["id"].ToString()
                };
                selectedUserId = Convert.ToInt16(Request.QueryString["id"]);

                SelectUser.SelectedValue = selectedUserId.ToString();


                foreach (MediaControl temp in MediaControl.GetUserMediaAsMediaControls(selectedUserId, myUser.Id))
                {
                    DisplayPhotosDiv.Controls.Add(temp);
                }
            }
            else
            {
                if (Request.QueryString["id"] == null)
                {
                    Response.Redirect("manage_media?id=0");
                }
            }
        }
Ejemplo n.º 2
0
 protected void Page_LoadComplete(object sender, EventArgs e)
 {
     foreach (MediaControl mc in MediaControl.GetAlbumAsMediaControls(VideoMediaTag))
     {
         DynamicMediaDiv.Controls.Add(mc);
     }
 }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MOTD_div.InnerHtml = ConfigurationManager.AppSettings["MOTD"];

            myUser = ParsnipData.Accounts.User.LogIn();
            if (string.IsNullOrEmpty(Data.DeviceType))
            {
                Response.Redirect("get_device_info?url=home");
            }

            if (myUser == null)
            {
                PleaseLogin.Visible = true;
            }
            else
            {
                MyMediaTitle.Visible = true;
                WelcomeLabel.Text    =
                    string.Format($"Hiya {myUser.Forename}, welcome back!");

                UploadMediaControl.Initialise(myUser, this);

                foreach (MediaControl mediaControl in MediaControl.GetUserMediaAsMediaControls(myUser.Id, myUser.Id))
                {
                    DynamicMediaDiv.Controls.Add(mediaControl);
                }
            }

            new LogEntry(Log.Debug)
            {
                text = string.Format("The home page was accessed by {0} from {1} {2} device.",
                                     myUser == null ? "someone who was not logged in" : myUser.Forename,
                                     myUser == null ? "their" : myUser.PosessivePronoun, Data.DeviceType)
            };
        }
Ejemplo n.º 4
0
 public void GetAlbumArtAsync(MediaControl.Client.Console.MediaLibrary.Track track,
     Action<byte[], object> callback, object state)
 {
     Pair<Action<byte[], object>, object> pair =
         new Pair<Action<byte[], object>, object>(callback, state);
     LibraryServiceClient.GetAlbumArtAsync(new GetAlbumArtRequest(track), pair);
 }
Ejemplo n.º 5
0
 private void Media_VolUp_OnClick(object sender, RoutedEventArgs e)
 {
     if (Model.IsServer)
     {
         MediaControl.VolumeUp();
     }
     else
     {
         NetworkCommunicator.SendAsync(new HarmonyPacket()
         {
             Type = HarmonyPacket.PacketType.KeyBoardPacket,
             Pack = new HarmonyPacket.KeyboardPacket()
             {
                 Key    = Keys.VolumeUp,
                 wParam = 256
             }
         });
         NetworkCommunicator.SendAsync(new HarmonyPacket()
         {
             Type = HarmonyPacket.PacketType.KeyBoardPacket,
             Pack = new HarmonyPacket.KeyboardPacket()
             {
                 Key    = Keys.VolumeUp,
                 wParam = 257
             }
         });
     }
 }
Ejemplo n.º 6
0
 public void SetOverlayData(GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties)
 {
     lblTitle.Content  = mediaProperties.Title;
     lblArtist.Content = mediaProperties.Artist + " • " + mediaProperties.AlbumTitle;
     imgAlbum.Source   = CropBitmapImage(MediaControl.GetBitmapImageFromStream(mediaProperties.Thumbnail));
     imgAlbum.Stretch  = Stretch.UniformToFill;
 }
Ejemplo n.º 7
0
        static void Main()
        {
            gXMLProcess = new xmlDataProcess();
            xmlConfigStart(false);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            mMainSystemManagerForm = new MainSystemManagerForm();
            mNetworkSystemProcess  = new NetworkSystemProcess(mMainSystemManagerForm,
                                                              gXMLDataConfig.mSystemManager.controlServerPort);
            mNetworkSystemProcess.startServer();
            mNetworkSystemProcess.NetworkDataReceivedHandler += NetworkDataReceivedHandler;
            ntTest = new networkTestUtil();

            mLogProc = new LogProcess(gXMLDataConfig.mSystemManager.saveLogfile, mMainSystemManagerForm);

            listener = new Listener(gXMLDataConfig.mSystemManager.NetworkManagerServerPort);
            listener.SocketAccepted += new Listener.SocketAcceptedHandler(listener_SocketAccepted);

            listener.Start("0.0.0.0");

            mMediaControl = new MediaControl();
            string url = gXMLDataConfig.mSystemManager.audioFile;

            mMediaControl.Open(url);

            mLogProc.DebugLog("System Start");
            Application.Run(mMainSystemManagerForm);
        }
Ejemplo n.º 8
0
        private static WorkStatus WorkUntilCanAttach(object arg, WorkItem workItem)
        {
            WorkStatus   result        = WorkStatus.NotDone;
            ProcessProxy processProxy  = (ProcessProxy)arg;
            Process      remoteProcess = processProxy.RemoteProcess;

            try
            {
                if (remoteProcess != null)
                {
                    remoteProcess.Refresh();
                    if (!remoteProcess.HasExited)
                    {
                        if (!MediaControl.CanAttach(new SelectProcessArgs(processProxy.RemoteProcess, processProxy.CLRVersion)))
                        {
                            Thread.Sleep(500);
                            return(result);
                        }
                        return(WorkStatus.Done);
                    }
                    return(WorkStatus.Error);
                }
                return(WorkStatus.Error);
            }
            catch (Exception)
            {
                return(WorkStatus.Error);
            }
        }
Ejemplo n.º 9
0
 public static async Task Init(Settings settings)
 {
     if (string.IsNullOrEmpty(settings.RootPath))
     {
         return;
     }
     try
     {
         Helper.CurrentFolder = await StorageFolder.GetFolderFromPathAsync(settings.RootPath);
     }
     catch (FileNotFoundException)
     {
         App.LoadedListeners.Add(() =>
         {
             MainPage.Instance.ShowLocalizedNotification("RootNotFound");
             MainPage.Instance.NavigateToPage(typeof(SettingsPage));
         });
     }
     catch (Exception)
     {
     }
     MediaControl.AddMusicModifiedListener((before, after) =>
     {
         settings.FindAllMusicAndOperate(before, music => music.CopyFrom(after));
     });
     foreach (var item in await ApplicationData.Current.LocalFolder.GetItemsAsync())
     {
         if (item.Name.EndsWith(".TMP") || item.Name.EndsWith(".~tmp"))
         {
             await item.DeleteAsync();
         }
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 清除组件内部资源
 /// </summary>
 /// <param name="layout"></param>
 /// <param name="SourcePath"></param>
 /// <param name="Region"></param>
 public static UIElement DisposeResource(this UIElement uIElement)
 {
     uIElement.Dispatcher.Invoke(new Action(() =>
     {
         if (uIElement is MediaControl)
         {
             MediaControl mediaControl = uIElement as MediaControl;
             if (mediaControl != null)
             {
                 mediaControl.Dispose();
                 mediaControl = null;
             }
         }
         else if (uIElement is Image)
         {
             Image image = uIElement as Image;
             if (image != null)
             {
                 image = null;
             }
         }
         else if (uIElement is ChromiumWebBrowser)
         {
             ChromiumWebBrowser chromiumWebBrowser = uIElement as ChromiumWebBrowser;
             if (chromiumWebBrowser != null)
             {
                 chromiumWebBrowser.Dispose();
             }
             chromiumWebBrowser = null;
         }
     }));
     return(uIElement);
 }
Ejemplo n.º 11
0
        void MediaControl_MediaOpened(object sender, System.Windows.RoutedEventArgs e)
        {
            if (!MediaControl.NaturalDuration.HasTimeSpan)
            {
                MediaControl.Pause();

                BackgroundWorker bwImageDelay = new BackgroundWorker()
                {
                    WorkerSupportsCancellation = true
                };
                bwImageDelay.DoWork += (bs, barg) =>
                {
                    System.Threading.Thread.Sleep(new TimeSpan(0, 0, 30));
                };

                bwImageDelay.RunWorkerCompleted += (bs, barg) =>
                {
                    if (!MediaControl.NaturalDuration.HasTimeSpan)
                    {
                        Load_New_Media();
                    }
                };
                bwImageDelay.RunWorkerAsync();
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 一時停止
 /// </summary>
 public void Pause()
 {
     CheckAlive();
     Status = GraphState.Paused;
     MediaControl.Pause();
     if (MediaPause != null)
     {
         MediaPause(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 再生
 /// </summary>
 public void Play()
 {
     CheckAlive();
     Status = GraphState.Playing;
     MediaControl.Run();
     if (MediaStart != null)
     {
         MediaStart(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 14
0
 public MainWindow()
 {
     InitializeComponent();
     Window = this;
     Log($"The IP-Address of this machine is { NetworkCommunicator.GetLocalIPAddress() }", false);
     DisplayManager.SetUp();
     Model = (HarmonyViewModel)DataContext;
     VersionLabel.Content = "Harmony-Version: " + typeof(MainWindow).Assembly.GetName().Version;
     MediaControl.Reload();
     MediaControl.UpdateMediaProperties();
 }
Ejemplo n.º 15
0
        public AbstractControl()
        {
            Central = new GameCore();

            //Primeira versão do controle de músicas
            GameSong = new MediaControl(new List <Database.Models.MusicModel>()
            {
                new Database.Models.MusicModel(@"\Songs\shake_it_off.mp3", "Shake It Off"),
                new Database.Models.MusicModel(@"\Songs\echame_la_culpa.mp3", "Echame La Culpa")
            });
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Clean up stuff
 /// </summary>
 public void Dispose()
 {
     if (MediaControl != null)
     {
         MediaControl.Stop();
     }
     //debug
     if (rot != null)
     {
         rot.Dispose();
         rot = null;
     }
 }
Ejemplo n.º 17
0
 public void Load_New_Media()
 {
     try
     {
         MediaControl.Stop();
         MediaControl.Source = new Uri(getrandomfile2(@"C:\Queuing System\Media\"));
         MediaControl.Play();
     }
     catch
     {
         Load_New_Media();
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// 停止
        /// </summary>
        public void Stop()
        {
            CheckAlive();
            Status = GraphState.Stopped;
            MediaControl.Stop();
            long pos = 0;

            MediaSeeking.SetPositions(ref pos, AMSeekingSeekingFlags.AbsolutePositioning, ref pos, AMSeekingSeekingFlags.NoPositioning);
            MediaControl.StopWhenReady();
            if (MediaStop != null)
            {
                MediaStop(this, EventArgs.Empty);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 增加media组件
        /// </summary>
        /// <param name="layout"></param>
        /// <param name="SourcePath"></param>
        /// <param name="Region"></param>
        public static UIElement AddMediaComponent(this Canvas layout, string SourcePath, ProgramRegion Region, bool Visible = true)
        {
            MediaControl mediaControl = new MediaControl();

            mediaControl.mediaUri = new Uri(SourcePath);
            Canvas.SetLeft(mediaControl, Region.x);
            Canvas.SetTop(mediaControl, Region.y);
            mediaControl.Width      = Region.w;
            mediaControl.Height     = Region.h;
            mediaControl.Visibility = Visible == true ? Visibility.Visible : Visibility.Hidden;
            layout.Children.Add(mediaControl);
            mediaControl.LoadMedia();
            return(mediaControl);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            //string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName);
            //string title = "Previous";

            //// Show a message box to prove we were here
            //VsShellUtilities.ShowMessageBox(
            //    this.ServiceProvider,
            //    message,
            //    title,
            //    OLEMSGICON.OLEMSGICON_INFO,
            //    OLEMSGBUTTON.OLEMSGBUTTON_OK,
            //    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            MediaControl.Previous();
        }
Ejemplo n.º 21
0
 protected void Page_LoadComplete(object sender, EventArgs e)
 {
     if (myTagUser == null)
     {
         foreach (MediaControl mediaControl in MediaControl.GetAlbumAsMediaControls(myTag))
         {
             DynamicMediaDiv.Controls.Add(mediaControl);
         }
     }
     else
     {
         foreach (MediaControl mediaControl in MediaControl.GetMediaUserPairAsMediaControls(myTagUser.Id))
         {
             DynamicMediaDiv.Controls.Add(mediaControl);
         }
     }
 }
        public MediaControlViewModelBase(ILoggerFacade loggerFacade,
                                         IHorsifyMediaController horsifyMediaController,
                                         IEventAggregator eventAggregator, MediaControl mediaControlModel)
            : base(loggerFacade)
        {
            _eventAggregator        = eventAggregator;
            _horsifyMediaController = horsifyMediaController;

            MediaControlModel = mediaControlModel;

            #region Commands
            PlayPauseCommand      = new DelegateCommand(OnPlayPause);
            SeekingStartedCommand = new DelegateCommand <object>(OnSeekStarted);
            SeekingStoppedCommand = new DelegateCommand <object>(OnSeekStopped);
            StopCommand           = new DelegateCommand(OnStopped);
            #endregion
        }
Ejemplo n.º 23
0
 private void Media_Reload_OnClick(object sender, RoutedEventArgs e)
 {
     if (Model.IsServer)
     {
         MediaControl.Reload();
     }
     else
     {
         NetworkCommunicator.SendAsync(new HarmonyPacket()
         {
             Type = HarmonyPacket.PacketType.MediaControl,
             Pack = new HarmonyPacket.MediaControlPacket()
             {
                 Action = HarmonyPacket.MediaControlPacket.MediaAction.Reload
             }
         });
     }
 }
Ejemplo n.º 24
0
        private void OnTimeChanged(MediaControl mediaControlModel, TimeSpan currentTime)
        {
            if (!mediaControlModel.IsSeeking)
            {
                if (MediaControlModel.IsPlaying)
                {
                    MediaControlModel.CurrentSongPosition = currentTime;

                    if (_justSeeked)
                    {
                        _justSeeked = false;
                        _discordRpcService.SetPrecense(
                            $"Year: {_previousSong.Year} | Rated: {_previousSong.Rating} | Genre: {_previousSong.Genre} | Bpm:{_previousSong.Bpm} | Key: {_previousSong.MusicKey}",
                            $"{_previousSong.Artist} - {_previousSong.Title}",
                            (int)MediaControlModel.CurrentSongTime.TotalSeconds, (int)MediaControlModel.CurrentSongPosition.TotalSeconds);
                    }
                }
            }
        }
Ejemplo n.º 25
0
        public MediaForm(string url, MediaControl mediaControl)
        {
            InitializeComponent();

            _mediaControl = mediaControl;

            switch (mediaControl)
            {
            case MediaControl.Audio:
                mediaWebBrowser.DocumentText = @"
               <!DOCTYPE html>
               <html lang='en'>
               <head>
                   <meta http-equiv='X-UA-Compatible' content='IE=Edge,chrome=IE8'/>
               </head>
               <body>
                  <audio id='mediaObject' controls='controls'>
                     <source src='" + url + @"'>
                  </audio>
               </body>
               </html>";
                this.Size = new Size(650, 100);
                break;

            case MediaControl.Video:
                mediaWebBrowser.DocumentText = @"
               <!DOCTYPE html>
               <html lang='en'>
               <head>
                   <meta http-equiv='X-UA-Compatible' content='IE=Edge,chrome=IE8' />
               </head>
               <body>
                  <video id='mediaObject' controls='controls'>
                     <source src='" + url + @"'>
                  </video>
               </body>
               </html>";
                this.Size = new Size(650, 400);
                break;
            }
        }
Ejemplo n.º 26
0
        void MainEvent_OnDataConfirm(object obj)
        {
            if (obj != null)
            {
                if (((BOL.Task.objTask)obj).terminal_id == null)
                {
                    switch (((BOL.Task.objTask)obj).type)
                    {
                    case BOL.Task.objTask.MessageType.ChangeMedia:
                        Load_New_Media();
                        break;

                    case BOL.Task.objTask.MessageType.Play:
                        MediaControl.Play();
                        break;

                    case BOL.Task.objTask.MessageType.Pause:
                        MediaControl.Pause();
                        break;

                    case BOL.Task.objTask.MessageType.Mute:
                        MediaControl.IsMuted = true;
                        break;

                    case BOL.Task.objTask.MessageType.Unmute:
                        MediaControl.IsMuted = false;
                        break;

                    case BOL.Task.objTask.MessageType.LoadTerminals:
                        Update_Terminal_List();
                        break;

                    default:
                        //nothing
                        break;
                    }
                    ;
                }
            }
        }
Ejemplo n.º 27
0
        private void DoSearch(string searchTerm)
        {
            var searchResults = Media.Search(searchTerm, myUser.Id);

            MediaTitle.InnerText = searchResults.Media.Count > 0 ? "Content found:" : "No content was found using those search terms :(";


            TagsTitle.InnerText = (searchResults.MediaTags.Count > 0 || searchResults.Users.Count > 0) ? "Tags found:" : "No tags were found using those search terms :(";

            Page httpHandler = (Page)HttpContext.Current.Handler;
            List <ViewTagControl> ViewTagControls = new List <ViewTagControl>();

            foreach (MediaTag mediaTag in searchResults.MediaTags)
            {
                ViewTagControl mediaTagPairViewControl = (ViewTagControl)httpHandler.LoadControl("~/Custom_Controls/Media/ViewTagControl.ascx");
                mediaTagPairViewControl.MyTag = mediaTag;
                mediaTagPairViewControl.UpdateLink();
                MediaTagContainer.Controls.Add(mediaTagPairViewControl);
                ViewTagControls.Add(mediaTagPairViewControl);
            }

            foreach (ParsnipData.Accounts.User user in searchResults.Users)
            {
                ViewTagControl mediaUserPairViewControl = (ViewTagControl)httpHandler.LoadControl("~/Custom_Controls/Media/ViewTagControl.ascx");
                mediaUserPairViewControl.MyUser = user;
                mediaUserPairViewControl.UpdateLink();
                MediaTagContainer.Controls.Add(mediaUserPairViewControl);
                ViewTagControls.Add(mediaUserPairViewControl);
            }

            foreach (ViewTagControl control in ViewTagControls.OrderBy(x => x.Name))
            {
                MediaTagContainer.Controls.Add(control);
            }

            foreach (var mediaControl in MediaControl.GetMediaSearchResultAsMediaControls(searchResults))
            {
                MediaContainer.Controls.Add(mediaControl);
            }
        }
Ejemplo n.º 28
0
        public override void SetCurrentPosition(long time)
        {
            if (IsGraphSeekable)
            {
                var state = GraphState;
                PauseGraph();
                long pStop = 0;
                MediaSeeking.SetPositions(ref time, SeekingFlags.AbsolutePositioning, ref pStop, SeekingFlags.NoPositioning);

                switch (state)
                {
                case GraphState.Running:
                    ResumeGraph();
                    break;

                case GraphState.Stopped:
                    MediaControl.Stop();
                    GraphState = GraphState.Stopped;
                    break;
                }
            }
        }
Ejemplo n.º 29
0
        private void LrcUpdateTimer_Tick(object sender, object e)
        {
            var thistime = MediaControl.GetCurrent().Position.TotalMilliseconds;
            var time     = TimeSpan.FromMilliseconds(thistime);

            for (int i = 0; i < LrcTimeLines.Count; i++)
            {
                if (time.CompareTo(LrcTimeLines[i]) == 1)
                {
                    if (LrcNowText != null)
                    {
                        LrcNowText.Text = (LrcData.LrcWord.Values.ToList())[i];
                    }
                    foreach (var item in lrcdatapanel.Children)
                    {
                        ((TextBlock)item).Style = (Style)Resources["unlrcview"];
                    }
                    var text = lrcdatapanel.Children[i] as TextBlock;
                    text.Style = (Style)Resources["islrcview"];
                }
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Actualy run the graph
 /// </summary>
 private void RunGraph()
 {
     try
     {
         Running = true;
         while (Running)
         {
             Thread.Sleep(500);
             EventCode ev;
             IntPtr    p1, p2;
             Application.DoEvents();
             while (MediaEvent.GetEvent(out ev, out p1, out p2, 0) == 0)
             {
                 if (ev == EventCode.Complete || ev == EventCode.UserAbort || ev == EventCode.ErrorAbort)
                 {
                     if (ev == EventCode.ErrorAbort)
                     {
                         string msg = DecodeHrResult((uint)p1.ToInt64());
                         Program.LogError("ERROR: HRESULT={0:X} {1}", p1, msg);
                         Trace("ERROR: HRESULT={0:X} {1}", p1, msg);
                     }
                     MediaControl.Stop();
                     Running = false;
                     Trace("Done!");
                     Program.LogSuccess("Done!");
                 }
                 MediaEvent.FreeEventParams(ev, p1, p2);
             }
         }
         Graph.Abort();
         Trace("Graph Closed");
     }
     catch (Exception ex)
     {
         ExceptionHelper.HandleException(ex);
         Trace("ERROR: Running Graph");
     }
 }
Ejemplo n.º 31
0
        private void showMusic(string fName, string propName)
        {
            RowDefinition _row = _panelParent.RowDefinitions[_panelParent.RowDefinitions.Count - 1];

            _row.Height = new GridLength(820);

            MediaControl md = new MediaControl();

            Grid.SetColumn(md, 0);
            Grid.SetColumnSpan(md, 2);
            md.Margin = new Thickness(0, 2, 0, 0);
            Grid.SetRow(md, _panelParent.RowDefinitions.Count - 1);
            var template = (ControlTemplate)_View.Resources["validationErrorTemplate"];

            Validation.SetErrorTemplate(md, template);
            md.VerticalAlignment   = VerticalAlignment.Bottom;
            md.HorizontalAlignment = HorizontalAlignment.Stretch;
            md.Foreground          = Brushes.White;
            md.MediaSource         = new Uri(Config.GamePath + "\\" + fName, UriKind.Absolute);
            uiElementMap[propName] = md;

            _panelParent.Children.Add(md);
        }
Ejemplo n.º 32
0
 protected override void Load( byte[] payload )
 {
     Command = Util.GetEnum<MediaControl>(payload[0]);
 }