void OnSkypeAttachmentStatus(TAttachmentStatus status) { log.Info("Attachment Status {0}", status); if (status == TAttachmentStatus.apiAttachAvailable) { skype.Attach(Protocol, false); } else if (status == TAttachmentStatus.apiAttachPendingAuthorization) { SkypeStatus = SkypeStatus.PendingAuthorisation; } else if (status == TAttachmentStatus.apiAttachSuccess) { log.Info("AudioIn: {0}", skype.Settings.AudioIn); log.Info("You can now place a currentCall"); SkypeStatus = SkypeStatus.WaitingForCall; } else if (status == TAttachmentStatus.apiAttachNotAvailable) { log.Warning("No longer connected to Skype"); SkypeStatus = SkypeStatus.SkypeNotRunning; } else if (status == TAttachmentStatus.apiAttachRefused) { log.Error("Attach refused"); SkypeStatus = SkypeStatus.SkypeAttachRefused; } }
private void attachStatus(TAttachmentStatus Status) { if (Status == TAttachmentStatus.apiAttachNotAvailable) { Console.WriteLine("Error: Attachment is not available."); } if (Status == TAttachmentStatus.apiAttachAvailable) { Console.WriteLine("Note: Attachment is available." + Environment.NewLine + "Attempting to attach."); skype.Attach(); } if (Status == TAttachmentStatus.apiAttachPendingAuthorization) { Console.WriteLine("Note: An attachment is awaiting."); } if (Status == TAttachmentStatus.apiAttachSuccess) { Console.WriteLine("Note: Attached to Skype."); Attached = true; } if (Status == TAttachmentStatus.apiAttachRefused) { Console.WriteLine("Error: Attachment refused."); } }
private void OnAttachementStatusChanged(TAttachmentStatus status) { if (status == TAttachmentStatus.apiAttachSuccess) { attached = true; } }
private void SkypeAttachmentStatus(TAttachmentStatus status) { try { if ((((ISkype)_skype).AttachmentStatus != TAttachmentStatus.apiAttachSuccess)) { Debug.WriteLine(string.Format("Attachment Status - Calaunchyonverted Status: {0}, TAttachmentStatus: {1}", _skype.Convert.AttachmentStatusToText((((ISkype)_skype).AttachmentStatus)), (((ISkype)_skype).AttachmentStatus))); } if (status == TAttachmentStatus.apiAttachRefused) { Debug.WriteLine("The end-user has denied the attach request"); } // End user could have changed users, try attach again. // Also maybe Skype was not running when we started and now is. if (status == TAttachmentStatus.apiAttachAvailable) { _skype.Attach(SkypeProtocol, false); } // Show are now connected to the Skype client. if (status == TAttachmentStatus.apiAttachSuccess) { Debug.WriteLine("Connected. Attachment Status - Converted Status: {0}, TAttachmentStatus: {1}", _skype.Convert.AttachmentStatusToText((((ISkype)_skype).AttachmentStatus)), (((ISkype)_skype).AttachmentStatus)); } } catch (Exception e) { Debug.WriteLine("Attachment status event exception. Source: {0}, Message: {1}", e.Source, e.Message); } }
public void Form1_AttachmentStatus(TAttachmentStatus Status) { listBox2.Items.Add("Attachment Status: " + skype.Convert.AttachmentStatusToText(Status)); if (((ISkype)skype).AttachmentStatus == TAttachmentStatus.apiAttachSuccess) { listBox2.Items.Add(skype.Chats.Count); } }
public SkypeManagerBase() { Skype = new Skype(); Skype.Reply += SkypeReply; _attachmentStatus = AttachmentStatus; _timerAttach = new Timer { Interval = 1000 }; _timerAttach.Tick += TimerAttachTick; }
public void Skype_AttachmentStatus(TAttachmentStatus status) { _blnAttached = false; // DEBUG: Write Attachment Status to Window //WriteToLog("Attachment Status: " + cSkype.Convert.AttachmentStatusToText(status)); //WriteToLog(" - " + status.ToString() + Environment.NewLine); if (status == TAttachmentStatus.apiAttachAvailable) { try { // This attaches to the Skype4COM class statement _clsSkype.Attach(7, true); } catch (Exception) { // All Skype Logic uses TRY for safety } } else if (status == TAttachmentStatus.apiAttachSuccess) { try { System.Windows.Forms.Application.DoEvents(); _objSkype.Attach(7, false); } catch (Exception) { // All Skype Logic uses TRY for safety } _blnAttached = true; _blnWasAttached = true; // If we have a queued Silent Mode request, We are attached, process it now if (_blnPendingSilentModeStartup) { _blnPendingSilentModeStartup = false; try { if (!_objSkype.SilentMode) { _objSkype.SilentMode = true; } } catch (Exception) { // All Skype Logic uses TRY for safety } } } }
static void Skype_AttachmentStatus(TAttachmentStatus Status) { if (Status == TAttachmentStatus.apiAttachSuccess) { IsReady = true; OnReady(EventArgs.Empty); } if (Status == TAttachmentStatus.apiAttachRefused) { OnDenied(EventArgs.Empty); } }
private void SkypeAttachmentStatus(TAttachmentStatus status) { switch (status) { case TAttachmentStatus.apiAttachAvailable: _skype.Attach(SKYPE_PROTOCOL, WAIT_FOR_ATTACH); break; case TAttachmentStatus.apiAttachSuccess: IsAttached = true; break; } }
void OnSkypeAttachmentStatus(TAttachmentStatus status) { log.Info("Attachment Status {0}", status); if (status == TAttachmentStatus.apiAttachAvailable) { skype.Attach(Protocol, false); } if (status == TAttachmentStatus.apiAttachSuccess) { log.Info("AudioIn: {0}", skype.Settings.AudioIn); log.Info("You can now place a call"); } }
static void Skype_AttachmentStatus( TAttachmentStatus Status ) { if ( Status == TAttachmentStatus.apiAttachSuccess ) { IsReady = true; OnReady( EventArgs.Empty ); } if ( Status == TAttachmentStatus.apiAttachRefused ) { OnDenied( EventArgs.Empty ); } }
private void AttachChange(TAttachmentStatus status) { if (status == TAttachmentStatus.apiAttachSuccess) { load.IsIndeterminate = false; //Отключаем прогресс бар EnabledOrDisable(true); //Включаем элементы формы. } else { load.IsIndeterminate = true; //Включаем прогресс бар skype.Attach();// Подключаемся к Skype EnabledOrDisable(false); //Отключаем элементы формы. } }
/// <summary> /// AttachmentStatusに変化があったらChangeAttachmentStatusイベントを発生させるタイマーのイベントハンドラー /// </summary> private void TimerAttachTick(object sender, EventArgs e) { var before = _attachmentStatus; var now = AttachmentStatus; if (before != now) { if (ChangeAttachmentStatus != null) { ChangeAttachmentStatus(this, new ChangeAttachmentStatusEventArgs(before, now)); } _attachmentStatus = now; } }
public void OurAttachmentStatus(TAttachmentStatus status) { try { if (status == TAttachmentStatus.apiAttachAvailable) { skype.Attach(9, false); } if (status == TAttachmentStatus.apiAttachSuccess) { AsyncOperation ao = AsyncOperationManager.CreateOperation(skype); new AsyncOperationInvoker(wakeUpSkype).BeginInvoke(ao, null, null); } } catch (Exception) { } }
private void OnAttach(TAttachmentStatus status) { Log(String.Format("Call Stats Changed: {0}", status.ToString())); switch (status) { case TAttachmentStatus.apiAttachSuccess: loggedAsLbl.Text = string.Format("{0} ({1})", skype.CurrentUser.FullName, skype.CurrentUser.Handle); attachedBtn.Enabled = false; break; case TAttachmentStatus.apiAttachNotAvailable: case TAttachmentStatus.apiAttachUnknown: case TAttachmentStatus.apiAttachPendingAuthorization: case TAttachmentStatus.apiAttachRefused: case TAttachmentStatus.apiAttachAvailable: loggedAsLbl.Text = "Please allow skype access"; attachedBtn.Enabled = true; break; } }
private void OnAttach(TAttachmentStatus status) { if (status.Equals(TAttachmentStatus.apiAttachSuccess)) { backgroundWorker1.WorkerSupportsCancellation = true; backgroundWorker1.WorkerReportsProgress = true; label27.Text = "Connected"; foreach (TabPage page in tabControl1.TabPages) { EnableTab(page, true); } label25.Text = "Hello, " + skype.CurrentUser.FullName; try { if (PremiumUtils.isPremium(skype.CurrentUserHandle)) { premium = true; label26.Text = "Premium: Yes"; } else { label26.Text = "Premium: No"; } } catch (Exception ex) { MessageBox.Show("Could not connect to premium validation Server Error Message:" + ex.Message); } Stream str = Properties.Resources.ding; SoundPlayer snd = new SoundPlayer(str); snd.Play(); } if (status.Equals(TAttachmentStatus.apiAttachRefused)) { MessageBox.Show("Could not hook into Skype"); label27.Text = "Not Connected"; } }
/// <summary> /// TAttachmentStatusを渡すと該当する簡易メッセージを返すメソッド /// </summary> /// <param name="status">取得したいTAttachmentStatus</param> /// <returns>アタッチ状態の簡易メッセージ</returns> public static string GetAttachmentStatusMessage(TAttachmentStatus status) { switch (status) { case TAttachmentStatus.apiAttachSuccess: return("Skypeへの接続に成功しています。"); case TAttachmentStatus.apiAttachAvailable: return("Skypeへ接続できます。"); case TAttachmentStatus.apiAttachNotAvailable: return("Skype側の接続準備が完了していません。"); case TAttachmentStatus.apiAttachUnknown: return("原因不明で接続できません。"); case TAttachmentStatus.apiAttachPendingAuthorization: return("接続許可申請をSkype側にリクエスト済みです。"); case TAttachmentStatus.apiAttachRefused: return("Skypeとの接続が拒否されました。"); } return(""); }
public void OurAttachmentStatus(TAttachmentStatus status) { Attached = false; // Write Attachment Status to Window this.textBox1.AppendText("Attachment Status: " + cSkype.Convert.AttachmentStatusToText(status)); this.textBox1.AppendText(" - " + status.ToString() + Environment.NewLine); this.textBox1.ScrollToCaret(); if (status == TAttachmentStatus.apiAttachAvailable) { try { // This attaches to the Skype4COM class statement cSkype.Attach(7, true); } catch (Exception) { // All Skype Logic uses TRY for safety } } else if (status == TAttachmentStatus.apiAttachSuccess) { try { // This attaches to the Skype using reference. We already sent an attach request // for the Skype class in the initialization procedure, which is how this // Attachment success was created. So now that we know we are connected // to the Skype Client, we need to Attach to the Skype Class as well. // If we don't attach to both the Skype using reference and the Skype class // reference we will never get User, Call, or Message events. This can best // be seen by starting Skype and then this Example application. You can see // that when you change your User status, Make a Call, Send or receive chat // Messages, that none of those events will be processed if this was commented // out. // It should be noted that this does cause a slight delay with the GUI when // you start this example program without the DoEvents below. System.Windows.Forms.Application.DoEvents(); skype.Attach(7, false); } catch (Exception) { // All Skype Logic uses TRY for safety } Attached = true; WasAttached = true; // If we have a queued Silent Mode request, We are attached, process it now if (PendingSilentModeStartup) { PendingSilentModeStartup = false; try { if (!skype.SilentMode) skype.SilentMode = true; } catch (Exception) { // All Skype Logic uses TRY for safety } } } else if ((status == TAttachmentStatus.apiAttachNotAvailable) && (Properties.Settings.Default.StopAtLogoffOrExit) && (WasAttached)) { this.Close(); } }
private bool Closing(TAttachmentStatus status) { return status == TAttachmentStatus.apiAttachNotAvailable && _attached; }
private void ProcessAttachmentStatus(TAttachmentStatus status) { if (status == TAttachmentStatus.apiAttachSuccess) { _attached = true; RaiseAttachedEvent(); ProcessMissedMessages(); } else if (Closing(status)) { RaiseQuitEvent(); } }
private void Skype_AttachmentStatus(TAttachmentStatus Status) { if (Logger.IsDebugEnabled) { Logger.Debug("Skype_AttachmentStatus " + Status); } if (Status == TAttachmentStatus.apiAttachSuccess) { Logger.Info("Skype Attached"); var callStatus = Skype.ActiveCalls.Count > 0 ? CallStatus.InProgress : CallStatus.None; PublishCallStatus(callStatus); var userStatus = Skype.CurrentUserStatus.ToUserStatus(); PublishUserStatus(userStatus); } else if (Status == TAttachmentStatus.apiAttachAvailable) { Skype.Attach(8, false); } else if (Status == TAttachmentStatus.apiAttachNotAvailable) { PublishUserStatus(UserStatus.None); } }
private void Skype_AttachmentStatus(TAttachmentStatus Status) { if (Logger.IsDebugEnabled) { Logger.Debug("Skype_AttachmentStatus " + Status); } if (Status == TAttachmentStatus.apiAttachSuccess) { Logger.Info("Skype Attached"); } else if (Status == TAttachmentStatus.apiAttachAvailable) { Skype.Attach(8, false); } else if (Status == TAttachmentStatus.apiAttachNotAvailable) { Logger.Info("Skype Unavailable"); } }
/// <summary> /// /// </summary> /// <param name="before">変更前のAttachmentStatus</param> /// <param name="now">変更後のAttachmentStatus</param> public ChangeAttachmentStatusEventArgs(TAttachmentStatus before, TAttachmentStatus after) { _beforeAttachmentStatus = before; _afterAttachmentStatus = after; }
private void OnAttach(TAttachmentStatus status) { // this app was successfully attached to skype }
private void Skype_AttachmentStatus(TAttachmentStatus status) { switch (status) { case TAttachmentStatus.apiAttachPendingAuthorization: break; case TAttachmentStatus.apiAttachRefused: break; case TAttachmentStatus.apiAttachSuccess: break; default: this.Logger.Debug(status.ToString()); break; } }
void SkypePopDialog_AttachmentStatus(TAttachmentStatus Status) { if (Status == TAttachmentStatus.apiAttachNotAvailable) { InitSkype(); } }
public void OurAttachmentStatus(TAttachmentStatus status) { // Always use try/catch with ANY Skype calls. try { // Write Attachment Status to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + "Attachment Status - Converted Status: " + skype.Convert.AttachmentStatusToText(status) + " - TAttachmentStatus: " + status + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + "Attachment Status Event Fired - Bad Text " + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Reset our flag that were are NOT attached in case we were. Attached = false; // Always use try/catch with ANY Skype calls. try { // If we received a API available attachment response from Skype4COM if (status == TAttachmentStatus.apiAttachAvailable) { // Always use try/catch with ANY Skype calls. try { // NOTE: Currently we also need to do a second Attach Request even after // we already sent a non-waited Attach request in our intialization // logic. // This is because if the Skype Client is running but nobody is // logged into the Skype client yet, and this is also the very // first time this program has been run with this Skype User then // there would be NO Authorization event created in the upper right // of the Skype Client window for "New Events" to authorize this // program to run with Skype. // So in this case the second attach actually creates an authorization // event in the upper right of the Skype client window under new // events, once the Skype User has logged in. Since a new event // can't be created for a user who you don't event know the user // id yet, because no user is logged on to create an new event // for them yet with the any Attach request issued prior to // login because the API is not available yet. // Please remember that your NEW authorization event request is only // present while the Skype client is running, if you were to stop // your program and then logoff/logon to the same Skype User you would // see that your Authorizaton Event, in NEW events at the upper right // of the Skype Client window is now GONE! // You can reset Properties.Settings.Default.FirstTime by checking the // "Always Start as First Time" Check Box, then stop/start this program // and then uncheck the "Always Start as First Time" check box. Please // make sure you have removed any authorization for this program first // in the Skype client and then test these conditions listed below. // Here is a list of tests to try: // 1. Skype starts with no user logged in - This program is started. // 2. Skype Auto-Logons On - This program Starts. // 3. This Program starts Skype - Skype Auto Logs On. // 4. This program is started - Skype is started later. // 5. Skype is Started - This Program is started later. // 6. This Program is started - Skype is started - stoped - started. // 7. This Program is started - Skype is started - change Skype users. // If check box not checked, we are supposed to send a waited attachment request. if (!this.NonWaitedAttachRequests.Checked) { // Write Sending Waited Attachment Request to Skype to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Waited Attachment Sent" + "\r\n"); // Send waited attachment request. // Bug Current Protocol is 8 Not 7 so we will force 8 instead of getting it from Skype4COM. // skype.Attach(skype.Protocol, true); skype.Attach(9, true); } else // Otherwise, If we are are supposed to send a non-waited attachment request, do so. { // Write Sending Non-Waited Attachment Request to Skype to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Non-Waited Attachment Sent" + "\r\n"); // Send non-waited attachment request. // Bug Current Protocol is 8 Not 7 so we will force 8 instead of getting it from Skype4COM. // skype.Attach(skype.Protocol, false); skype.Attach(9, false); } } catch (Exception e) { // Write Attachment Failed to Window, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Attachment Failed - Converted Status: " + skype.Convert.AttachmentStatusToText(status) + " - TAttachmentStatus: " + status + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); // Always use try/catch with ANY Skype calls. try { // This is just one example, of what you can do for attachment retry logic // in case the Windows system is slow try waiting twice as long for a // response. // Write our current timeout value in Milliseconds to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Doubling Timeout from : " + skype.Timeout); // Get our current timeout in Milliseconds and double it. skype.Timeout = (skype.Timeout * 2); // Write to Window our new timeout value in Milliseconds and that we are trying again. AddTextToTextBox1(" to " + skype.Timeout + " - Trying Again" + "\r\n"); // If check box not checked, we are supposed to send a waited attachment request. if (!this.NonWaitedAttachRequests.Checked) { // Write that second attachment request sent as waited to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Second Skype Attachment Request Waited Sent" + "\r\n"); } else { // Write that second attachment request sent as non-waited to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Second Skype Attachment Request Non-Waited Sent" + "\r\n"); } try { // We could have set this timer when we receive a pending attachment status // and depending on the message mix may NOT need to do it here, but we // need to check to see if the timer is already set, if it is, let it be, not, set it. if ((!OurPendingAuthTimer.Enabled) && (Properties.Settings.Default.FirstTime)) { OurPendingAuthTimer.Interval = 1; // Set Timer to Expire right away. OurPendingAuthTimer.Start(); // To Prompt User To Approve this program. System.Threading.Thread.Sleep(300); // We are a single thread. System.Windows.Forms.Application.DoEvents(); // Let's make sure this fires now. } } catch (Exception ee) { // Possibly program not authorized, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Not Able To Set Second Attempt Waited Timer" + " - Exception Source: " + ee.Source + " - Exception Message: " + ee.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // If check box not checked, we are supposed to send a waited attachment request. if (!this.NonWaitedAttachRequests.Checked) { // Send waited attachment request. // Bug Current Protocol is 8 Not 7 so we will force 8 instead of getting it from Skype4COM. // skype.Attach(skype.Protocol, true); skype.Attach(9, true); } else // Send non-waited attachment request. // Bug Current Protocol is 8 Not 7 so we will force 8 instead of getting it from Skype4COM. skype.Attach(9, false); } catch (Exception eee) { // Technically, we can still attach at anytime as long as the Skype // Client is NOT stopped. The New Event will remain in the New // Events located in the upper right of the Skype client window // but we don't want to loop forever here. If the Skype User by // this time can't figure out how to authorize this, well then there // are big problems, so let's stop retrying. // Possibly program not authorized, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Not Able To Attach - Please Restart This Program" + " - Exception Source: " + eee.Source + " - Exception Message: " + eee.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } } } else // If we received an attachment response from Skype4COM of success. if (status == TAttachmentStatus.apiAttachSuccess) { // Reset our flag that we are now attached to the Skype client. Attached = true; // If we were pending authorization and set our timer, stop it. if (OurPendingAuthTimer.Enabled) OurPendingAuthTimer.Stop(); // Always use try/catch with ANY Skype calls. try { // If the check box is for Set Silent Mode is check, and Silent Mode is false, set Silent Mode to true. if ((this.EnableSilentMode.Checked) && (!skype.SilentMode)) { // Always use try/catch with ANY Skype calls. try { // Set Silent Mode to true. skype.SilentMode = true; // Write that Silent Mode has been set to true to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Skype Silent Mode Set To: " + skype.SilentMode + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Skype Silent Mode Set Failed" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } } } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Unable to Check Skype Silent Mode" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // If we were never attached since we started this time. if (!WasAttached) { // Set Our flag that since we started we at least once were attached to Skype. WasAttached = true; // If this was our first time running and the check box is not set to always run as if it was // our first time, save the fact that next time will not be our first time running and that we // in fact were approved by this Skype User. Note: This Windows user could have many Skype // names, so we will still prompt for Program approval if we wait more than 30 seconds after // we receive a pending authorization attachment response without receving a successful // attachment response. if ((Properties.Settings.Default.FirstTime) && (!this.FirstTimeAlwaysTrue.Checked)) Properties.Settings.Default.FirstTime = false; // **** After the initial successful attach one time logic goes here if needed. **** // **** Then event logic will drive the program afterwards. **** // **** In our case we have no code to add here besides the above. **** // **** But...be careful because you could stick around after a **** // **** Skype user logs off and then logs in again or with a **** // **** different Skype name depending on the check box settings **** // **** to false if this program exits on Skype user logoff or stop. **** } // Write that this is our start of Initializaton logic to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Begin" + "\r\n"); // Always use try/catch with ANY Skype calls. try { // Write some Skype general information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Skype Ver: " + skype.Version + " - Skype4COM Ver: " + skype.ApiWrapperVersion + " - Protocol: " + skype.Protocol + " - Timeout: " + skype.Timeout + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // Write some Skype privilage information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " User: "******" - SkypeOut: " + skype.get_Privilege("SKYPEOUT") + " - SkypeIn: " + skype.get_Privilege("SKYPEIN") + " - Voicemail: " + skype.get_Privilege("VOICEMAIL") + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // Write some Skype profile information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " PSTN Balance Currency: " + skype.get_Profile("PSTN_BALANCE_CURRENCY") + " - PSTN Balance: " + skype.get_Profile("PSTN_BALANCE") + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // Write some Skype profile information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Calls Go To Voicemail: " + skype.get_Profile("CALL_SEND_TO_VM") + " - Calls Go To Call Forwarding: " + skype.get_Profile("CALL_APPLY_CF") + " - Call Forward Rules: " + skype.get_Profile("CALL_FORWARD_RULES") + " - SMS Validated Numbers: " + skype.get_Profile("SMS_VALIDATED_NUMBERS") + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // Write some Skype general settings and profile information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Language: " + skype.Settings.Language + " - Predictive Dialer Country: " + skype.PredictiveDialerCountry + " - IP Country: " + skype.get_Profile("IPCOUNTRY") + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // Write some Skype settings information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Audio In: " + skype.Settings.AudioIn + " - Audio Out: " + skype.Settings.AudioOut + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Always use try/catch with ANY Skype calls. try { // **** API/Skype4COM Bug with VideoIn when Default Device is selected has no value **** // Write some Skype settings and general information to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": "); // Check for Length on This, and warn about changing. if (skype.Settings.VideoIn.Length == 0) AddTextToTextBox1(" Video In: Change Skype Video Options to Specific CAM to see value, API/Skype4COM Bug"); else AddTextToTextBox1(" Video In: " + skype.Settings.VideoIn); // Write end of line and new line. AddTextToTextBox1("\r\n"); // Write some Skype settings to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Auto Away: " + skype.Settings.AutoAway + " - PC Speaker: " + skype.Settings.PCSpeaker + " - Ringer: " + skype.Settings.Ringer + " - Users waiting for authorization: " + skype.UsersWaitingAuthorization.Count + "\r\n"); // Write some Skype settings to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " AEC: " + skype.Settings.AEC + " - AGC: " + skype.Settings.AGC + " - Voicemails: " + skype.Voicemails.Count + // This syntax can be used to remove ambiguity which would occur if we used // skype.Mute because there is also a Mute Event. So this syntax // solves the problem. // Write Skype General information to Window. " - Mute: " + (((ISkype)skype).Mute) + "\r\n"); } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - Bad Skype4COM version Should be at least 1.0.31.0" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } // Write end of our initialization to Window. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Initialization Logic - End" + "\r\n"); } else // If we received a API not available attachment response from Skype4COM and we were attached. if ((status == TAttachmentStatus.apiAttachNotAvailable) && (WasAttached)) { // If Exit On Skype Stop Check Box is Checked quit. if (this.SkypeStop.Checked) { TheNotifyIconExample_TimeToExit = true; this.Close(); } } else // If we received a pending authorization attachment response from Skype4COM. if (status == TAttachmentStatus.apiAttachPendingAuthorization) { // Is this the first time this Windows User used this program? If so, do this. if (Properties.Settings.Default.FirstTime) { try { // We could have set this timer in our attachment request and depending // on the message mix need to possbibly do it here, but we need to check // to see if the timer is already set, if it is, let it be, if not, set it. if (!OurPendingAuthTimer.Enabled) { OurPendingAuthTimer.Interval = 1; // Set Timer to Expire right away. OurPendingAuthTimer.Start(); // To Prompt User To Approve this program. System.Threading.Thread.Sleep(300); // We are a single thread. System.Windows.Forms.Application.DoEvents(); // Let's make sure this fires now. } } catch (Exception e) { // System Timer start problem, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Unable To Set OurPendingAuthTimer FirstTime" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } } else // This is NOT the first time this Windows User used this program, could be another Skype Name // being used by the SAME Windows user, or the original approval for this program // was deleted so, let's wait 30 seconds for the attachment request to complete // before we display this warning message. If we receive a attachment success message // before 30 seconds passes, we will cancel the timer and the warning message will not appear. { try { // We could have set this timer in our waited attachment request and depending // on the message mix need to possbibly do it here, but we need to check // to see if the timer is already set, if it is, let it be, if not, set it. if (!OurPendingAuthTimer.Enabled) { OurPendingAuthTimer.Interval = 30000; // Set Timer to Expire in 30 seconds. OurPendingAuthTimer.Start(); // To Prompt User To Approve this program. } } catch (Exception e) { // System Timer start problem, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - Unable To Set OurPendingAuthTimer" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } } } else // When you change the authorization record in the Skype client // from deny to approved, a Status event of Language changed // is received. This is a API/Skype4COM bug. // If we received a refused attachment response from Skype4COM. if (status == TAttachmentStatus.apiAttachRefused) { // The User has Denied the Program. // Let's make sure they know how to fix this. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + " Our Code - You have denied this program." + " - To undo this On the Skype Client window" + " - Click Tools -> Options -> Advanced ->" + " Manage other programs access to Skype and" + " delete or change the entry for this program" + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } } catch (Exception e) { // Possibly old Skype4COM version, log an error, drop into debug if wanted. AddTextToTextBox1(DateTime.Now.ToLocalTime() + ": " + "Attachment Event Fired - Unable to Query Attachment Status" + " - Exception Source: " + e.Source + " - Exception Message: " + e.Message + "\r\n"); // If the "Use Auto Debug" check box is checked and we are in debug, drop into debug here when retry, otherwise, prompt for action. Debug.Assert(!this.UseAutoDebug.Checked); } }
public void OurAttachmentStatus(TAttachmentStatus status) { Attached = false; // Write Attachment Status to Window this.textBox1.AppendText("Attachment Status: " + cSkype.Convert.AttachmentStatusToText(status)); this.textBox1.AppendText(" - " + status.ToString() + Environment.NewLine); this.textBox1.ScrollToCaret(); if (status == TAttachmentStatus.apiAttachAvailable) { try { // This attaches to the Skype4COM class statement cSkype.Attach(7, true); } catch (Exception) { // All Skype Logic uses TRY for safety } } else if (status == TAttachmentStatus.apiAttachSuccess) { try { // This attaches to the Skype using reference. We already sent an attach request // for the Skype class in the initialization procedure, which is how this // Attachment success was created. So now that we know we are connected // to the Skype Client, we need to Attach to the Skype Class as well. // If we don't attach to both the Skype using reference and the Skype class // reference we will never get User, Call, or Message events. This can best // be seen by starting Skype and then this Example application. You can see // that when you change your User status, Make a Call, Send or receive chat // Messages, that none of those events will be processed if this was commented // out. // It should be noted that this does cause a slight delay with the GUI when // you start this example program without the DoEvents below. System.Windows.Forms.Application.DoEvents(); skype.Attach(7, false); } catch (Exception) { // All Skype Logic uses TRY for safety } Attached = true; WasAttached = true; // If we have a queued Silent Mode request, We are attached, process it now if (PendingSilentModeStartup) { PendingSilentModeStartup = false; try { if (!skype.SilentMode) { skype.SilentMode = true; } } catch (Exception) { // All Skype Logic uses TRY for safety } } } else if ((status == TAttachmentStatus.apiAttachNotAvailable) && (Properties.Settings.Default.StopAtLogoffOrExit) && (WasAttached)) { this.Close(); } }