Application that display on another monitor/TV - c#

I have an c# desktop Application that want to display the videos with sounds that was streaming via axwindowsmediaplayer and after then the timer start and display message if necessary on tv, what I did I made "axwindowsmediaplayer and labels that calculate the timer and message on (panel2) and all works fine " but I want to display panel 2 on tv screen with audio if another technology please advise me .enter image description here
Screen pscr = Screen.FromControl(panel2);
Screen scr = Screen.AllScreens.FirstOrDefault(s => !s.Primary) ??pscr ;
panel2.Left = scr.Bounds.Width;
panel2.Top = scr.Bounds.Height;
panel2.Location = scr.Bounds.Location;
Point p = new Point(scr.Bounds.Location.X, scr.Bounds.Location.Y);
panel2.Location = p;
panel2.Show();

Related

Microsoft media encoder screen capture, save a specific part of the video being recorded

I'm coding a screen capture program in C# using windows media encoder. While the screen is being recorded i want to save the last 30sec of the current video being recorded in a separate video when a btn gets clicked. Is there a function in encoder that would allow me to do that?
I've attached the code that I'm currently using. Couldn't find any documentation on media encoder...
void startRecording() {
System.Drawing.Size workingArea = SystemInformation.WorkingArea.Size;
Rectangle captureRec = new Rectangle(0, 0, workingArea.Width -(workingArea.Width % 4), workingArea.Height - (workingArea.Height % 4));
job.CaptureRectangle = captureRec;
job.ShowFlashingBoundary = true;
job.ShowCountdown = true;
job.CaptureMouseCursor = true;
job.AddAudioDeviceSource(AudioDevices());
job.OutputPath = #"C:\Users\Moe36\Desktop\Screen Recorder";
job.Start();
}
void saveLast30Sec() {
//Save last 30sec of the currently recorded video as a separate video file.
}

Not able to capture full screen from secondary Monitor using Directshow

I am trying to capture the screen of the PC connected to my PC via HDMI using Direct-show. I am using capture card as the hardware and Direct show's sample grabber method to render those captured frames.
The issue is I am not able to render the full screen of the secondary monitor on to my computer. Both PC's are of different configuration. I have tried giving different frame size values like 1366*768 but it just picks up 1280*768 I believe .
Moreover I have set the frame size to be captured as 1366*768 and even my PC is set to the same display setting still it does not render the full screen.
Here is the code I am using for capturing and rendering. Capture class has a property called frame size whose size has been set to 1366*768 but as soon as I do that and run the code it shows a total blank screen and when i change the setting to 1280*768 it will render the secondary monitor but won't render the full screen of it.
Size size = new Size(1366, 768);
capture.FrameSize = size;
where capture class has the below given property
public Size FrameSize
{
get
{
BitmapInfoHeader bmiHeader;
bmiHeader = (BitmapInfoHeader) getStreamConfigSetting( videoStreamConfig, "BmiHeader" );
// Size size = new Size( bmiHeader.Width, bmiHeader.Height );
Size size = new Size(1280, 768);
return( size );
}
set
{
BitmapInfoHeader bmiHeader;
bmiHeader = (BitmapInfoHeader) getStreamConfigSetting( videoStreamConfig, "BmiHeader" );
bmiHeader.Width = 1280;
bmiHeader.Height = 768;
setStreamConfigSetting( videoStreamConfig, "BmiHeader", bmiHeader );
//#if NEWCODE
this.videoCaps = null;
//#endif
}
}
Any suggestions or findings that how can I capture the full screen of the secondary monitor will be really appreciated.

Update Live Tile but which one is that?

I have an application with pinned secondary live tiles, they are showing days on the back of the tile and I would like to reduce the number of days each day. Now the problem is, that I don't want to change the other properties of the tile (so Title, Images, etc), only the content (a string) on the back: FlipTileData.BackContent
So I don't want to create new FlipTileData to pass that as a parameter for the Update method.
Second problem: How do I even know which tile is what I'm about to update?
I've tried this:
foreach (ShellTile tile in ShellTile.ActiveTiles) but tile has no attribute that gives me a help. Should I use NavigationUri to find out which tile is that?
Follow this example Working with Live Tiles in Windows Phone 7 and it should solve your problems.
Notice the x.NavigationUri.ToString().**Contains("Title=SecondaryTile")** on the code.
EDIT:
Combining a few lines of code from that website:
// modify Application Secondary Tile data
private void updateTile_Click(object sender, RoutedEventArgs e)
{
// get application specific tile - EXAMPLE
ShellTile Tile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("Title=SecondaryTileEXAMPLE_TITLE"));
if (null != tile)
{
// create a new data for tile
StandardTileData data = new StandardTileData();
// tile foreground data
data.Title = "Title text here";
data.BackgroundImage = new Uri("/Images/Blue.jpg", UriKind.Relative);
data.Count = random.Next(99);
// to make tile flip add data to background also
data.BackTitle = "Secret text here";
data.BackBackgroundImage = new Uri("/Images/Green.jpg", UriKind.Relative);
data.BackContent = "Back Content Text here...";
// update tile
tile.Update(data);
}
}

Windows Phone 7 Creating video streams

Hi i am creating a project in windows phone 7 that will capture videos and transport it to some other device. Here is my code so far.
// Initialize the camera if it exists on the device.
if (videoCaptureDevice != null)
{
captureSource = new CaptureSource();
fileSink = new FileSink();
// Create the VideoBrush for the viewfinder.
videoRecorderBrush = new VideoBrush();
CompositeTransform transform = new CompositeTransform();
transform.CenterX = 0.5;
transform.CenterY = 0.5;
transform.Rotation = 90;
videoRecorderBrush.RelativeTransform = transform;
videoRecorderBrush.SetSource(captureSource);
// Display the viewfinder image on the rectangle.
viewfinderRectangle.Fill = videoRecorderBrush;
// Start video capture and display it on the viewfinder.
captureSource.Start();
// Set the button state and the message.
}
What i want is to save the the video that was captured to some kind of buffer,so that i can send it and the other device can see that video (Video Call). Any ideas?
bsically you can go for this sample fro msdn
the voip sample
for a normal description of how to make application here's a link in silverlight
you can mapp at least some code and understanding from here ..
video call silverlight

How to get the window location on the screen of an XNA game?

I am making an XNA 4.0 game in visual studio c# 2010 express. In the game i am using a winForm for some properties that the user can change. I want the winForm window to appear exactly right to the main xna game window (for clarity and better interface).
And my question is, how can i get the coordinates of the xna game window?
How can i change the coordinates of the winForm window so the window appears exactly right of the main game window?
Use this:
using wf = System.Windows.Forms;
wf.Form MyGameForm = (wf.Form)wf.Form.FromHandle(Window.Handle);
var bounds = MyGameForm.Bounds;
bounds will be a System.Drawing.Rectangle, you can access its X, Y, Width and Height.
You need to set the StartPosition property to FormStartPosition.Manual before setting the new position...
Here you are a detailed example:
var sc = System.Windows.Forms.Screen.AllScreens;
var xnaForm = (Form) Forms.Control.FromHandle( Editor.Game.Window.Handle );
// Set the xnaForm position at the desired screen (for multimonitor systems)
xnaForm.StartPosition = Forms.FormStartPosition.Manual;
xnaForm.Location = new Point(
sc[pref.AdapterIndex].Bounds.Left,
sc[pref.AdapterIndex].Bounds.Top);
int W = sc[pref.AdapterIndex].WorkingArea.Width;
int H = sc[pref.AdapterIndex].WorkingArea.Height;
W -= Editor.Game.Window.ClientBounds.Width;
// Set the editor form position to the right of xnaForm
MapForm.StartPosition = Forms.FormStartPosition.Manual;
MapForm.DesktopLocation = new System.Drawing.Point(
xnaForm.DesktopBounds.Right,
xnaForm.DesktopBounds.Top);
MapForm.Width = W;

Categories

Resources