Exemple #1
0
 public Registration(DateTime time, int line, string dID, string wID, RegState state)
 {
     Time   = time;
     Line   = line;
     DefID  = dID;
     WorkID = wID;
     State  = state;
 }
Exemple #2
0
 public Registration(DateTime rTime, int rLine,
                     string dId, string cId, RegState rState)
 {
     time   = rTime;
     line   = rLine;
     defId  = dId;
     contId = cId;
     state  = rState;
 }
Exemple #3
0
        void _phoneLine_RegistrationStateChanged(object sender, RegistrationStateChangedArgs e)
        {
            _phoneLineState = e.State;

            if (_phoneLineState == RegState.RegistrationSucceeded)
            {
                InvokeGUIThread(() => { lblExtension.Text = _phoneLine.SIPAccount.UserName; });
                InvokeGUIThread(() => { lblIpAddress.Text = _phoneLine.SIPAccount.DomainServerHost; });
            }
        }
Exemple #4
0
        private void phoneLine_PhoneLineInformation(object sender, RegistrationStateChangedArgs e)
        {
            _phoneLineInformation = e.State;

            if (_phoneLineInformation == RegState.RegistrationSucceeded)
            {
                _message.Add("Registration succeeded - Online");
            }
            else
            {
                _message.Add($"Not registered - Offline: {_phoneLineInformation.ToString()}");
            }
        }
Exemple #5
0
        public void LoadCache()
        {
            FileStream stream = new FileStream("cache.rwk",
                                               FileMode.Open, FileAccess.Read);
            BinaryReader reader = new BinaryReader(stream,
                                                   System.Text.Encoding.Unicode);
            int pCount = reader.ReadInt32();

            products = new ArrayList(pCount);
            for (int i = 0; i < pCount; i++)
            {
                string    pId    = reader.ReadString();
                int       rCount = reader.ReadInt32();
                ArrayList regs   = new ArrayList(rCount);
                for (int j = 0; j < rCount; j++)
                {
                    DateTime time  = DateTime.FromFileTime(reader.ReadInt64());
                    int      line  = reader.ReadInt32();
                    string   dId   = reader.ReadString();
                    string   cId   = reader.ReadString();
                    RegState state = (RegState)
                                     Enum.Parse(typeof(RegState), reader.ReadString(), true);
                    regs.Add(new Registration(time, line, dId, cId, state));
                }
                products.Add(new Product(pId, regs));
            }

            int dCount = reader.ReadInt32();

            deffects = new ArrayList(dCount);
            for (int i = 0; i < dCount; i++)
            {
                string dId   = reader.ReadString();
                string dName = reader.ReadString();
                deffects.Add(new Deffect(dId, dName));
            }

            int wCount = reader.ReadInt32();

            workers = new ArrayList(wCount);
            for (int i = 0; i < wCount; i++)
            {
                string     wId   = reader.ReadString();
                string     wName = reader.ReadString();
                WorkerType type  = (WorkerType)
                                   Enum.Parse(typeof(WorkerType), reader.ReadString(), true);
                string password = reader.ReadString();
                workers.Add(new Worker(wId, wName, password, type));
            }
            reader.Close();
        }
        /// <summary>
        /// Occurs when phone line state has changed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void phoneLine_PhoneLineInformation(object sender, RegistrationStateChangedArgs e)
        {
            phoneLineInformation = e.State;
            Console.WriteLine("Register name:" + ((IPhoneLine)sender).SIPAccount.RegisterName);

            if (e.State == RegState.RegistrationSucceeded)
            {
                Console.WriteLine("Registration succeeded. Online.");
                OnRegistrationSucceded();
            }
            else
            {
                Console.WriteLine("Current state:" + e.State);
            }
        }
Exemple #7
0
        private void phoneLine_PhoneLineInformation(object sender, RegistrationStateChangedArgs e)
        {
            phoneLineInformation = e.State;

            InvokeGUIThread(() =>
            {
                if (phoneLineInformation == RegState.RegistrationSucceeded)
                {
                    lb_Log.Items.Add("Registration succeeded - Online");
                }
                else
                {
                    lb_Log.Items.Add("Not registered - Offline: " + phoneLineInformation.ToString());
                }
            });
        }
        private void phoneLine_PhoneLineInformation(object sender, RegistrationStateChangedArgs e)
        {
            _phoneLineInformation = e.State;

            InvokeGUIThread(() =>
            {
                if (_phoneLineInformation == RegState.RegistrationSucceeded)
                {
                    lb_Log.Items.Add("Registration succeeded - Online");
                    btnRegister.Text        = "UnRegister";
                    pbxStatus.Image         = Properties.Resources.presenceAvailable;
                    cbxStatus.SelectedIndex = 1;
                    //cbxStatus.ForeColor = Color.LightGreen;
                }
                else
                {
                    lb_Log.Items.Add("Not registered - Offline: " + _phoneLineInformation.ToString());
                    //btnRegister.Text = "Error";
                }
            });
        }
        /// <summary>
        /// This will be called when the state of a phone line has changed.
        /// </summary>
        private void Line_RegistrationStateChanged(object sender, RegistrationStateChangedArgs e)
        {
            IPhoneLine line = sender as IPhoneLine;

            if (line == null)
            {
                return;
            }

            RegState state = e.State;

            // registration succeeded, subscribe for MWI
            if (state == RegState.RegistrationSucceeded)//&& line.SIPAccount.RegistrationRequired
            {
                var subscription = line.Subscription.Create(SIPEventType.MessageSummary);
                subscription.NotificationReceived += MWISubscription_NotificationReceived;
                _subs.TryAdd(line, subscription);
                line.Subscription.Subscribe(subscription);
            }

            OnPhoneLineStateChanged(line);
            OnPropertyChanged("SelectedLine.RegisteredInfo");
        }
        /// <summary>
        /// Occurs when phone line state has changed.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void phoneLine_PhoneLineInformation(object sender, RegistrationStateChangedArgs e)
        {
            phoneLineInformation = e.State;
            Console.WriteLine("Register name:" + ((IPhoneLine)sender).SIPAccount.RegisterName);

            if (e.State == RegState.RegistrationSucceeded)
            {
                Console.WriteLine("Registration succeeded. Online.");
                OnRegistrationSucceded();
            }
            else
            {
                Console.WriteLine("Current state:" + e.State);
            }
        }