private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0) { DataRowView dv = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView; var item = HelperImage.GetByName(dv["Name"].ToString()); frmLibrary_Edit frm = new frmLibrary_Edit(); frm.ItemEdit = item; if (frm.ShowDialog() == DialogResult.OK) { LoadData(); } } else if (e.ColumnIndex == 1) { DataRowView dv = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView; if (MessageBox.Show("Do you want delete this item ?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { HelperImage.Delete(dv["Name"].ToString()); LoadData(); } } else if (e.ColumnIndex == 2 || e.ColumnIndex == 3) { DataRowView dv = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataRowView; var item = HelperImage.GetByName(dv["Name"].ToString()); HelperImage.SetItemChange(item); this.Close(); } }
private void mnuLibrary_Click(object sender, EventArgs e) { var frm = new frmLibrary(); frm.ShowDialog(); mnuLibrary.Text = string.Format("Library ({0})", HelperImage.List().Count); }
public override View GetView(int position, View convertView, ViewGroup parent) { var item = Items[position]; View view = convertView; if (view == null) // no view to re-use, create new { view = context.LayoutInflater.Inflate(Resource.Layout.WeatherItem, null); } view.FindViewById <TextView>(Resource.Id.DepartName).Text = item.Location.City; view.FindViewById <TextView>(Resource.Id.Temperature).Text = item.Item.Condition.Temp + "º" + item.Units.Temperature; var imageBitmap = HelperImage.GetImageBitmapFromUrl("http://l.yimg.com/a/i/us/we/52/" + item.Item.Condition.Code + ".gif"); view.FindViewById <ImageView>(Resource.Id.WeatherIcon).SetImageBitmap(imageBitmap); return(view); }
private void frmMain_Load(object sender, EventArgs e) { try { HelperSetting.SetFilePath(Application.StartupPath + "\\" + HelperSetting.FileName); var setting = HelperSetting.GetSetting(); if (string.IsNullOrEmpty(setting.FileData) || string.IsNullOrEmpty(setting.FolderBackground) || string.IsNullOrEmpty(setting.FolderPointer)) { var frm = new frmSetting(); frm.ShowDialog(); } HelperImage.Load(); mnuLibrary.Text = string.Format("Library ({0})", HelperImage.List().Count); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); } }
private void LoadData() { var lst = HelperImage.List(); DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("PathBackground", typeof(string)); dt.Columns.Add("PathOutput", typeof(string)); foreach (var item in lst) { dt.Rows.Add(item.Name, item.PathBackground, item.PathOutput); } DataView dv = dt.DefaultView; if (!string.IsNullOrEmpty(txtSearch.Text)) { dv.RowFilter = "Name like '%" + txtSearch.Text + "%'"; } dataGridView1.AutoGenerateColumns = false; dataGridView1.DataSource = dv; }
private void LoadWeatherDetail() { string[] infoDepart = departmentName.Split(','); WeatherRequests request = new WeatherRequests(); WeatherData departmentDetail = request.GetAllInfoOneCity(infoDepart[0], infoDepart[1]); RunOnUiThread(() => { _temperature.Text = departmentDetail.Item.Condition.Temp + "°" + departmentDetail.Units.Temperature; var imageBitmap = HelperImage.GetImageBitmapFromUrl("http://l.yimg.com/a/i/us/we/52/" + departmentDetail.Item.Condition.Code + ".gif"); _imageWeather.SetImageBitmap(imageBitmap); _weatherName.Text = departmentDetail.Item.Condition.Text; _titleDepartamen.Text = departmentDetail.Location.City + ", " + departmentDetail.Location.Country; _windDirection.Text = departmentDetail.wind.Direction; _windSpeed.Text = departmentDetail.wind.Speed; _atmosHumidity.Text = departmentDetail.Atmosphere.Humidity; _atmosPressure.Text = departmentDetail.Atmosphere.Pressure; _atmosVisibility.Text = departmentDetail.Atmosphere.Visibility; _progress.Dismiss(); _RootLayoutl.Visibility = ViewStates.Visible; }); Task.Delay(1000); }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("Input name"); } else { if (HelperImage.ExistsName(txtName.Text) && txtName.Enabled == true) { MessageBox.Show("Name has other item"); } else { if (MessageBox.Show("Do you want save changes ?", "Save", MessageBoxButtons.YesNo) == DialogResult.Yes) { HelperImage.SaveInfo(txtName.Text, txtOutput.Text); DialogResult = DialogResult.OK; this.Close(); } } } }