public void Display() { notification = messagePrefab.getObject(true, m_DisplayMessageManager.DisplayMessageRect.transform).GetComponent <NotificationToast>(); notification.Initialize(message); m_DisplayMessageManager.DisplayMessageRect.UpdateTable(notification.gameObject); StartCoroutine(messagePrefab.ReturnWithDelay(notification.gameObject, notification.TotalRunTime)); }
public void CreateNotification(string text) { GameObject notificationInstance = notificationPrefab.getObject(true, notificationPanel.transform); notificationInstance.transform.SetSiblingIndex(0); NotificationToast toast = notificationInstance.GetComponent <NotificationToast>(); toast.Initialize(text); notificationPanel.UpdateTable(notificationInstance); }
public void CreateNotification(string text) { GameObject notificationInstance = Instantiate(notificationPrefab, notificationPanel); notificationInstance.transform.SetSiblingIndex(0); NotificationToast toast = notificationInstance.GetComponent <NotificationToast>(); if (toast) { toast.Initialize(text); } }
private void ButtonUpdate_Click(object sender, RoutedEventArgs e) { Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 1); NotificationToast.SimpleNotification("Updating the stock minimum value..."); List <string> code = DbUtils.RefList("Code", "kitbox"); foreach (string i in code) { Dictionary <string, int> valuesIncStock = DbUtils.SelectCondDb("sales", i); Dictionary <string, int> graphMonthIncStock = new Dictionary <string, int>(); foreach (KeyValuePair <string, int> entry in valuesIncStock) { string key = entry.Key; string month = key.Split('-')[0] + "/" + key.Split('-')[1]; if (graphMonthIncStock.ContainsKey(month)) { graphMonthIncStock[month] = graphMonthIncStock[month] + entry.Value; } else { graphMonthIncStock.Add(month, entry.Value); } } List <string> monthsIncStock = new List <string>(); foreach (KeyValuePair <string, int> entry in graphMonthIncStock) { monthsIncStock.Add(entry.Key); } int all = 0; try { all = graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 2]] + graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 3]] + graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 4]] + graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 5]] + graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 6]] + graphMonthIncStock[monthsIncStock[monthsIncStock.Count - 7]]; } catch { } int average = all / 12; string x = ""; x = DbUtils.UpdateDb("kitbox", "MinimumStock", "Code = \"" + i + "\"", average.ToString()); } FillDataGrid(DbUtils.RefreshDb("kitbox"), DataGrid1); DataGrid1.Columns[DataGrid1.Columns.Count - 1].CellStyle = (Style)DataGrid1.Resources["Test"]; NotificationToast.SimpleNotification("Update completed"); Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1); }
public void ShowToast(string body, string title, EventHandler clickHandler = null) { var toast = new NotificationToast { Title = title, Body = body, SecondaryCloseDelayTime = NotificationToastSecondaryCloseDelayTime }; if (clickHandler != null) { toast.Click += clickHandler; } NotificationIcon.ShowCustomBalloon(toast, PopupAnimation.Fade, NotificationToastCloseDelayTime); }
public void CheckConnection() { MySqlConnection conn = new MySqlConnection(DbUtils.MyConString); try { conn.Open(); conn.Close(); IconConnectivity.Glyph = "\uE701"; ConText.Tag = "Database connected"; LoginDialog(); NotificationToast.SimpleNotification("Database connected"); } catch { IconConnectivity.Glyph = "\uEB5E"; ConText.Tag = "Database not connected"; DisplayNoConnectionDialog(); string title = "Database connection failed"; NotificationToast.SimpleNotification(title); } }
private void Refresh_Click(object sender, RoutedEventArgs e) { NotificationToast.SimpleNotification("Start updating suppliers' prices"); Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Wait, 1); DataTable supplier1 = new DataTable(); foreach (string i in DbUtils.RefList("SupplierId", "suppliers")) { if (i == "1") { supplier1 = DbUtils.RefreshDb("supplierslistprices where SupplierId = \"" + i + "\""); } else { foreach (string j in DbUtils.RefList("Code", "supplierslistprices where SupplierId = \"" + i + "\"")) { double value1 = Convert.ToDouble(DbUtils.RefList("SuppPrice", "supplierslistprices where SupplierId = \"" + i + "\" and Code = \"" + j + "\"")[0]); List <string> listcode = new List <string>(); foreach (DataRow row in supplier1.Rows) { listcode.Add(row["Code"].ToString()); } if (listcode.Contains(j)) { double value2 = 0; foreach (DataRow row in supplier1.Rows) { if (row["Code"].ToString() == j) { value2 = Convert.ToDouble(row["SuppPrice"].ToString()); } } if (value2 - value1 > 0) { for (int k = supplier1.Rows.Count - 1; k >= 0; k--) { DataRow dr = supplier1.Rows[k]; if (dr["Code"].ToString() == j) { dr.Delete(); } } supplier1.AcceptChanges(); DataRow ligne = supplier1.NewRow(); ligne["SupplierId"] = i; ligne["Code"] = j; ligne["SuppPrice"] = value1; ligne["SuppDelay"] = Convert.ToInt32(DbUtils.RefList("SuppDelay", "supplierslistprices where SupplierId = \"" + i + "\" and Code = \"" + j + "\"")[0]); supplier1.Rows.Add(ligne); } else if (Math.Abs(value2 - value1) < 0.001) { int delay1 = Convert.ToInt32(DbUtils.RefList("SuppDelay", "supplierslistprices where SupplierId = \"" + i + "\" and Code = \"" + j + "\"")[0]); int delay2 = 0; foreach (DataRow row in supplier1.Rows) { if (row["Code"].ToString() == j) { delay2 = Convert.ToInt32(row["SuppDelay"].ToString()); } } if (delay2 - delay1 > 0) { for (int k = supplier1.Rows.Count - 1; k >= 0; k--) { DataRow dr = supplier1.Rows[k]; if (dr["Code"].ToString() == j) { dr.Delete(); } } supplier1.AcceptChanges(); DataRow ligne = supplier1.NewRow(); ligne["SupplierId"] = i; ligne["Code"] = j; ligne["SuppPrice"] = value1; ligne["SuppDelay"] = delay1; supplier1.Rows.Add(ligne); } } } else { for (int k = supplier1.Rows.Count - 1; k >= 0; k--) { DataRow dr = supplier1.Rows[k]; if (dr["Code"].ToString() == j) { dr.Delete(); } } supplier1.AcceptChanges(); DataRow ligne = supplier1.NewRow(); ligne["SupplierId"] = i; ligne["Code"] = j; ligne["SuppPrice"] = value1; ligne["SuppDelay"] = Convert.ToInt32(DbUtils.RefList("SuppDelay", "supplierslistprices where SupplierId = \"" + i + "\" and Code = \"" + j + "\"")[0]); supplier1.Rows.Add(ligne); } } } } FillDataGrid(supplier1, DataGrid2); MySqlConnection connection = new MySqlConnection(DbUtils.MyConString); string query = "TRUNCATE TABLE suppliersprices"; MySqlCommand cmd = new MySqlCommand(query, connection); connection.Open(); cmd.ExecuteNonQuery(); connection.Close(); foreach (DataRow row in supplier1.Rows) { string price = row["SuppPrice"].ToString(); string price1 = price.Replace(',', '.'); DbUtils.InsertDb("suppliersprices", "SupplierId,Code,SuppPrice,SuppDelay", "\"" + row["SupplierId"] + "\", \"" + row["Code"] + "\", \"" + price1 + "\", \"" + row["SuppDelay"] + "\""); } NotificationToast.SimpleNotification("Update completed"); Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 1); }