protected override async void OnAppearing() { if (CheckConnection.validate()) { bool validate = await CheckAuth.validate(); if (!validate) { App.Current.MainPage = new NavigationPage(new Login()); } else { await makeTimeline(); string screen = Settings.config_screen; double s = Convert.ToDouble(screen); MainRelative.HeightRequest = s; } } else { App.Current.MainPage = new NavigationPage(new FailConnection()); } base.OnAppearing(); }
public static ListMessagesResponse Sent() { LoadKind = 2; // Check connection if (CheckConnection.Check() == false) { return(null); } // Define parameter for request UsersResource.MessagesResource.ListRequest MessageRequest = Connect.service.Users.Messages.List("me"); MessageRequest.LabelIds = "SENT"; MessageRequest.MaxResults = int.MaxValue; // Get mail include spam trash? MessageRequest.IncludeSpamTrash = false; // NO // Make a request try { return(MessageRequest.Execute()); } catch (Exception) { if (LoadKind == 2) { MessageBox.Show("Sorry! SENT is Empty!", "EMPTY!", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(null); } }
protected override async void OnAppearing() { if (CheckConnection.validate()) { bool validate = await CheckAuth.validate(); if (validate) { await Navigation.PushModalAsync(new Timeline()); } else { loader.IsVisible = false; formLogin.IsVisible = true; btRemember.IsVisible = true; } } else { App.Current.MainPage = new NavigationPage(new FailConnection()); } base.OnAppearing(); }
/// <summary> /// Prevents a default instance of the <see cref="GUIClient"/> class from being created. /// </summary> private GUIClient() { clientChannel = new TCPClientChannel(); clientChannel.OnMessageFromServer += ReceiveMessageFromServer; clientChannel.DisconnectedFromServer += OnDisconnectFromServer; isConnected = clientChannel.ConnectToServer(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8000)); CheckConnection?.Invoke(this, isConnected); }
public WebViewClientClass(Activity mActivity, WebView _webviewApi, LinearLayout progressbar, LinearLayout contentWebview) { this.mActivity = mActivity; this.webviewApi = _webviewApi; this.progressbar = progressbar; this.contentWebview = contentWebview; ApiService = new ApiConsumer(); CheckConnection = new CheckConnection(); }
private void button1_Click(object sender, EventArgs e) { if (!CheckConnection.check()) { label1.Text = "Error"; } else { label1.Text = "Opened"; } }
private void btnFindPerson_Click(object sender, System.EventArgs e) { // Instantiate Web Service GeoPhone geoPhone = new GeoPhone(); // Reset all controls to default resetControls(); // Show wait cursor Cursor.Current = Cursors.WaitCursor; try { // Check that server is available over HTTP (port 80) if (CheckConnection.Once(geoPhone.Url)) { // Get address Contact Person = geoPhone.GetPhoneInfo(txtPhoneNumber.Text, "0").Contacts[0]; // Display address txtName.Text = Person.Name; txtAddress.Text = Person.Address; txtCity.Text = Person.City; txtState.Text = Person.State; txtZip.Text = Person.Zip; this.btnYellowPages.Enabled = true; } else { // No connection! MessageBox.Show("Connection to Web Service server could not be established!"); } } catch (Exception ex) { // Disable Save As Contact button this.btnYellowPages.Enabled = false; MessageBox.Show("Could not make Web Service calls (" + ex.Message + ")!"); } finally { // Restore default cursor Cursor.Current = Cursors.Default; } }
private async Task NetConnection() { bool connection = false; while (connection == false) { if (!CheckConnection.CheckInternetConnection()) { await DisplayAlert("No Internet Connection", "Please connect your device to the internet to continue.", "Ok"); } else { connection = true; Task.Delay(2000).Wait(); } } }
private void FrmLogin_Load(object sender, EventArgs e) { this.Hide(); using (SplashScreen frm = new SplashScreen()) { frm.ShowDialog(); } this.Show(); presenter = new LoginPresenter(this); CheckConnection?.Invoke(this, null); mBtnLogin.Click += MBtnLogin_Click; mLRegister.Click += MLRegister_Click; RequiredValidatingControls(); }
protected override async void OnAppearing() { if (CheckConnection.validate()) { bool validate = await CheckAuth.validate(); if (!validate) { App.Current.MainPage = new NavigationPage(new Login()); } } else { App.Current.MainPage = new NavigationPage(new FailConnection()); } base.OnAppearing(); }
private void btnFindBusiness_Click(object sender, System.EventArgs e) { DOTSYellowPages YP = new DOTSYellowPages(); Listings HotelListings = new Listings(); Listings RestaurantListings = new Listings(); // Show wait cursor Cursor.Current = Cursors.WaitCursor; try { // Check that server is available over HTTP (port 80) if (CheckConnection.Once(YP.Url)) { // Get hotels HotelListings = YP.GetYPListingsByCategoryID(1279, YPZip, Convert.ToInt32(txtMiles.Text), "0"); // Get restaurants RestaurantListings = YP.GetYPListingsByCategoryID(655, YPZip, Convert.ToInt32(txtMiles.Text), "0"); // Clear treeview tvwBusiness.Nodes.Clear(); // Call to fill the treeview with hotels FillTreeView(HotelListings); // Call to fill the treeview with restaurants FillTreeView(RestaurantListings); } else { // No connection! MessageBox.Show("Connection to Web Service server could not be established!"); } } catch (Exception ex) { MessageBox.Show("Could not make Web Service calls (" + ex.Message + ")!"); } finally { // Restore default cursor Cursor.Current = Cursors.Default; } }
private void checkConnection(int try_count = 0) { if (try_count < max_try) { if (CheckConnection.validate()) { time_exp = time_exp * 3; Task.Delay(time_exp); try_count++; checkConnection(try_count); } else { App.Current.MainPage = new NavigationPage(new Login()); } } }
private string GetResultFromDBTest(string connectionString) { CheckConnection TestConnection = new CheckConnection(); var _result = TestConnection.check_connection(connectionString); string _textResult; if (_result == false) { _textResult = " ::Napaka v konekciji"; } else { _textResult = " ::Uspešna konekcija"; } return(_textResult); }
public static async Task <ViewProps> SetProperties(ViewProps props) { RandomShapeAndSizeGenerator generator = new RandomShapeAndSizeGenerator(props); if (generator.prop.isCircle) { if (CheckConnection.iSConnected() == true) { var root = RetrieveXml.GetXml("http://www.colourlovers.com/api/colors/random"); if (root != null && root.GetElementsByTagName("imageUrl").Count != 0) { generator.prop.imageURL = root.GetElementsByTagName("imageUrl")[0].InnerText; generator.prop.title = root.GetElementsByTagName("title")[0].InnerText; DownloadImage download = new DownloadImage(generator.prop); generator.prop = await download.downloadAsync(); generator.prop.image = getRoundedShape(generator.prop); } } } else { if (CheckConnection.iSConnected() == true) { var root = RetrieveXml.GetXml("http://www.colourlovers.com/api/patterns/random"); if (root != null && root.GetElementsByTagName("imageUrl").Count != 0) { generator.prop.imageURL = root.GetElementsByTagName("imageUrl")[0].InnerText; generator.prop.title = root.GetElementsByTagName("title")[0].InnerText; DownloadImage download = new DownloadImage(generator.prop); generator.prop = await download.downloadAsync(); } } } return(generator.prop); }
public static int CountMails(int KindOfScan) { string Label = string.Empty; if (KindOfScan == 1) { Label = "INBOX"; } else if (KindOfScan == 2) { Label = "SENT"; } else if (KindOfScan == 3) { Label = "DRAFTS"; } // Check connection if (CheckConnection.Check() == false) { return(0); } // Define parameter for request UsersResource.ThreadsResource.ListRequest ThreadRequest = Connect.service.Users.Threads.List("me"); ThreadRequest.LabelIds = Label; // Get mail include spam trash? ThreadRequest.MaxResults = int.MaxValue; ThreadRequest.IncludeSpamTrash = false; // NO // Make a request try { return(ThreadRequest.ExecuteAsync().Result.Threads.Count()); } catch (Exception) { return(0); } }
public ConnectionData GetConnectionData(CheckConnection check_connection, string registry_path, Window main_window = null) { if (string.IsNullOrWhiteSpace(registry_path) || check_connection == null) { return(null); } var cd = new ConnectionData(registry_path); this.tbDBServer.Text = cd.Server; this.tbDBName.Text = cd.DataBase; this.tbLogin.Text = cd.Login; this.pbPassword.Password = cd.Password; if (main_window != null) { this.Background = main_window.Background; this.Foreground = main_window.Foreground; } do { if (this.ShowDialog() != true) { return(null); } cd = new ConnectionData(this.tbDBServer.Text, this.tbDBName.Text, this.tbLogin.Text, this.pbPassword.Password); if (check_connection(cd)) { cd.SaveToRegistry(registry_path); return(cd); } this.Title = "Ошибка соединения"; } while (true); }
/// <summary> /// Override OnCreate() /// </summary> protected async override void OnCreate(Bundle bundle) { base.OnCreate(bundle); /// <summary> /// Initialise the counter to 0 /// </summary> int counter = 0; /// <summary> /// Define sensor manager,detector and events /// </summary> _sensorManager = (SensorManager)GetSystemService(Context.SensorService); _sensor = _sensorManager.GetDefaultSensor(SensorType.Accelerometer); _shakeDetector = new ShakeDetector(); /// <summary> /// Preload 15 items /// </summary> ProgressDialog pd = new ProgressDialog(this); pd.SetTitle("Loading.."); pd.Show(); for (int i = 0; i < 15; i++) { if (CheckConnection.iSConnected()) { propsList.Add(await SetViewProperties.SetProperties(new ViewProps())); } else { propsList.Add(SetViewProperties.SetViewProperty(new ViewProps())); } } pd.Dismiss(); /// <summary> /// Set our view from the "main" layout resource /// </summary> SetContentView(Resource.Layout.Main); /// <summary> /// Device specific properties /// </summary> DeviceSpecificProperties props = new DeviceSpecificProperties(); double Y = props.inchY; /// <summary> /// //Define the views and layouts which can be accessed /// </summary> ImageView imageView = FindViewById <ImageView>(Resource.Id.imageView); imageView.SetImageResource(Resource.Drawable.Icon); RelativeLayout layout = FindViewById <RelativeLayout>(Resource.Id.mainLayout); _shakeDetector.Shaked += (sender1, shakeCount) => { lock (_syncLock) { imageView.Visibility = ViewStates.Invisible; } }; /// <summary> /// Events /// </summary> imageView.LongClick += (sender, e) => { View v = (View)sender; ClipData.Item item = new ClipData.Item("category", "value"); string[] mimeTypes = { ClipDescription.MimetypeTextPlain }; ClipData dragData = new ClipData("category", mimeTypes, item); View.DragShadowBuilder myShadow = new View.DragShadowBuilder(imageView); imageView.StartDrag(dragData, myShadow, null, 0); }; imageView.Drag += (sender, e) => { View v = (View)sender; switch (e.Event.Action) { case DragAction.Started: layoutParams = (RelativeLayout.LayoutParams)v.LayoutParameters; break; case DragAction.Entered: var x_cord = (int)e.Event.GetX(); var y_cord = (int)e.Event.GetY(); break; case DragAction.Exited: x_cord = (int)e.Event.GetX(); y_cord = (int)e.Event.GetY(); layoutParams.LeftMargin = x_cord; layoutParams.TopMargin = y_cord; v.LayoutParameters = layoutParams; break; case DragAction.Location: x_cord = (int)e.Event.GetX(); y_cord = (int)e.Event.GetY(); break; case DragAction.Drop: break; default: break; } }; int prevtime = 0; imageView.Click += async(sender, e) => { prevtime++; if (prevtime == 2) { if (CheckConnection.iSConnected()) { var res = await SetViewProperties.SetProperties(new ViewProps()); imageView.SetImageBitmap(res.image); if (res.title != null) { ActionBar.Title = res.title; } } else { var res = SetViewProperties.SetViewProperty(new ViewProps()); imageView.SetImageBitmap(res.image); if (res.title != null) { ActionBar.Title = res.title; } } prevtime = 0; } }; layout.Touch += (sender, e) => { try { imageView.Visibility = ViewStates.Visible; var x_cord = (int)e.Event.RawX; var y_cord = (int)(e.Event.RawY - Y * 0.23); layoutParams = new RelativeLayout.LayoutParams((int)100, (int)100); layoutParams.LeftMargin = x_cord; layoutParams.TopMargin = y_cord; imageView.LayoutParameters = layoutParams; if (e.Event.Action == MotionEventActions.Up) { try { if (counter < 15) { var res = propsList[counter]; imageView.SetImageBitmap(res.image); if (res.title != null) { ActionBar.Title = res.title; } counter++; //if (CheckConnection.iSConnected()) //{ // var res = await SetViewProperties.SetProperties(new ViewProps()); // //var res = propsList[counter + 1]; // imageView.SetImageBitmap(res.image); // ActionBar.Title = res.title; //} //else //{ // var res = SetViewProperties.SetViewProperty(new ViewProps()); // imageView.SetImageBitmap(res.image); //} } else { counter = 0; } } catch (Java.Lang.Exception e1) { e1.PrintStackTrace(); var res = SetViewProperties.SetViewProperty(new ViewProps()); imageView.SetImageBitmap(res.image); } } } catch (Java.Lang.Exception e1) { var res = SetViewProperties.SetViewProperty(new ViewProps()); imageView.SetImageBitmap(res.image); } }; }
//CheckConnection Db = new CheckConnection(; public bool CheckOpen(string ConnectionString) { CheckConnection Db = new CheckConnection(ConnectionString); return(Db.DbCheckConn()); }
/// <summary> /// Called when [disconnect from server]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="connected">if set to <c>true</c> [connected].</param> public void OnDisconnectFromServer(object sender, bool connected) { isConnected = connected; CheckConnection?.Invoke(this, isConnected); }
private void MBtnConfigTestConnection_Click(object sender, EventArgs e) { ConnectionString = mTxtConfigConnectionString.Text; CheckConnection?.Invoke(this, null); }
private void Main_Load(object sender, EventArgs e) { smsResponseDelegate = new SMSResponse(BindResponse); chkBrokenConDelegate = new CheckConnection(ConnectBrokenConnection); }
public SplashActivity() { ApiService = new ApiConsumer(); CheckConnection = new CheckConnection(); }