Ejemplo n.º 1
0
        /// <summary>
        ///   Raises the <see cref = "Application.Startup" /> event.
        /// </summary>
        /// <param name = "e">The <see cref = "System.Windows.StartupEventArgs" /> instance containing the event data.</param>
        /// <param name = "isFirstInstance">If set to <c>true</c> the current instance is the first application instance.</param>
        protected override void OnStartup(StartupEventArgs e, bool isFirstInstance)
        {
            base.OnStartup(e, isFirstInstance);

            if (!isFirstInstance)
            {

                //    Window window = MainWindow;
                //const string message = "I am not the first application, and I'm going to shutdown!";
                //const string title = "TestApplication - Next instance";
                //if (window != null)
                //    MessageBox.Show(window, message, title);
                //else
                //    MessageBox.Show(message, title);

                Shutdown(1);
            }
            else { 
                      if(e.Args.Length > 0 ){
                       db = new Database();
                       AddCallFromArgs(e.Args);  
                      }
            }
        }
Ejemplo n.º 2
0
            public void UpdateCalls(){
                //var dbPath = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.MyDocuments), "Calls.db");
			    db = new Database();
                IList<CallItem> calls = db.TodaysCalls();
                _callsView = CollectionViewSource.GetDefaultView(calls);
            }
Ejemplo n.º 3
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     Database db = new Database();
     db.AddCall("test Name", "999-999-9999");
     DataContext = new CallViewModel();
 }
Ejemplo n.º 4
0
        /* private void OnCallStateChanged(int callId, ESessionState callState, string info)
        {
            IStateMachine state = CallManager.CallList[callId];

            number = state.CallingNumber;

            textBoxCallState.Text = number;
                        
            string contact = contacts.lookup(number);
            if (contact != "")
                number = contact + " (" + number + ")";

            notifyIcon1.BalloonTipTitle = "Eingehender Anruf";
            notifyIcon1.BalloonTipText = "Von: " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);
        } */

        private void OnIncomingCall(int sessionId, string number, string info)
        {
            incall = CallManager.getCall(sessionId);
            //string contact = contacts.lookup(number);
            //if (contact != "")
            //  number = contact + " (" + number + ")";

            CallStatus.Content = incall.StateId.ToString();
            
            // TODO put the code here to put the call in the DB
            Database  db =  new Database();
            string name = incall.CallingName;
            db.AddCall(name, number);
            DataContext = new CallViewModel();
            //textBoxLastCallNumber.Text = number;
            //textBoxLastCallDate.Text = DateTime.Now.ToString();

            notifyIcon1.BalloonTipTitle = "New Call";
            notifyIcon1.BalloonTipText = "From: " + name + " " + number + "\r\n" + info;
            notifyIcon1.BalloonTipIcon = ToolTipIcon.Info;
            notifyIcon1.ShowBalloonTip(30);

            /*
            // Send Busy
            ICallProxyInterface proxy = CallManager.StackProxy.createCallProxy();
            proxy.serviceRequest((int)EServiceCodes.SC_CFB, "");
            proxy.endCall();
             */
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Raises the <see cref="Custom.Windows.InstanceAwareApplication.StartupNextInstance"/> event.
        /// </summary>
        /// <param name="e">The <see cref="Custom.Windows.StartupNextInstanceEventArgs"/> instance containing the event data.</param>
        protected override void OnStartupNextInstance(StartupNextInstanceEventArgs e)
        {

            e.BringToForeground = false;
            if (e.Args.Length > 0)
            {
                db = new Database();
                AddCallFromArgs(e.Args);
                Window1 w = (Window1)App.Current.MainWindow;

                w.DataContext = new CallViewModel();
            }
            base.OnStartupNextInstance(e);
            

            //
            //string message = "Another instance of this application was started";
            //const string title = "TestApplication - First instance";
            //if (e.Args.Length > 0)
            //    message += Environment.NewLine + "args:" + Environment.NewLine + EnumerableToString(e.Args);

            //if (window != null)
            //    MessageBox.Show(window, message, title);
            //else
            //    MessageBox.Show(message, title);
        }