logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
wleuvering  
#1 Posted : Wednesday, September 24, 2014 8:02:38 AM(UTC)
wleuvering

Rank: Newbie

Groups: Registered
Joined: 9/24/2014(UTC)
Posts: 4
Location: NL

Hi,

I'm trying to build a custom XAML that will show data coming from a SQL database. So far I've been successful in building a 'Hello World' XAML but I'm looking for more information on how to react to the interface. Or to put it different what should I implement in Load(), Play(), Close() and what's the idea behind the position as a TimeSpan.

All help is appreciated...

Willy
Thremir  
#2 Posted : Wednesday, September 24, 2014 4:57:16 PM(UTC)
Thremir

Rank: Advanced Member

Groups: Registered
Joined: 9/17/2013(UTC)
Posts: 173
Man
Location: Norway

Thanks: 10 times
Was thanked: 56 time(s) in 29 post(s)
wleuvering wrote:
Hi,

I'm trying to build a custom XAML that will show data coming from a SQL database. So far I've been successful in building a 'Hello World' XAML but I'm looking for more information on how to react to the interface. Or to put it different what should I implement in Load(), Play(), Close() and what's the idea behind the position as a TimeSpan.

All help is appreciated...

Willy


I'm kind of confused about what you're trying to achieve here.

If it's the .xaml file you're talking about, the only way of interacting with it is setting text-values that can be bound to other properties.

Also, there are no "Play()" etc. that is used within the .xaml files, only two animation "Storyboards" that is being played back when used in vMix.

Hope this was understandable, and if not, I'd recommend opening the already existing .xaml files that lies within the vMix installation directory with your favorite text editor to see how they are set up.


Cheers,
Håvard
Njastad Webshop
wleuvering  
#3 Posted : Thursday, September 25, 2014 6:11:26 AM(UTC)
wleuvering

Rank: Newbie

Groups: Registered
Joined: 9/24/2014(UTC)
Posts: 4
Location: NL

No, it is wat is called a Custom XAML in the documentation.
It is in Developers Information...

This is way to create a WPF Custom Control and program in C# which functions as a input. This should work just fine. Unfortunately I can not find a lot of documentation about it.




admin  
#4 Posted : Thursday, September 25, 2014 6:50:25 AM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,211
Man
Location: Gold Coast, Australia

Was thanked: 4301 time(s) in 1523 post(s)
Hi,

The functions in the vMixWPFUserControl interface are all optional
and it is fine to return 0 for the TimeSpan if you don't need to do anything.

These functions are called by vMix and should be self explanatory.

Load is called when vMix loads your custom control as an Input. Width and Height
are the resolution vMix is using so you can layout your control correctly.

Play/Pause are when the button is clicked in vMix.

SetPosition is called when dragging the position bar in vMix. (As long as you have specified a duration in GetDuration > 0)

Close is called just before the input is closed in vMix.

Regards,

Martin
vMix
thanks 1 user thanked admin for this useful post.
Llorx on 8/29/2016(UTC)
um@equilive.dk  
#5 Posted : Thursday, September 25, 2014 11:57:12 AM(UTC)
um@equilive.dk

Rank: Member

Groups: Registered
Joined: 10/13/2013(UTC)
Posts: 29
Location: Denmark

Thanks: 1 times
Martin, does this mean that it is possible to READ from a SQL database via the PLAY method and fill in fields in the layout ?

/Ulrik
admin  
#6 Posted : Thursday, September 25, 2014 12:02:59 PM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,211
Man
Location: Gold Coast, Australia

Was thanked: 4301 time(s) in 1523 post(s)
In the load function you could setup your own threads and do whatever you need.
Marra  
#7 Posted : Tuesday, October 7, 2014 11:14:16 AM(UTC)
Marra

Rank: Newbie

Groups: Registered
Joined: 10/7/2014(UTC)
Posts: 3
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,
I'm fascinated of the possibility to design custom XAMLs on your own as overlays, etc.
So I searched a lot and came up with the following XAML + CodeBehind (like jwolthuis mentioned in this topic), but it looks like the CodeBehind is completely ignored.
Is this usage of a CodeBehind-File the right way? And is Usage of Bindings supported?

Thanks a lot for answers!

Code:
<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	x:Class="vMixTextTest.MainControl"
	x:Name="UserControl"
	d:DesignWidth="640" d:DesignHeight="480" Width="768" Height="576">

	<Grid x:Name="LayoutRoot">
	<TextBlock Name="txtText" 
		Text="{Binding Path=TextBehind, Mode=OneWay}" 
		HorizontalAlignment="Center" VerticalAlignment="Top"
		Height="105.04" Width="264.007" Margin="37.993,25.96,0,0"   
		FontSize="26.667" FontWeight="ExtraBold" 
		Foreground="#FFC65555"/>
	</Grid>
</UserControl>


Code:
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using System.ComponentModel;
using vMixInterop;

namespace vMixTextTest
{
	public partial class MainControl: UserControl, vMixWPFUserControl, INotifyPropertyChanged
	{
		private DispatcherTimer timer;
		
		public MainControl() : base()
		{
			this.InitializeComponent();
			LayoutRoot.DataContext = this;
			
			timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += timer_Tick;
		}
		
		void timer_Tick(object sender, EventArgs e)
        {
			TextBehind = "Text " + DateTime.Now.ToLongTimeString();
        }

		
		public event PropertyChangedEventHandler PropertyChanged;
		public void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
		}
		
		private string _textBehind = "testInit";
		public string TextBehind{ 
			get 
			{
				return _textBehind;
			}
			private set
			{
				_textBehind = value; 
				OnPropertyChanged("TextBehind");
			}
		}
		public static readonly DependencyProperty TextBehindProperty = 
			DependencyProperty.Register(
				"Label", 
				typeof(string),
        		typeof(MainControl), new PropertyMetadata(""));
		
		public void Load(int width, int height){ TextBehind = "testLoad"; }
        public void Play(){ timer.Start(); }
        public void Pause(){ timer.Stop(); }
        public void SetPosition(TimeSpan position){}
        public TimeSpan GetPosition(){ return new System.TimeSpan(0); }
        public TimeSpan GetDuration(){ return new System.TimeSpan(0); }
        public void Close(){}
        public void ShowProperties(){}
	}
}

thanks 1 user thanked Marra for this useful post.
Llorx on 8/29/2016(UTC)
admin  
#8 Posted : Tuesday, October 7, 2014 11:28:09 AM(UTC)
admin

Rank: Administration

Groups: Administrators
Joined: 1/13/2010(UTC)
Posts: 5,211
Man
Location: Gold Coast, Australia

Was thanked: 4301 time(s) in 1523 post(s)
You will need to compile it into a DLL and then load that into vMix.
thanks 1 user thanked admin for this useful post.
Marra on 10/7/2014(UTC)
Marra  
#9 Posted : Tuesday, October 7, 2014 1:40:15 PM(UTC)
Marra

Rank: Newbie

Groups: Registered
Joined: 10/7/2014(UTC)
Posts: 3
Location: Germany

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Just saw the option to open a DLL,
Thank you Martin!!!

Works perfect
Llorx  
#10 Posted : Monday, August 29, 2016 3:51:11 AM(UTC)
Llorx

Rank: Advanced Member

Groups: Registered
Joined: 9/2/2015(UTC)
Posts: 35

Thanks: 5 times
Was thanked: 2 time(s) in 1 post(s)
Compiled this as a DLL but got some stuttering.

See detailed problem here: http://forums.vmix.com/d....aspx?g=posts&t=6821

Sorry for this, but I need admin attention for this bug.
Users browsing this topic
Guest (4)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.