Beispiel #1
0
        public MainWindow()
        {                                                                     //長い  けどスッキリさせるのが難しい...
            //ログ出力のための設定
            StreamWriter streamWriter = new StreamWriter("debug.log", false); //既にファイルがあっても追加ではなく上書き

            streamWriter.AutoFlush = true;                                    //これやっとかないとバッファに貯めこまれてアプリ終了まで書き込まれなかったりする
            Console.SetOut(streamWriter);
            Console.WriteLine("ウィンドウコンストラクタ");

            InitializeComponent();//これは必須


            pipe = new NamedPipeCommunication("mypipe");
            pipe.MessageReceived += test;    //メッセージ受信時の処理
            pipe.WaitConnectionAsync();
            testLabel.DataContext    = pipe; //パイプコンストラクト前に置くと機能しないしエラーも出ない
            messageLabel.DataContext = pipe;

            myManager = new ExternalAppManager();
            LoadSettings.LoadFromTextTest <ExternalAppManager>("settings.txt", myManager);//テキストからロード

            gaze = new GazedPoint(300, 200);
            gaze.InterestDetected     += OnInterestDetected;
            gazeImage.DataContext      = gaze;
            text1.DataContext          = gaze;
            text2.DataContext          = gaze;
            text3.DataContext          = gaze;
            text4.DataContext          = gaze;
            gazeStateLabel.DataContext = gaze;
            LoadSettings.LoadFromTextTest <TimeLinePointDatas>("settings.txt", gaze.pointDatas);

            videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            comboBox1.Items.Clear();
            if (videoDevices.Count == 0)
            {
                throw new ApplicationException();
            }


            //DeviceExist = true;
            foreach (FilterInfo device in videoDevices)
            {
                comboBox1.Items.Add(device.Name);
            }
            comboBox1.SelectedIndex = 0;                //make dafault to first cam

            mySerial = new SerialCommunication("a", 1); //test
            LoadSettings.LoadFromTextTest <SerialCommunication>("settings.txt", mySerial);
            mySerial.Open();

            Console.WriteLine("ウィンドウコンストラクタ終了");
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = this;

            pipe = new NamedPipeCommunication("mypipe");
            pipe.getMessageEvent += test;
            myCanvas.DataContext  = pipe;//パイプコンストラクト前に置くと機能しないしエラーも出ない
            pipe.WaitConnectionAsync();

            myManager = new ExternalAppManager();
            LoadSettings.LoadFromTextTest <ExternalAppManager>("settings.txt", myManager);

            gaze = new GazedPoint(200, 300);

            VideoDevices = EncoderDevices.FindDevices(EncoderDeviceType.Video);
            AudioDevices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);
        }