コード例 #1
0
        private void updateDiscArray()
        {
            ArrayListDataSet discArray = new ArrayListDataSet();

            if (OMLApplication.Current.MediaChangers.HasMediaChangers)
            {
                foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs)
                {
                    DiscCommand discItem = new DiscCommand(this);
                    discItem.Description = disc.VolumeLabel;
                    discItem.Disc        = disc;
                    if (!string.IsNullOrEmpty(disc.Title))
                    {
                        discItem.Description = disc.Title;
                    }

                    discItem.Invoked += delegate(object discSender, EventArgs discArgs)
                    {
                        if (discSender is DiscCommand)
                        {
                            ((DiscCommand)discSender).Disc.Eject();
                        }
                    };
                    discArray.Add(discItem);
                }
            }
            this.DiscArray = discArray;
        }
コード例 #2
0
        // Methods
        public int Compare(object x, object y)
        {
            if ((x == null) && (y == null))
            {
                return(0);
            }
            if (x == null)
            {
                return(-1);
            }
            if (y == null)
            {
                return(1);
            }
            DiscCommand disc  = (DiscCommand)x;
            DiscCommand disc2 = (DiscCommand)y;

            if (disc.IsDrive != disc2.IsDrive)
            {
                if (!disc.IsDrive)
                {
                    return(1);
                }
                return(-1);
            }
            int num = string.Compare(disc.Type, disc2.Type, true, CultureInfo.CurrentUICulture);

            if (num == 0)
            {
                return(MediaChangeManagerHelper.StrCmpLogicalW(disc.SortingName, disc2.SortingName));
            }
            return(num);
        }
コード例 #3
0
 // Methods
 public int Compare(object x, object y)
 {
     if ((x == null) && (y == null))
     {
         return(0);
     }
     if (x != null)
     {
         if (y == null)
         {
             return(1);
         }
         DiscCommand disc  = (DiscCommand)x;
         DiscCommand disc2 = (DiscCommand)y;
         if (disc.IsDrive == disc2.IsDrive)
         {
             return(MediaChangeManagerHelper.StrCmpLogicalW(disc.SortingName, disc2.SortingName));
         }
         if (!disc.IsDrive)
         {
             return(1);
         }
     }
     return(-1);
 }
コード例 #4
0
        private void updateDiscArray()
        {
            ArrayListDataSet discArray = new ArrayListDataSet();
            if (OMLApplication.Current.MediaChangers.HasMediaChangers)
            {
                foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs)
                {
                    DiscCommand discItem = new DiscCommand(this);
                    discItem.Description = disc.VolumeLabel;
                    discItem.Disc = disc;
                    if (!string.IsNullOrEmpty(disc.Title))
                        discItem.Description = disc.Title;

                    discItem.Invoked += delegate(object discSender, EventArgs discArgs)
                    {
                        if (discSender is DiscCommand)
                        {
                            ((DiscCommand)discSender).Disc.Eject();
                        }
                    };
                    discArray.Add(discItem);
                }
            }
            this.DiscArray = discArray;
        }
コード例 #5
0
        public MediaChangerManagerPage()
        {
            this.managerCommands = new ArrayListDataSet(this);

            //save command
            Command rescanCmd = new Command();
            rescanCmd.Description = "Rescan Discs";
            rescanCmd.Invoked += new EventHandler(rescanCmd_Invoked);
            this.managerCommands.Add(rescanCmd);

            this.sortCommands = new Choice(this);
            ArrayListDataSet sortSet = new ArrayListDataSet();

            Command sortByName=new Command(this);
            sortByName.Description="Sort by Name";
            sortSet.Add(sortByName);

            Command sortByType = new Command(this);
            sortByType.Description = "Sort by Type";
            sortSet.Add(sortByType);

            this.sortCommands.Options = sortSet;
            this.SortCommands.ChosenChanged += new EventHandler(SortCommands_ChosenChanged);

            this.enableMediaChangers = new BooleanChoice(this, "Enable support for media changers");
            this.enableMediaChangers.Value = Properties.Settings.Default.MediaChangersEnabled;
            this.detectMediaChangers = new BooleanChoice(this, "Detect new discs added to your changer");
            this.detectMediaChangers.Value = Properties.Settings.Default.MediaChangersDetect;
            this.retrieveMetaData = new BooleanChoice(this, "Retrieve MetaData from Microsoft");
            this.retrieveMetaData.Value = Properties.Settings.Default.MediaChangersRetrieveMetaData;
            this.manageChangers = new Command(this);
            this.manageChangers.Description = "Manage Discs";
            this.manageChangers.Invoked += delegate(object changerSender, EventArgs changerArgs)
            {
                Dictionary<string, object> manageProperties = new Dictionary<string, object>();
                manageProperties["Page"] = this;
                manageProperties["Application"] = Library.OMLApplication.Current;
                Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_MediaChangerManagerPage", manageProperties);
            };

            this.commands = new ArrayListDataSet(this);

            //save command
            Command saveCmd = new Command();
            saveCmd.Description = "Save";
            saveCmd.Invoked += new EventHandler(saveCmd_Invoked);
            this.commands.Add(saveCmd);

            //cancel command
            Command cancelCmd = new Command();
            cancelCmd.Description = "Cancel";
            cancelCmd.Invoked += new EventHandler(cancelCmd_Invoked);
            this.commands.Add(cancelCmd);

            this.discArray = new ArrayListDataSet();
            if (OMLApplication.Current.MediaChangers.HasMediaChangers)
            {
                foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs)
                {
                    DiscCommand discItem = new DiscCommand(this);
                    discItem.Description = disc.VolumeLabel;
                    discItem.Disc = disc;
                    if (!string.IsNullOrEmpty(disc.Title))
                        discItem.Description = disc.Title;

                    discItem.Invoked += delegate(object discSender, EventArgs discArgs)
                    {
                        if(discSender is DiscCommand)
                        {
                            this.IsBusy = true;
                            Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(beginEject, endEject, (object)discSender);
                            //((DiscCommand)discSender).Disc.Eject();
                            //this.updateDiscArray();
                        }
                    };
                    this.discArray.Add(discItem);
                }
            }

            this.DiscManagerSort = DiscManagerSortType.Name;
            this.SortList();
            //for (int i = 0; i < 20; ++i)
            //{
            //    Command c = new Command(this);
            //    c.Description = string.Format("This is a very long description of a Test Disc {0}", i.ToString());
            //    this.discArray.Add(c);
            //}
            this.DetermineShowErrorMessage();
        }
コード例 #6
0
        public MediaChangerManagerPage()
        {
            this.managerCommands = new ArrayListDataSet(this);

            //save command
            Command rescanCmd = new Command();

            rescanCmd.Description = "Rescan Discs";
            rescanCmd.Invoked    += new EventHandler(rescanCmd_Invoked);
            this.managerCommands.Add(rescanCmd);

            this.sortCommands = new Choice(this);
            ArrayListDataSet sortSet = new ArrayListDataSet();

            Command sortByName = new Command(this);

            sortByName.Description = "Sort by Name";
            sortSet.Add(sortByName);

            Command sortByType = new Command(this);

            sortByType.Description = "Sort by Type";
            sortSet.Add(sortByType);

            this.sortCommands.Options        = sortSet;
            this.SortCommands.ChosenChanged += new EventHandler(SortCommands_ChosenChanged);


            this.enableMediaChangers        = new BooleanChoice(this, "Enable support for media changers");
            this.enableMediaChangers.Value  = Properties.Settings.Default.MediaChangersEnabled;
            this.detectMediaChangers        = new BooleanChoice(this, "Detect new discs added to your changer");
            this.detectMediaChangers.Value  = Properties.Settings.Default.MediaChangersDetect;
            this.retrieveMetaData           = new BooleanChoice(this, "Retrieve MetaData from Microsoft");
            this.retrieveMetaData.Value     = Properties.Settings.Default.MediaChangersRetrieveMetaData;
            this.manageChangers             = new Command(this);
            this.manageChangers.Description = "Manage Discs";
            this.manageChangers.Invoked    += delegate(object changerSender, EventArgs changerArgs)
            {
                Dictionary <string, object> manageProperties = new Dictionary <string, object>();
                manageProperties["Page"]        = this;
                manageProperties["Application"] = Library.OMLApplication.Current;
                Library.OMLApplication.Current.Session.GoToPage("resx://Library/Library.Resources/V3_MediaChangerManagerPage", manageProperties);
            };

            this.commands = new ArrayListDataSet(this);

            //save command
            Command saveCmd = new Command();

            saveCmd.Description = "Save";
            saveCmd.Invoked    += new EventHandler(saveCmd_Invoked);
            this.commands.Add(saveCmd);

            //cancel command
            Command cancelCmd = new Command();

            cancelCmd.Description = "Cancel";
            cancelCmd.Invoked    += new EventHandler(cancelCmd_Invoked);
            this.commands.Add(cancelCmd);

            this.discArray = new ArrayListDataSet();
            if (OMLApplication.Current.MediaChangers.HasMediaChangers)
            {
                foreach (DiscDataEx disc in OMLApplication.Current.MediaChangers.KnownDiscs)
                {
                    DiscCommand discItem = new DiscCommand(this);
                    discItem.Description = disc.VolumeLabel;
                    discItem.Disc        = disc;
                    if (!string.IsNullOrEmpty(disc.Title))
                    {
                        discItem.Description = disc.Title;
                    }

                    discItem.Invoked += delegate(object discSender, EventArgs discArgs)
                    {
                        if (discSender is DiscCommand)
                        {
                            this.IsBusy = true;
                            Microsoft.MediaCenter.UI.Application.DeferredInvokeOnWorkerThread(beginEject, endEject, (object)discSender);
                            //((DiscCommand)discSender).Disc.Eject();
                            //this.updateDiscArray();
                        }
                    };
                    this.discArray.Add(discItem);
                }
            }

            this.DiscManagerSort = DiscManagerSortType.Name;
            this.SortList();
            //for (int i = 0; i < 20; ++i)
            //{
            //    Command c = new Command(this);
            //    c.Description = string.Format("This is a very long description of a Test Disc {0}", i.ToString());
            //    this.discArray.Add(c);
            //}
            this.DetermineShowErrorMessage();
        }