Exemple #1
0
 private void SetValue(ResourceFile file)
 {
     if (file != null && file.IsValid)
     {
         if (file != null)
         {
             string text = this.CheckNest(file);
             if (!string.IsNullOrEmpty(text))
             {
                 LogConfig.Output.Error(text, null);
                 return;
             }
             using (CompositeTask.Run(this._propertyItem.DiaplayName))
             {
                 this._propertyItem.SetValue(this._propertyItem.Instance, file, null);
             }
             IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
             if (playControl != null)
             {
                 playControl.Start();
             }
         }
         this.ScenceSetValue();
     }
 }
Exemple #2
0
 public Widget ResolveEditor(PropertyItem item = null)
 {
     this.proxyCom     = (this._propertyItem.Instance as IPlayControl);
     this.widget       = new PlayControlWidget();
     this.widget.Play += new EventHandler(this.widget_Play);
     this.widget.Stop += new EventHandler(this.widget_Stop);
     this.ControlView(this.proxyCom.HasData());
     return(this.widget);
 }
        /// <summary>
        /// Returns true if foo_title is displayed because nothing is playing and showWhenNotPlaying is enabled.
        /// </summary>
        private bool NotPlayingSat()
        {
            if (!_showWhenNotPlaying.Value)
            {
                return(false);
            }
            IPlayControl pc = Main.PlayControl;

            return(!pc.IsPlaying() || pc.IsPaused());
        }
        /// <summary>
        /// Returns true if it should be shown before song end and that criteria is enabled.
        /// </summary>
        /// <returns></returns>
        private bool BeforeSongEndSat()
        {
            IPlayControl pc = Main.PlayControl;

            if (!_beforeSongEnds.Value || !pc.IsPlaying() || pc.IsPaused())
            {
                return(false);
            }
            return(_lastSong != null && (_lastSong.GetLength() - _beforeSongEndsStay.Value <= pc.PlaybackGetPosition()));
        }
        /// <summary>
        /// Returns true if foo_title should be shown according to the timing criteria - n seconds after song start
        /// and that criteria is enabled.
        /// </summary>
        private bool SongStartSat()
        {
            IPlayControl pc = Main.PlayControl;

            if (!_onSongStart.Value || !pc.IsPlaying() || pc.IsPaused())
            {
                return(false);
            }
            return(pc.PlaybackGetPosition() < _onSongStartStay.Value);
        }
 private void linkLabel_LeftClicked(object sender, LabelClickedEventArgs e)
 {
     foreach (PropertyDescriptor propertyDescriptor in PropertyGridUtilities.GetPropertyDescriptors(this._propertyItem.Instance))
     {
         if (propertyDescriptor.Name == this._displayName)
         {
             using (CompositeTask.Run(this._propertyItem.DiaplayName))
                 propertyDescriptor.ResetValue(this._propertyItem.Instance);
             this.ScenceSetValue();
             IPlayControl instance = this._propertyItem.Instance as IPlayControl;
             if (instance == null)
             {
                 break;
             }
             instance.Start();
             break;
         }
     }
 }
Exemple #7
0
        private void fileButton_Clicked(object sender, EventArgs e)
        {
            ResourceFolder rootFolder = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] array = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
            for (int i = 0; i < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; i++)
            {
                array[i] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[i];
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(array, LanguageInfo.MessageBox_Content96, false, rootFolder.FullPath).FileNames;
            if (fileNames != null && fileNames.Count <string>() != 0)
            {
                List <ResourceItem> source = Services.ProjectOperations.MessgeDialogImprotResource(rootFolder, fileNames);
                ResourceFile        value  = source.FirstOrDefault <ResourceItem>() as ResourceFile;
                this.SetValue(value);
                IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
                if (playControl != null)
                {
                    playControl.Start();
                }
            }
        }
Exemple #8
0
        private void linkLabel_LeftClicked(object sender, LabelClickedEventArgs e)
        {
            PropertyDescriptorCollection propertyDescriptors = PropertyGridUtilities.GetPropertyDescriptors(this._propertyItem.Instance);

            foreach (PropertyDescriptor propertyDescriptor in propertyDescriptors)
            {
                if (propertyDescriptor.Name == this._displayName)
                {
                    using (CompositeTask.Run(this._propertyItem.DiaplayName))
                    {
                        propertyDescriptor.ResetValue(this._propertyItem.Instance);
                    }
                    this.ScenceSetValue();
                    IPlayControl playControl = this._propertyItem.Instance as IPlayControl;
                    if (playControl != null)
                    {
                        playControl.Start();
                    }
                    break;
                }
            }
        }
        private void fileButton_Clicked(object sender, EventArgs e)
        {
            ResourceFolder rootFolder = Services.ProjectOperations.CurrentResourceGroup.RootFolder;

            string[] fileTypes = new string[this._propertyItem.ResourceFilterDescriptor.FileFilter.Length];
            for (int index = 0; index < this._propertyItem.ResourceFilterDescriptor.FileFilter.Length; ++index)
            {
                fileTypes[index] = "*." + this._propertyItem.ResourceFilterDescriptor.FileFilter[index];
            }
            string[] fileNames = FileChooserDialogModel.GetOpenFilePath(fileTypes, LanguageInfo.MessageBox_Content96, false, rootFolder.FullPath).FileNames;
            if (fileNames == null || ((IEnumerable <string>)fileNames).Count <string>() == 0)
            {
                return;
            }
            this.SetValue(Services.ProjectOperations.MessgeDialogImprotResource(rootFolder, (IEnumerable <string>)fileNames).FirstOrDefault <ResourceItem>() as ResourceFile);
            IPlayControl instance = this._propertyItem.Instance as IPlayControl;

            if (instance == null)
            {
                return;
            }
            instance.Start();
        }
 private void SetValue(ResourceFile file)
 {
     if (file == null || !file.IsValid)
     {
         return;
     }
     if (file != null)
     {
         string str = this.CheckNest(file);
         if (!string.IsNullOrEmpty(str))
         {
             LogConfig.Output.Error((object)str, (Exception)null);
             return;
         }
         using (CompositeTask.Run(this._propertyItem.DiaplayName))
             this._propertyItem.SetValue(this._propertyItem.Instance, (object)file, (object[])null);
         IPlayControl instance = this._propertyItem.Instance as IPlayControl;
         if (instance != null)
         {
             instance.Start();
         }
     }
     this.ScenceSetValue();
 }