示例#1
0
        public MainWindow()
		{
            selectImage = "";
			InitializeComponent();
			pictureBoarders = new List<Rectangle>();
            twhelper = new TwitterHelpper();
            Properties.Settings.Default.FileRoot= Properties.Settings.Default.FileRoot == "" ?
                System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures) :
                    Properties.Settings.Default.FileRoot;
            Properties.Settings.Default.Save();

            hotKey = new HotKey.HotKeyRegister(HotKey.MOD_KEY.CONTROL, Keys.Q, this);
			pictureList = new Mok.Util.PaginateList<string>(9);
			hotKey.HotKeyPressed += (k) =>
			{
	
				counter++;
                try
                {
                    wc.CaptureImage().Save(FilePath(), System.Drawing.Imaging.ImageFormat.Png);
                }
                catch(WindowCapture.WindowNotFoundException)
                {
                    System.Windows.MessageBox.Show("PC TV with Nasneが起動されていません。");
                    return;
                }
				pictureList.AddShift(FilePath());
				ReconstractView();
				selectImage = FilePath();
				pictureBoarders.ForEach(p => p.Visibility = Visibility.Hidden);
				pictureBoarders[Math.Min(8, pictureList.Count - 1)].Visibility = Visibility.Visible;

			};
			wc = new WindowCapture.WindowCapture("PC TV");
		
			Loaded += (ss, ee) =>
			{
				var picarea = PictureArea.Children;
				foreach (var item in picarea)
				{
					if (item.GetType().ToString() == "System.Windows.Shapes.Rectangle")
					{
						pictureBoarders.Add((Rectangle)item);
						((Rectangle)item).Visibility = Visibility.Hidden;
					}
				}
      
            };

		}