I would expect next code to launch the chrome extension of my 3cx softphone the same way an html link call me would do.
But it just opens google chrome default page and no number is dialed on softphone extension.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start("tel:+34555555555")
End Sub
Am I missing anything?
After some research it seems 3cx needs extra attribute tcxhref on anchor to do the job.
In order to launch the dialer with the proper phone number on it I had to publish an ASP MVC page which clicks the anchor on loading.
This is the Html code:
<body onload="autodial()">
<a id="callme" href="tel:#(Model)" tcxhref="#(Model)" ></a>
<script>
function autodial() {
document.getElementById('callme').click();
window.close();
}
</script>
</body>
This is how the MVC controller looks like:
Public Class Cx3Controller
Function MakeCall(id As String) As ActionResult
Return View(viewName:="MakeCall", model:=id)
End Function
End Class
And this is how to invoke it from winforms:
Shared Sub MakeCall(telnum As String)
Process.Start("chrome.exe", "https://www.mywebsite.com/cx3/makecall/" & telnum)
End Sub
Related
I've been searching the net for a basic sample winforms app that is written in vb.net to upload a file to onedrive. Does anyone know of any?
I'm trying to get a file uploaded with a winforms app in vb.net. I'm as far as getting the auth working... but calling the next method returns a 401...
I did the following:
Shared scope As String = "wl.skydrive_update"
Shared client_id As String = "0000000040144E26"
Shared signInUrl As New Uri([String].Format("https://login.live.com/oauth20_authorize.srf?client_id={0}&redirect_uri=https://login.live.com/oauth20_desktop.srf&response_type=code&scope={1}", client_id, scope))
Private Sub cmdOneDriveAuth_Click(sender As Object, e As EventArgs) Handles cmdOneDriveAuth.Click
Try
Dim auth As New FrmAuthBrowser
auth.WebBrowser1.Navigate(signInUrl)
auth.Show()
Catch ex As Exception
End Try
End Sub
and then in the auth window:
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Try
If WebBrowser1.Url.AbsoluteUri.Contains("code=") Then
Dim AuthCode As String = System.Web.HttpUtility.ParseQueryString(WebBrowser1.Url.Query)("code")
My.Settings.OneDrive_Enabled = True
My.Settings.OneDrive_AuthCode = AuthCode
My.Settings.Save()
Me.Dispose()
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
but when I try and get the root info, I get a 401...
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
Dim client As New WebClient()
Dim result = client.OpenRead(New Uri("https://apis.live.net/v5.0/me/skydrive?access_token=" + My.Settings.OneDrive_AuthCode))
Dim sr As StreamReader = New StreamReader(result)
MsgBox(sr.ReadToEnd())
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Can anyone provide me with some guidance?
Looks like you're using the 'code' flow of OAuth, but you're missing a step. The 'code' you get back isn't the same as the access_token. You need to make another call to the login server first to exchange your code for an access_token.
POST https://login.live.com/oauth20_token.srf
Content-Type: application/x-www-form-urlencoded
client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret}
&code={code}&grant_type=authorization_code
You can find more details here http://onedrive.github.io/auth/msa_oauth.htm#code-flow.
OneDrive just released a new API, so I would encourage you to check it out. http://onedrive.github.io/
There's also a sample Windows/C# app that you can look at for reference on how to sign in and upload files. https://github.com/OneDrive/onedrive-explorer-win
I have a WPF application that I would like to configure to use NBug to send error reports via email.
The config tool works correctly, and I receive a test email, but when adding NBug to the application and triggering an uncaught exception, I do not receive an email. The only configuration I have done matches the Getting Started guide (loosely translated to VB.Net).
Private Sub Application_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
AddHandler AppDomain.CurrentDomain.UnhandledException, NBug.Handler.UnhandledException
AddHandler Application.Current.DispatcherUnhandledException, NBug.Handler.DispatcherUnhandledException
AddHandler TaskScheduler.UnobservedTaskException, NBug.Handler.UnobservedTaskException
NBug.Settings.UIMode = NBug.Enums.UIMode.Full
NBug.Settings.StoragePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
NBug.Settings.AddDestinationFromConnectionString("Type=Mail;From=bugs#xxx.com;Port=465;SmtpServer=smtp.gmail.com;To=support#xxx.com;UseAttachment=True;UseAuthentication=True;UseSsl=True;Username=bugs#xxx.com;Password=xxx;")
NBug.Settings.ReleaseMode = True
End Sub
The above code has removed username/password from our gmail account that is used for bug reports.
Any ideas what is wrong with the config or how I could debug?
The zip file attachment is being generated, but no email is sent.
Simply use NBug.Settings.ReleaseMode = true; as described in this intro post: http://www.soygul.com/nbug/
This is the original Nevron example code:
static class Program
{
[STAThread]
static void Main()
{
App app = new App();
NModule[] modules = new NModule[] {
// TODO: Create modules here
};
NNOVApplicationInstaller.Install(modules);
app.Run(new MainWindow());
}
}
And this is my rough approximation:
Public NotInheritable Class Program
Private Sub New()
End Sub
<STAThread> _
Shared Sub Main()
Dim app As Application = New Application()
Dim modules As NModule() = New NModule() {}
NNOVApplicationInstaller.Install(modules)
app.Run(New MainWindow)
End Sub
End Class
Yet when I try and compile, I get this brain frazzling error:
'Sub Main' is declared more than once in 'DataMonitor.Visuals': DataMonitor.Visuals.Program.Main(), DataMonitor.Visuals.Application.Main() DataMonitor.Visuals
Yet There is no Main anywhere else in the entire project, only in my class.
By default, the Application Framework is enabled for VB.NET projects. That creates the Main method for you in code that you can't access. If you want to write your own Main method then you have to disable the Application Framework in the project properties.
Note that, with the Application Framework enabled, you're supposed to handle the Startup event of the application, which you can access from the project properties also. That event is raised from the auto-generated Main method.
My application has a webbrowser control that works fine with most sites, but is having trouble with pages intended to play MP3s.
The code below sends the URLs to webViewer, my WebBrowser control. Regular pages work, however, one like this does not, and results in the browser displaying a white page with the "x" shown in the image at the top left. The page does load properly in Internet Explorer and displays a QuickTime player that plays the file.
Private Sub NavigateTo(ByVal webAddress As String)
Try
If String.IsNullOrEmpty(webAddress.Trim()) Then
MsgBox("This link is under construction...")
Return
Else
If webAddress.Contains("http://") = False Then webAddress = "http://" & webAddress
Dim navPage As New Uri(webAddress)
webViewer.Source = navPage
End If
Catch ex As Exception
MsgBox("The URL for this button is invalid. Please contact AzTech IT for help.", MsgBoxStyle.OkOnly, "Satellite Tablet Application")
ErrorHandler.Helpers.LogMessage(ex.Message)
End Try
End Sub
Is there a workaround for this issue?
In our application we open a splashscreen for the intial loading of the login screen, this logonscreen is shown async.
when we close the splashscreen sometimes we get following error:
System.ComponentModel.Win32Exception was unhandled. Message="The operation completed successfully"
I figured out this has something to do with loosing focus and it's a known bug in .net 3.5.
However I did not find a solution to fix this in my code. And we are unable to upgrade the application to 4.0.
I allready tried: Application.Current.MainWindow.Focus() but this doens't work since i'm not on the correct thread due to the async call
I hope somebody had this problem before and can provide me a working fix for this bug.
This is the code and the splashscreen comes from system.windows.dll:
Public Sub New(ByVal splashResourceName As String)
logonSplash = New SplashScreen(splashResourceName)
logonSplash.Show(False)
InitializeComponent()
GetAllInfo()
DataContext = context
End Sub
Private Sub LoginDialog_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
'Focus()
If logonSplash IsNot Nothing Then
logonSplash.Close(Nothing)
logonSplash = Nothing
End If
txtPassword.Focus()
End Sub