<pre> //Error 04-10 12:13:10.619 4089-4089/com.hataflabs.batterywidget:remote E/AndroidRuntime: FATAL EXCEPTION: main Process: com.hataflabs.batterywidget:remote, PID: 4089 android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=Battery Service pri=0 contentView=null vibrate=null sound=null defaults=0x0 flags=0x40 color=0x00000000 vis=PRIVATE) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1768) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
<service android:name="com.hataflabs.batterywidget.ConnectService" android:enabled="true" android:process=":remote" > <intent-filter> <action android:name="com.hataflabs.batterywidget.ConnectService" /> </intent-filter> </service>
$('#save').click(function () { var name_click = $('#name').text(); var user_click = $('#user').text(); var yr_click = $('#yr').text(); var lbl_click = $('#lbl').text(); var proy_id_click = $('#proy_id').val(); var obj_click = $('#obj').prop('selectedIndex'); var res_click = $('#res').prop('selectedIndex'); var act2_click = $('#act2').prop('selectedIndex'); var es_click = $('#es').prop('selectedIndex'); var com_click = $('#com').val(); var por_click = $('#por').val(); console.log(proy_id_click + " , " + res_click + " ," + obj_click + ", " + act2_click); $.ajax({ url: 'Formulario.aspx/salvar', type: "POST", data: '{name_click:' + name_click + 'yr_click:' + yr_click + 'user_click:' + user_click + 'lbl_click:' + lbl_click + 'proy_id_click:' + proy_id_click + 'obj_click:' + obj_click + 'res_click:' + res_click + 'act2_click:' + act2_click + 'es_click:' + es_click + 'com_click:' + com_click + 'por_click:' + por_click + '}', success: function (jsonData) { console.log(jsonData); $("#candg ").prop('selectedIndex', 0); $("#es").prop('selectedIndex', 0); $("#act2 ").prop('selectedIndex', 0); $("#obj ").prop('selectedIndex', 0); $("#res ").prop('selectedIndex', 0); $("#lbl").html(""); $("#com").val(""); $("#por").val(""); alert("Successfully done"); } })//;? });
<pre>private void timer1_Tick(object sender, EventArgs e) { Close(); }
using (BetterDialog dialog = new BetterDialog(title, largeHeading, smallExplanation, leftButton,rightButton, iconSet)) { DialogResult result = dialog.ShowDialog(); Thread.Sleep(1000); dialog.Close(); return result; }
public partial class BetterDialog : Form { /// <summary> /// Create a special dialog in the style of Windows XP or Vista. A dialog has a custom icon, an optional large /// title in the form, body text, window text, and one or two custom-labeled buttons. /// </summary> /// <param name="titleString">This string will be displayed in the system window frame.</param> /// <param name="bigString">This is the first string to appear in the dialog. It will be most prominent.</param> /// <param name="smallString">This string appears either under the big string, or is null, which means it is /// not displayed at all.</param> /// <param name="leftButton">This is the left button, typically the "accept" button--label it with an /// action verb (or "OK").</param> /// <param name="rightButton">The right button--typically "Cancel", but could be "No".</param> /// <param name="iconSet">An image to be displayed on the left side of the dialog. Should be 32 x 32 pixels.</param> static public DialogResult ShowDialog(string title, string largeHeading, string smallExplanation,string leftButton, string rightButton, Image iconSet) { //title, largeHeading,smallExplanation, leftButton, rightButton, iconSet using (BetterDialog dialog = new BetterDialog(title, largeHeading, smallExplanation, leftButton,rightButton, iconSet)) { DialogResult result = dialog.ShowDialog(); return result; } } /// <summary> /// The private constructor. This is only called by the static method ShowDialog. /// </summary> private BetterDialog(string title, string largeHeading, string smallExplanation,string leftButton, string rightButton, Image iconSet) { this.Font = SystemFonts.MessageBoxFont; this.ForeColor = SystemColors.WindowText; InitializeComponent(); // set our width and height to these values (redundant, but who cares?) this.Width = 350; this.Height = 150; using (Graphics graphics = this.CreateGraphics()) { SizeF smallSize; SizeF bigSize; if (string.IsNullOrEmpty(smallExplanation) == false) { if (SystemFonts.MessageBoxFont.FontFamily.Name == "Segoe UI") { // use the special, windows-vista font style if we are running vista (using Segoe UI). label1.ForeColor = Color.FromArgb(0, 51, 153); // [ColorTranslator.FromHtml("#003399")] label1.Font = new Font("Segoe UI", 12.0f, FontStyle.Regular, GraphicsUnit.Point); // bigger for vista/aero this.Width += 50; label1.Width += 50; label2.Width += 50; smallSize = graphics.MeasureString(smallExplanation, this.Font, this.label2.Width); bigSize = graphics.MeasureString(largeHeading, label1.Font, this.label1.Width); this.Height = (int)smallSize.Height + 158; // add in a little margin on the top as well pictureBox1.Margin = new Padding(pictureBox1.Margin.Left, pictureBox1.Margin.Top + 6, pictureBox1.Margin.Right, pictureBox1.Margin.Bottom); } else { // might want to special case the old, MS Sans Serif font. // use the regular
using System; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data; using System.Data.OleDb; using System.IO; using System.Configuration; public partial class _Default : System.Web.UI.Page { public static OleDbConnection connExcel; public static OleDbCommand cmdExcel; public static OleDbDataAdapter oda; public static DataTable dt; public static string FilePath; protected void Page_Load(object sender, EventArgs e) { } protected void btnUpload_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName); string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName); string FolderPath = ConfigurationManager.AppSettings["FolderPath"]; FilePath = Server.MapPath(FolderPath + FileName); FileUpload1.SaveAs(FilePath); Import_To_Grid(FilePath, Extension, rbHDR.SelectedItem.Text); } } private void Import_To_Grid(string FilePath, string Extension, string isHDR) { string conStr=""; switch (Extension) { case ".xls": //Excel 97-03 conStr = ConfigurationManager.ConnectionStrings["Excel03ConString"].ConnectionString; break; case ".xlsx": //Excel 07 conStr = ConfigurationManager.ConnectionStrings["Excel07ConString"].ConnectionString; break; } conStr = String.Format(conStr, FilePath, isHDR); connExcel = new OleDbConnection(conStr); cmdExcel = new OleDbCommand(); oda = new OleDbDataAdapter(); dt = new DataTable(); cmdExcel.Connection = connExcel; //Get the name of First Sheet connExcel.Open(); DataTable dtExcelSchema; dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); for (int i = 0; i < dtExcelSchema.Rows.Count; i++) { String sheetName = dtExcelSchema.Rows[i]["TABLE_NAME"].ToString(); sheetName = sheetName.Substring(0, sheetName.Length - 1); sheet.Items.Add(sheetName); } //string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString(); connExcel.Close(); } protected void PageIndexChanging(object sender, GridViewPageEventArgs e) { string FolderPath = ConfigurationManager.AppSettings["FolderPath"] ; string FileName = GridView1.Caption; string Extension = Path.GetExtension(FileName); string FilePath = Server.MapPath(FolderPath + FileName); Import_To_Grid(FilePath, Extension, rbHDR.SelectedItem.Text); GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind(); } protected void sheet_SelectedIndexChanged(object sender, EventArgs e) { //Read Data from First Sheet connExcel.Open(); cmdExcel.CommandText = "SELECT * From [" + sheet.Text.ToString() + "]"; oda.SelectCommand = cmdExcel; oda.Fill(dt); connExcel.Close(); //Bind Data to GridView GridView1.Caption = Path.GetFileName(FilePath); GridView1.DataSource = dt; GridView1.DataBind(); } }
MapPath(FileUpload1.PostedFile.FileName)