예제 #1
0
        /*
         * protected override void OnClosing(CancelEventArgs e)
         * {
         *  if (!pleaseClose)
         *  {cvm.sck.Close();
         *      base.OnClosing(e);
         *      e.Cancel = true;
         *  }
         * }*/

        public CallWindow(string login, string password, string friendAvatar, string friendLogin, string address_ip, string call_id, string state, UdpClient udp)
        {
            InitializeComponent();
            var hwnd = new WindowInteropHelper(this).Handle;

            SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
            //audioManager = new AudioManager();
            //audioManager.Initialize(login);
            //audioManager.StartCall(address_ip);

            NotWaitToCallButton.IsEnabled = false;
            SendButton.IsEnabled          = false;

            NotReceiveButton.IsEnabled = false;
            StartCallButton.IsEnabled  = false;

            cvm = new CallViewModel(login, password, friendAvatar, friendLogin, address_ip, call_id, state, this, udp);
            cvm.RequestClose += new EventHandler(CloseWindow);
            DataContext       = cvm;

            if (!cvm.CallModel.IsNotInLocalNewtwork)
            {
                cvm.sendHi();

                System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
                dispatcherTimer.Tick    += dispatcherTimer_Tick;
                dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
                dispatcherTimer.Start();
            }
            else
            {
                pleaseClose = true;
                Close();
            }
        }