-
Notifications
You must be signed in to change notification settings - Fork 0
/
PictureFromPhoneForm.cs
60 lines (51 loc) · 1.73 KB
/
PictureFromPhoneForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Surla.Mobi.PictureFromPhone
{
[ComVisibleAttribute(true)]
public partial class PictureFromPhoneForm : Form
{
string uri;
public string Uri { get { return this.uri; } }
public PictureFromPhoneForm()
{
InitializeComponent();
this.webBrowser.ObjectForScripting = this;
this.webBrowser.DocumentCompleted += webBrowser_DocumentCompleted;
}
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (!string.IsNullOrEmpty(this.webBrowser.DocumentText)
&& this.webBrowser.DocumentText.Contains("This surla.mobi page has loaded")) {
this.labelStatus.Visible = false;
this.webBrowser.Visible = true;
}
else
{
this.labelStatus.Text = "Error accessing http://surla.mobi service, try again later.";
this.labelStatus.PerformLayout();
}
}
protected override void OnLayout(LayoutEventArgs levent)
{
base.OnLayout(levent);
this.labelStatus.Location = new Point(
(this.ClientSize.Width - this.labelStatus.Width) / 2,
(this.ClientSize.Height - this.labelStatus.Height) / 2);
}
public void PictureUploaded(string uri, string contentType)
{
this.uri = uri;
this.Close();
}
public void UploadError(string id)
{
}
}
}