Ejemplo n.º 1
0
        private bool UpdatePresenceInfo(string settingAvailablity, string personalNote)
        {
            //NOTE: in this context a null personal note means we dont want to change it.
            //Null is a valid way to clear an existing personal note so we handle this within

            //Update Presence Info
            if (settingAvailablity == "Sign Out" && lync.LyncClientSignedIn)
            {
                processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                lync.ClientSignOut();

                return(true);
            }
            else if (settingAvailablity == "Sign In" && lync.LyncClientLoaded)
            {
                processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                lync.ClientSignIn();

                return(true);
            }
            else if (settingAvailablity == "Sign In - Available" && lync.LyncClientLoaded)
            {
                lync.ClientSignIn();

                if (lync.LyncClientSignedIn)
                {
                    //lync.SetAvailabilityInfo("Available", settingPersonalNote);
                    SetAvailabilityInfoHelper("Available", personalNote);

                    processIcon.BalloonTip(
                        processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + settingAvailablity + Environment.NewLine +
                        "Personal Note: " + personalNote, balloonTipTime);

                    return(true);
                }
            }
            else if (lync.LyncClientSignedIn)
            {
                if (settingAvailablity == "Off Work")
                {
                    //lync.SetAvailabilityInfo(settingAvailablity, "off-work", settingPersonalNote);
                    SetAvailabilityInfoHelper(settingAvailablity, "off-work", personalNote);
                }
                else
                {
                    SetAvailabilityInfoHelper(settingAvailablity, personalNote);
                }

                //processIcon.BalloonTip(processFriendlyName + " Status Change",
                //    "Availability: " + settingAvailablity + Environment.NewLine +
                //    "Personal Note: " + settingPersonalNote, balloonTipTime);

                BalloonTipStatusChangeHelper(settingAvailablity, personalNote);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void ProcessPresenceSwitcher()
        {
            //Determine active timers
            ActiveTimers();

            //IDLE TIMER
            //SetMeAs idle timer - Set me as xx after xx idle time...
            //If idle active and timed not active
            if (presenceTimerSetMeAs1Active && !presenceTimerSetMeAs2Active)
            {
                if (!presenceTimerSetMeAs1ActiveProcessed)
                {
                    if (SystemIdleTimer1.IsRunning == false)
                    {
                        //SystemIdleTimer1.MaxIdleTime = CUInt(numOfSeconds.Value * 1000) ' seconds to miliseconds
                        SystemIdleTimer1.MaxIdleTime = Convert.ToUInt32(Settings.PsSetMeAsTime1);
                        SystemIdleTimer1.Start();

                        presenceTimerSetMeAs1ActiveProcessed = true;
                    }
                    else
                    {
                        SystemIdleTimer1.Stop();
                        presenceTimerSetMeAs1ActiveProcessed = false;
                    }
                }
            }
            //Stop timer if disabled: SetMeAs idle timer - Set me as xx after xx idle time...
            else //if (!presenceTimerSetMeAs1Active)
            {
                //If the timer is still running after it has been disabled, stop it
                if (SystemIdleTimer1.IsRunning)
                {
                    SystemIdleTimer1.Stop();
                }
            }

            //SET PRESENCE
            //Processed from bottom up, overlapping time ranges will be overided
            //Set presence for SetMeAs timer - Set me as xx for xx
            if (presenceTimerSetMeAs2Active)
            {
                if (!presenceTimerSetMeAs2ActiveProcessed)
                {
                    //start timer
                    SetMeAsForPresenceTimer();
                    presenceTimerSetMeAs2ActiveProcessed = true;
                }
            }
            //Set presence for timer ranges
            else if (presenceTimer5Active)
            {
                if (!presenceTimer5ActiveProcessed)
                {
                    if (Settings.PsAvailability5 == "Sign Out" && lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                        lync.ClientSignOut();

                        presenceTimer5ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability5 == "Sign In" && lync.LyncClientLoaded && !lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                        lync.ClientSignIn();

                        presenceTimer5ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability5 == "Sign In - Available" && lync.LyncClientLoaded && !lync.LyncClientSignedIn)
                    {
                        lync.ClientSignIn();

                        if (lync.LyncClientSignedIn) //lync.GetClientState() == "SignedIn")
                        {
                            lync.SetAvailabilityInfo("Available", Settings.PsPersonalNote5);

                            processIcon.BalloonTip(
                                processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + Settings.PsAvailability5 + Environment.NewLine +
                                "Personal Note: " + Settings.PsPersonalNote5, balloonTipTime);

                            presenceTimer5ActiveProcessed = true;
                        }
                    }
                    else if (lync.LyncClientSignedIn)
                    {
                        if (Settings.PsAvailability5 == "Off Work")
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability5, "off-work", Settings.PsPersonalNote5);
                        }
                        else
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability5, Settings.PsPersonalNote5);
                        }

                        processIcon.BalloonTip(
                            processFriendlyName + " Status Change", "Availability: " + Settings.PsAvailability5 + Environment.NewLine +
                            "Personal Note: " + Settings.PsPersonalNote5, balloonTipTime);

                        presenceTimer5ActiveProcessed = true;
                    }
                }
            }
            else if (presenceTimer4Active)
            {
                if (!presenceTimer4ActiveProcessed)
                {
                    if (Settings.PsAvailability4 == "Sign Out" && lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                        lync.ClientSignOut();

                        presenceTimer4ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability4 == "Sign In" && lync.LyncClientLoaded)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                        lync.ClientSignIn();

                        presenceTimer4ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability4 == "Sign In - Available" && lync.LyncClientLoaded)
                    {
                        lync.ClientSignIn();

                        if (lync.LyncClientSignedIn)
                        {
                            lync.SetAvailabilityInfo("Available", Settings.PsPersonalNote4);

                            processIcon.BalloonTip(
                                processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + Settings.PsAvailability4 + Environment.NewLine +
                                "Personal Note: " + Settings.PsPersonalNote4, balloonTipTime);

                            presenceTimer4ActiveProcessed = true;
                        }
                    }
                    else if (lync.LyncClientSignedIn)
                    {
                        if (Settings.PsAvailability4 == "Off Work")
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability4, "off-work", Settings.PsPersonalNote4);
                        }
                        else
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability4, Settings.PsPersonalNote4);
                        }

                        processIcon.BalloonTip(
                            processFriendlyName + " Status Change", "Availability: " + Settings.PsAvailability4 + Environment.NewLine +
                            "Personal Note: " + Settings.PsPersonalNote4, balloonTipTime);

                        presenceTimer4ActiveProcessed = true;
                    }
                }
            }
            else if (presenceTimer3Active)
            {
                if (!presenceTimer3ActiveProcessed)
                {
                    if (Settings.PsAvailability3 == "Sign Out" && lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                        lync.ClientSignOut();

                        presenceTimer3ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability3 == "Sign In" && lync.LyncClientLoaded)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                        lync.ClientSignIn();

                        presenceTimer3ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability3 == "Sign In - Available" && lync.LyncClientLoaded)
                    {
                        lync.ClientSignIn();

                        if (lync.LyncClientSignedIn)
                        {
                            lync.SetAvailabilityInfo("Available", Settings.PsPersonalNote3);

                            processIcon.BalloonTip(
                                processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + Settings.PsAvailability3 + Environment.NewLine +
                                "Personal Note: " + Settings.PsPersonalNote3, balloonTipTime);

                            presenceTimer3ActiveProcessed = true;
                        }
                    }
                    else if (lync.LyncClientSignedIn)
                    {
                        if (Settings.PsAvailability3 == "Off Work")
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability3, "off-work", Settings.PsPersonalNote3);
                        }
                        else
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability3, Settings.PsPersonalNote3);
                        }

                        processIcon.BalloonTip(
                            processFriendlyName + " Status Change", "Availability: " + Settings.PsAvailability3 + Environment.NewLine +
                            "Personal Note: " + Settings.PsPersonalNote3, balloonTipTime);

                        presenceTimer3ActiveProcessed = true;
                    }
                }
            }
            else if (presenceTimer2Active)
            {
                if (!presenceTimer2ActiveProcessed)
                {
                    if (Settings.PsAvailability2 == "Sign Out" && lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                        lync.ClientSignOut();

                        presenceTimer2ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability2 == "Sign In" && lync.LyncClientLoaded)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                        lync.ClientSignIn();

                        presenceTimer2ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability2 == "Sign In - Available" && lync.LyncClientLoaded)
                    {
                        lync.ClientSignIn();

                        if (lync.LyncClientSignedIn)
                        {
                            lync.SetAvailabilityInfo("Available", Settings.PsPersonalNote2);

                            processIcon.BalloonTip(
                                processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + Settings.PsAvailability2 + Environment.NewLine +
                                "Personal Note: " + Settings.PsPersonalNote2, balloonTipTime);

                            presenceTimer2ActiveProcessed = true;
                        }
                    }
                    else if (lync.LyncClientSignedIn)
                    {
                        if (Settings.PsAvailability2 == "Off Work")
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability2, "off-work", Settings.PsPersonalNote2);
                        }
                        else
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability2, Settings.PsPersonalNote2);
                        }

                        processIcon.BalloonTip(
                            processFriendlyName + " Status Change", "Availability: " + Settings.PsAvailability2 + Environment.NewLine +
                            "Personal Note: " + Settings.PsPersonalNote2, balloonTipTime);

                        presenceTimer2ActiveProcessed = true;
                    }
                }
            }
            else if (presenceTimer1Active)
            {
                if (!presenceTimer1ActiveProcessed)
                {
                    if (Settings.PsAvailability1 == "Sign Out" && lync.LyncClientSignedIn)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                        lync.ClientSignOut();

                        presenceTimer1ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability1 == "Sign In" && lync.LyncClientLoaded)
                    {
                        processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                        lync.ClientSignIn();

                        presenceTimer1ActiveProcessed = true;
                    }
                    else if (Settings.PsAvailability1 == "Sign In - Available" && lync.LyncClientLoaded)
                    {
                        lync.ClientSignIn();

                        if (lync.LyncClientSignedIn)
                        {
                            lync.SetAvailabilityInfo("Available", Settings.PsPersonalNote1);

                            processIcon.BalloonTip(
                                processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + Settings.PsAvailability1 + Environment.NewLine +
                                "Personal Note: " + Settings.PsPersonalNote1, balloonTipTime);

                            presenceTimer1ActiveProcessed = true;
                        }
                    }
                    else if (lync.LyncClientSignedIn)
                    {
                        if (Settings.PsAvailability1 == "Off Work")
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability1, "off-work", Settings.PsPersonalNote1);
                        }
                        else
                        {
                            lync.SetAvailabilityInfo(Settings.PsAvailability1, Settings.PsPersonalNote1);
                        }

                        processIcon.BalloonTip(
                            processFriendlyName + " Status Change", "Availability: " + Settings.PsAvailability1 + Environment.NewLine +
                            "Personal Note: " + Settings.PsPersonalNote1, balloonTipTime);

                        presenceTimer1ActiveProcessed = true;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private bool UpdatePresenceInfo(string settingAvailablity, string settingPersonalNote)
        {
            //Get Current Presenece Info
            //TODO

            //Get calculated personal note
            var personalNote = PersonalNoteHelper(settingPersonalNote);


            //Update Presence Info
            if (settingAvailablity == "Sign Out" && lync.LyncClientSignedIn)
            {
                processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing Out", balloonTipTime);
                lync.ClientSignOut();

                return(true);
            }
            else if (settingAvailablity == "Sign In" && lync.LyncClientLoaded)
            {
                processIcon.BalloonTip(processFriendlyName + " Status Change", "Signing In", balloonTipTime);
                lync.ClientSignIn();

                return(true);
            }
            else if (settingAvailablity == "Sign In - Available" && lync.LyncClientLoaded)
            {
                lync.ClientSignIn();

                if (lync.LyncClientSignedIn)
                {
                    //lync.SetAvailabilityInfo("Available", settingPersonalNote);
                    SetAvailabilityInfoHelper("Available", personalNote);

                    processIcon.BalloonTip(
                        processFriendlyName + " Status Change", "Signing In..." + Environment.NewLine + "Availability: " + settingAvailablity + Environment.NewLine +
                        "Personal Note: " + personalNote, balloonTipTime);

                    return(true);
                }
            }
            else if (lync.LyncClientSignedIn)
            {
                if (settingAvailablity == "Off Work")
                {
                    //lync.SetAvailabilityInfo(settingAvailablity, "off-work", settingPersonalNote);
                    SetAvailabilityInfoHelper(settingAvailablity, "off-work", personalNote);
                }
                else
                {
                    SetAvailabilityInfoHelper(settingAvailablity, personalNote);
                }

                //processIcon.BalloonTip(processFriendlyName + " Status Change",
                //    "Availability: " + settingAvailablity + Environment.NewLine +
                //    "Personal Note: " + settingPersonalNote, balloonTipTime);

                BalloonTipStatusChangeHelper(settingAvailablity, personalNote);

                return(true);
            }

            return(false);
        }