Пример #1
0
		public object Clone()
		{
			RundownItem item = new RundownItem();

			if (StaticItem != null)
			{
				item.StaticItem = new Svt.Caspar.CasparItem(StaticItem.Clipname);
				item.StaticItem.Loop = StaticItem.Loop;
				item.StaticItem.Transition.Type = StaticItem.Transition.Type;
				item.StaticItem.Transition.Duration = StaticItem.Transition.Duration;
                item.StaticItem.VideoLayer = StaticItem.VideoLayer;
			}

			if (CGItem != null)
			{
				item.CGItem = new Svt.Caspar.CasparCGItem();
				item.CGItem.AutoPlay = CGItem.AutoPlay;
				item.CGItem.Layer = CGItem.Layer;
                item.CGItem.VideoLayer = CGItem.VideoLayer;
				item.CGItem.TemplateName = CGItem.TemplateName;
				item.CGItem.TemplateProfile = CGItem.TemplateProfile;

				foreach (Svt.Caspar.CGDataPair cgdata in CGItem.Data)
					item.CGItem.Data.Add(new Svt.Caspar.CGDataPair(cgdata.Name, cgdata.Value));
			}

			item.IsCG = IsCG;
            item.IsControl = IsControl;
			item.Name = Name;
			item.MultiStep = MultiStep;
			item.IsStoredData = IsStoredData;
            item.IsDataUpdate = IsDataUpdate;
			item.Channel = Channel;
			item.Color = Color;
            item.Page = Page;
            item.ControlValue = ControlValue;

            item.Online = Online;
            item.ChannelColor = ChannelColor;

			return item;
		}
Пример #2
0
 void DoClearChannel(RundownItem item)
 {
     if (item != null)
     {
         Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
         if (channel != null)
             channel.Clear();
     }
 }
Пример #3
0
		void DoClearLayer(RundownItem item)
		{
			if (item != null)
			{
				Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
				if (channel != null)
				{
					if (item.IsCG)
					{
						channel.CG.Clear(item.CGItem.VideoLayer);
					}
					else
					{
						Svt.Caspar.CasparItem blackItem = new Svt.Caspar.CasparItem("#00000000");
                        blackItem.VideoLayer = item.StaticItem.VideoLayer;
						channel.Load(blackItem);
					}
				}
			}
		}
Пример #4
0
		void DoStopItem(RundownItem item)
		{
			if (item != null)
			{
				Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
				if (item.IsCG)
				{
					if (channel != null)
						channel.CG.Stop(item.CGItem.VideoLayer, item.CGItem.Layer);
				}
				else
				{
					if (channel != null)
						channel.Stop(item.StaticItem.VideoLayer);
				}
			}
		}
Пример #5
0
		void DoLoadItem(RundownItem item, bool bAutoPlay)
		{
			if(item != null)
			{
				Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
                if (item.IsControl && bAutoPlay)
                {
                    SpyderClient.Send(item);
                }
                else if (item.IsCG)
                {
                    if (channel != null)
                    {
                        if (item.IsStoredData)
                            channel.CG.Add(item.CGItem.VideoLayer, item.CGItem.Layer, item.CGItem.TemplateName, bAutoPlay, item.CGItem.Data[0].Value);
                        else
                            channel.CG.Add(item.CGItem, bAutoPlay);
                    }
                }
                else
                {
                    if (channel != null)
                    {
                        channel.LoadBG(item.StaticItem);
                        if (bAutoPlay)
                            channel.Play(item.StaticItem.VideoLayer);
                    }
                }
			}
		}
Пример #6
0
 void DoUpdateItem(RundownItem item)
 {
     if (item != null)
     {
         Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
         if (item.IsCG)
         {
             if (channel != null)
                 channel.CG.Update(item.CGItem.VideoLayer, item.CGItem.Layer, new CGDataListWrapper(item.CGItem.Data));
         }
     }
 }
Пример #7
0
		void DoPlayItem(RundownItem item)
		{
			if (item != null)
			{
				Svt.Caspar.Channel channel = HostsManager.GetChannel(item.Channel);
				if (item.IsControl)
                {
                    SpyderClient.Send(item);
                }
                else if (item.IsCG)
				{
                    if (channel != null)
                    {
                        if(item.IsDataUpdate)
                            channel.CG.Update(item.CGItem.VideoLayer, item.CGItem.Layer, new CGDataListWrapper(item.CGItem.Data));
                        else
                            channel.CG.Play(item.CGItem.VideoLayer, item.CGItem.Layer);
                    }
				}
				else
				{
					if (channel != null)
						channel.Play(item.StaticItem.VideoLayer);
				}
			}
		}
Пример #8
0
		bool LoadFile(string filename)
		{
			bool returnvalue = true;
			try
			{
				List<RundownItem> newItems = new List<RundownItem>();

				XPathDocument xpDoc = new XPathDocument(filename);
				XPathNavigator xpNav = xpDoc.CreateNavigator();
				XPathNodeIterator items = xpNav.Select("/rundown/rundownitem");
				while (items.MoveNext())
				{
					try
					{
						RundownItem item = new RundownItem();
						item.Name = (string)items.Current.Evaluate("string(@name)");
						item.Channel = (string)items.Current.Evaluate("string(@channel)");
                        item.Page = (string)items.Current.Evaluate("string(@page)");

                        string controlvalue = items.Current.Evaluate("string(@controlvalue)").ToString();
                        if (!string.IsNullOrEmpty(controlvalue))
                            item.ControlValue = int.Parse(controlvalue);

                        string controlsystem = items.Current.Evaluate("string(@controlsystem)").ToString();
                        if (!string.IsNullOrEmpty(controlsystem))
                            item.Channel = controlsystem;

                        string controlpreset = items.Current.Evaluate("string(@controlpreset)").ToString();
                        if (!string.IsNullOrEmpty(controlpreset))
                            item.StaticItem.Clipname = controlpreset;

						string strMultiStep = (string)items.Current.Evaluate("string(@multistep)");
						bool bMultiStep = false;
						Boolean.TryParse(strMultiStep, out bMultiStep);
						item.MultiStep = bMultiStep;

						string strIsStoreData = (string)items.Current.Evaluate("string(@isstoredata)");
						bool bIsStoreData = false;
						Boolean.TryParse(strIsStoreData, out bIsStoreData);
						item.IsStoredData = bIsStoreData;

                        string strColor = items.Current.Evaluate("string(@color)") as String;
                        item.Color = Color.FromName(strColor);

                        string strIsControl = (string)items.Current.Evaluate("string(@iscontrol)");
                        bool bIsControl = false;
                        Boolean.TryParse(strIsControl, out bIsControl);
                        item.IsControl = bIsControl;

                        //cache channel-status
                        Hosts.ChannelInformation channelInfo = HostsManager.GetChannelInfo(item.Channel);
                        item.Online = (channelInfo != null) ? channelInfo.Online : false;
                        item.ChannelColor = (channelInfo != null) ? Color.FromArgb(channelInfo.ArgbValue) : Color.Red;

						items.Current.MoveToFirstChild();
						if (items.Current.Name == "cgitem")
						{
							item.IsCG = true;
							item.CGItem.ReadXml(items.Current.ReadSubtree());
						}
						else if (items.Current.Name == "item")
						{
							item.IsCG = false;
							item.StaticItem = Svt.Caspar.CasparItem.Create(items.Current.ReadSubtree());
						}

						newItems.Add(item);
					}
					catch { }
				}

				{
					lbRundown_.SuspendLayout();
					lbRundown_.Items.Clear();
					foreach (RundownItem item in newItems)
						lbRundown_.Items.Add(item);
					lbRundown_.ResumeLayout();

				}
			}
			catch (Exception ex)
			{
				returnvalue = false;
				MessageBox.Show(ex.Message, "There was an error when loading rundown");
			}

			IsDirty = !returnvalue;

            if (returnvalue)
            {
                CurrentFilename = filename;
                AddToRecentFiles(filename);
            }

			return returnvalue;
		}
Пример #9
0
		private void DrawStaticItem(RundownItem item, System.Windows.Forms.DrawItemEventArgs e, bool bSelected)
		{
			Brush fontBrush = bSelected ? fontBrushSelected_ : fontBrush_;
            string title = string.IsNullOrEmpty(item.Page) ? string.Empty : (item.Page + ": ");

            if (item.IsControl)
            {
                title += string.IsNullOrEmpty(item.Name) ? NewItemName : item.Name;
            }
            else
            {
                title += string.IsNullOrEmpty(item.Name) ? NewItemName : item.Name + (" (" + item.StaticItem.Transition.Type.ToString());
                if (item.StaticItem.Transition.Duration != 0)
                    title += ", " + item.StaticItem.Transition.Duration + " frames";

                title += ") " + (item.StaticItem.Loop ? " LOOP" : "");
            }

			e.Graphics.DrawString(title, e.Font, fontBrush, e.Bounds.X + 2, e.Bounds.Y + 2);

			//Visa varnings-ikon om ingen still är vald
			int offsetX = 0;
			if (string.IsNullOrEmpty(item.StaticItem.Clipname))
			{
				e.Graphics.DrawImage(Properties.Resources.warn, e.Bounds.X + 2, e.Bounds.Bottom - 16, 14, 14);
				offsetX = 18;
			}

			//visa vilken still det handlar om
            if (item.IsControl)
                e.Graphics.DrawString("Setting: " + item.StaticItem.Clipname, e.Font, fontBrush, e.Bounds.X + 2 + offsetX, e.Bounds.Bottom - 17);
            else
                e.Graphics.DrawString("Fil: " + item.StaticItem.Clipname, e.Font, fontBrush, e.Bounds.X + 2 + offsetX, e.Bounds.Bottom - 17);
		}
Пример #10
0
		private void DrawCGItem(RundownItem item, System.Windows.Forms.DrawItemEventArgs e, bool bSelected)
		{
			Brush fontBrush = bSelected ? fontBrushSelected_ : fontBrush_;
            string title = string.IsNullOrEmpty(item.Page) ? string.Empty : (item.Page + ": ");
			title += string.IsNullOrEmpty(item.Name) ? NewItemName : item.Name;
			e.Graphics.DrawString(title, e.Font, fontBrush, e.Bounds.X + 2, e.Bounds.Y + 2);

            if (!item.IsDataUpdate)
            {
                //Visa varnings-ikon om ingen mall är vald
                int offsetX = 0;
                if (string.IsNullOrEmpty(item.CGItem.TemplateIdentifier))
                {
                    e.Graphics.DrawImage(Properties.Resources.warn, e.Bounds.X + 2, e.Bounds.Bottom - 16, 14, 14);
                    offsetX = 18;
                }

                //visa vilken still det handlar om
                e.Graphics.DrawString("Mall: " + item.CGItem.TemplateIdentifier, e.Font, fontBrush, e.Bounds.X + 2 + offsetX, e.Bounds.Bottom - 17);
            }
            else
            {
                e.Graphics.DrawString("JUST DATA UPDATE", e.Font, fontBrush, e.Bounds.X + 2, e.Bounds.Bottom - 17);
            }
		}
Пример #11
0
		private void InsertItem(RundownItem item)
		{
            if (item != null)
            {
                int originalSelection = lbRundown_.SelectedIndex;
                if (originalSelection == ListBox.NoMatches)
                {
                    lbRundown_.Items.Add(item);
                    lbRundown_.SelectedIndex = lbRundown_.Items.Count - 1;
                }
                else
                {
                    //insert element over the currently selected item
                    lbRundown_.Items.Insert(originalSelection + 1, item);
                    lbRundown_.SelectedIndex = originalSelection + 1;
                }

                IsDirty = true;
            }
		}
Пример #12
0
 void InsertEmptyItem()
 {
     RundownItem item = new RundownItem();
     item.Color = itemViewControl_.TemplateColor;
     InsertItem(item);
 }
Пример #13
0
 private void miCopy__Click(object sender, EventArgs e)
 {
     //TODO: Use the real clipboard instead. see below, doesn't work yet
     if (lbRundown_.SelectedItem != null)
     {
         clipboard_ = (RundownItem)(lbRundown_.SelectedItem as RundownItem).Clone();
     }
     
     //if (lbRundown_.SelectedItem != null)
     //{
     //    RundownItem copy = (RundownItem)((RundownItem)lbRundown_.SelectedItem).Clone();
     //    Clipboard.SetData(RundownItemDataFormat.Name, copy);
     //}
 }