2013年3月29日 星期五

IIS not allows rdp extention

ref : http://serverfault.com/questions/335982/iis-not-allowing-me-to-server-files-with-rdp-extension


It can be solved by add
File name Extension: .rdp
MIME type: application/rdp




The Msvm_VirtualSystemManagementService object was not found

1. Server 2008 R2 SP1, Hyper-V in AD can't connect to VM host
2. Download  KB950050:Windows Server 2008 x64 Edition 的 Hyper-V 更新
   http://www.microsoft.com/zh-tw/download/details.aspx?id=18567
3. OK!

2013年3月26日 星期二

Screen Capture By Thread

1. OS: Windows 7  x64
2. Tools: VS2010, Expression 4.0
3. Prepare a class for capturing scrren and save to outputpath

class BkScnCap
    {
        ScreenCaptureJob job;
        public BkScnCap()
        {
            job = new ScreenCaptureJob();
         
        }
        public void Record()
        {
            System.Drawing.Size monitorSize = SystemInformation.PrimaryMonitorSize;
            System.Drawing.Rectangle capRect = new System.Drawing.Rectangle(0, 0, monitorSize.Width, monitorSize.Height);
            job.CaptureRectangle = capRect;
            job.OutputPath = @"E:\output\ScreenCap";
            job.Start();
        }
        public void StopRecord()
        {
            job.Stop();
        }
    }
4. Make backgroud thread method in constructor, Click to start this thread and click the stop to end it.

public MainWindow()
        {
            InitializeComponent();
            oBkScnCap = new BkScnCap();
            oThread = new System.Threading.Thread(new System.Threading.ThreadStart(oBkScnCap.Record));
        }
        System.Threading.Thread oThread;
        BkScnCap oBkScnCap;
        private void 儲存影片_Click(object sender, RoutedEventArgs e)
        {
            oThread.Start();
        }

        private void 停止影片擷取_Click(object sender, RoutedEventArgs e)
        {
            oBkScnCap.StopRecord();
        }
5. Screen resolution issue

2013年3月19日 星期二

明明就很容易Rotate Animation

1. Windows 7 x64
2. VS 2010
3.  Storyboard.TargetProperty="Angle"  就可以了。

<Window x:Class="Ro2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Ellipse Width="100" Height="50" Fill="Red">
            <Ellipse.RenderTransform>
                <RotateTransform x:Name="Ro"/>
            </Ellipse.RenderTransform>
            <Ellipse.Triggers>
                <EventTrigger RoutedEvent="Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="Ro"
                                    Storyboard.TargetProperty="Angle"
                                    From="0" To="360" Duration="0:0:1"
                                    RepeatBehavior="Forever" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Ellipse.Triggers>
        </Ellipse>
    </Grid>
</Window>


2013年3月17日 星期日

Broadcasting Screen

1. Hardware A43S
2. OS: Windows 7 x 64
3. Tools: VS 2010, Expression 4 Pro
4. Download Expression SP2  http://www.microsoft.com/zh-tw/download/details.aspx?id=27870
Ref: http://stackoverflow.com/questions/6173914/realtime-stream-from-screencapture-with-microsoft-expression-encoder

5. Notes:
N1. SP1 or SP2 download and upgrade. Restart was required.
N2. Capture screen and then broadcasting into internet.

6. Coding:
LiveJob  job = new LiveJob();    // Create Broadcasting object
Collection<EncoderDevice> devices = EncoderDevices.FindDevices(EncoderDeviceType.Video);
EncoderDevice device=null;
for (int i=0; i< devices.Count; i++)
                if (devices[i].Name == "Screen Capture Source") device  = devices[i]; // Select Screen Capture
                                                                                                                        //Source as the input device
if (device != null)
            {
                LiveDeviceSource source = job.AddDeviceSource(device, null);
                source.ScreenCaptureSourceProperties = new ScreenCaptureSourceProperties
                {
                    CaptureCursor = true,
                    CaptureLargeCursor = false,
                    FrameRate = 6,
                    CaptureLayeredWindow = true,
                    Height = 600,
                    Width = 800,
                    Left = 0,
                    Top = 0,
                };
                job.ActivateSource(source);
                // Finds and applys a smooth streaming preset
                job.ApplyPreset(LivePresets.VC1256kDSL16x9);
                // Sets up variable for fomat data
                var format = new PullBroadcastPublishFormat { BroadcastPort = 8080 };
                job.PublishFormats.Add(format);
                var data = job.BufferWindowSize;
                job.StartEncoding();
                Console.Write("Press Enter then to stop the broadcasting.");
                Console.ReadLine();
                job.StopEncoding();
            }
            else
            {
                Console.WriteLine("Can't find Screen Capture Source.");
            }
        }














7. Download