private async Task CheckDownloads(bool forceCheck) { var lastCheck = forceCheck ? DateTime.MinValue : Repo.LastChecked; var(newData, entries) = await GitHubUtils.GetAsync <GithubReleaseEntry[]>(Repo.RepoApiReleasesUrl, UserSettingsManager.Instance.GitHubToken, lastCheck); if (!newData) { return; } var downloads = entries.OrderByDescending(r => r.Published).SelectMany(entry => entry.Assets).Sum(a => a.Downloads); if (Repo.LastTotalDownloads != downloads) { int change = downloads - Repo.LastTotalDownloads; lblDownloads.BackColor = change > 0 ? Color.LightGreen : Color.LightPink; PopupMessage msg = new PopupMessage { Caption = Repo.DisplayName, Text = $"Downloads: {downloads} ({(change > 0 ? "+" : string.Empty)}{change})", Image = Properties.Resources.Download_32x32 }; using (var popupNotifier = new NotificationWindow.PopupNotifier { TitleText = msg.Caption, ContentText = msg.Text, IsRightToLeft = false, Image = msg.Image, AutoContentHeight = true, IgnoreWhenFullScreen = true }) { popupNotifier.TitleFont = new Font(popupNotifier.TitleFont.FontFamily, 16.0f); popupNotifier.ContentColor = change > 0 ? Color.ForestGreen : Color.Red; popupNotifier.ContentFont = new Font(popupNotifier.ContentFont.FontFamily, 14.0f); if (change > 0 || !UserSettingsManager.Instance.DoNotShowDecrementPopups) { popupNotifier.Popup(); } } } else { lblDownloads.BackColor = SystemColors.Control; } lblDownloads.Text = "Downloads: " + downloads; Repo.LastTotalDownloads = downloads; }
private async Task CheckTrafficViews(bool forceCheck) { var lastCheck = forceCheck ? DateTime.MinValue : Repo.LastChecked; var(newData, views) = await GitHubUtils.GetAsync <GithubTrafficViews>(Repo.RepoApiTrafficViewsUrl, UserSettingsManager.Instance.GitHubToken, lastCheck); if (!newData) { return; } if (Repo.LastTotalViews != views.Total) { int change = views.Total - Repo.LastTotalViews; lblViews.BackColor = change > 0 ? Color.LightGreen : Color.LightPink; PopupMessage msg = new PopupMessage { Caption = Repo.DisplayName, Text = $"Views: {views.Total} ({(change > 0 ? "+" : string.Empty)}{change})", Image = Properties.Resources.Show_32x32 }; using (var popupNotifier = new NotificationWindow.PopupNotifier()) { { popupNotifier.TitleText = msg.Caption; popupNotifier.ContentText = msg.Text; popupNotifier.IsRightToLeft = false; popupNotifier.Image = msg.Image; popupNotifier.TitleFont = new Font(popupNotifier.TitleFont.FontFamily, 16.0f); popupNotifier.ContentColor = change > 0 ? Color.ForestGreen : Color.Red; popupNotifier.IgnoreWhenFullScreen = true; popupNotifier.ContentFont = new Font(popupNotifier.ContentFont.FontFamily, 14.0f); popupNotifier.AutoContentHeight = true; } if (change > 0 || !UserSettingsManager.Instance.DoNotShowDecrementPopups) { popupNotifier.Popup(); } } } else { lblViews.BackColor = SystemColors.Control; } lblViews.Text = $"Views: {views.Total}. U:{views.Views.Sum(v => v.Uniques)}"; Repo.LastTotalViews = views.Total; Repo.LastTotalUniqueViews = views.Views.Sum(v => v.Uniques); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (preventExit && e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; Hide(); var popupNotifier = new NotificationWindow.PopupNotifier { TitleText = "GitHub Notifier", ContentText = "Still here. Right click and exit to close", IsRightToLeft = false, Image = Properties.Resources.Feature_32x32, IgnoreWhenFullScreen = true, AutoContentHeight = true }; popupNotifier.Popup(); } }
private async Task CheckNotifications(bool forceCheck = false) { if (forceCheck || DateTime.Now >= Settings.LastReadUserNotification.AddMinutes(Settings.NotificationsIntervalCheck)) { var(newData, notifications) = await GitHubUtils.GetAsync <GitHubUserNotification[]>( "https://api.github.com/notifications", UserSettingsManager.Instance.GitHubToken, UserSettingsManager.Instance.LastReadUserNotification); Settings.LastReadUserNotification = DateTime.Now; if (newData) { Settings.LastReadUserNotification = DateTime.Now; Settings.LastUnReadUserNotifications = notifications.Where(n => n.Unread).ToList(); foreach (var notification in notifications) { using (var popupNotifier = new NotificationWindow.PopupNotifier()) { { popupNotifier.TitleText = notification.Repository.FullName; popupNotifier.ContentText = notification.Subject.Title; popupNotifier.IsRightToLeft = false; popupNotifier.Image = Properties.Resources.Question_32x32; popupNotifier.IgnoreWhenFullScreen = true; popupNotifier.AutoContentHeight = true; } popupNotifier.Popup(); } } } } if (Settings.LastUnReadUserNotifications.Any()) { lstNotifications.Items.Clear(); lstNotifications.Items.AddRange(Settings.LastUnReadUserNotifications.Select(n => $"{n.Repository.FullName}: {n.Subject.Title}").ToArray()); } tsslblNotifications.Text = $"Notification: {Settings.LastUnReadUserNotifications.Count}. Last Update: {Settings.LastReadUserNotification}"; }
private void NotificationPopUP() { // Library.WriteErrorLog("Inside Notify "); NotificationWindow.PopupNotifier popupNotifier1 = new NotificationWindow.PopupNotifier(); popupNotifier1.TitleText = "patientXpress's Plugin"; popupNotifier1.ContentText = "You have got a call."; popupNotifier1.ShowCloseButton = false; popupNotifier1.ShowOptionsButton = false; popupNotifier1.ShowGrip = false; popupNotifier1.Delay = 3000; popupNotifier1.AnimationInterval = 10; popupNotifier1.AnimationDuration = 1000; popupNotifier1.TitlePadding = new Padding(0); popupNotifier1.ContentPadding = new Padding(0); popupNotifier1.BodyColor = System.Drawing.Color.Transparent; popupNotifier1.BorderColor = System.Drawing.Color.Black; //popupNotifier1.Image = Properties.Resources.ConvergedCommLogo; popupNotifier1.Size = new System.Drawing.Size(200, 50); popupNotifier1.Scroll = false; popupNotifier1.Popup(); }
public void show_notification(string options_json_string) { JavaScript.NotificationOptions options = null; try { options = Newtonsoft.Json.JsonConvert.DeserializeObject<JavaScript.NotificationOptions>(options_json_string); } catch (Exception e) { error("show_notification", "Invalid Options Format"); return; } NotificationWindow.PopupNotifier p = new NotificationWindow.PopupNotifier(); p.ShowOptionsButton = false; p.BodyColor = System.Drawing.ColorTranslator.FromHtml(options.BackgroundColor); p.ShowGrip = false; p.BorderColor = System.Drawing.ColorTranslator.FromHtml(options.BorderColor); p.HeaderHeight = options.HeaderHeight; p.HeaderColor = System.Drawing.ColorTranslator.FromHtml(options.HeaderColor); if (!String.IsNullOrEmpty(options.Image)) { p.Image = getImageByAddress(options.Image); } p.ImagePadding = new Padding(options.ImagePaddingsLeft, options.ImagePaddingsTop, options.ImagePaddingsRight, options.ImagePaddingsBottom); p.TitleText = options.Title; p.TitleFont = new Font("Arial", 12, FontStyle.Bold); p.TitleColor = System.Drawing.ColorTranslator.FromHtml(options.TitleColor); p.TitlePadding = new Padding(options.TitlePaddingsLeft, options.TitlePaddingsTop, options.TitlePaddingsRight, options.TitlePaddingsBottom); p.ContentFont = new Font("Arial", 10, FontStyle.Regular); p.ContentPadding = new Padding(options.ContentPaddingsLeft, options.ContentPaddingsTop, options.ContentPaddingsRight, options.ContentPaddingsBottom); p.ContentText = options.Content; p.ContentHoverColor = System.Drawing.ColorTranslator.FromHtml(options.ContentHoverColor); p.CloseButtonColor = System.Drawing.ColorTranslator.FromHtml(options.CloseButtonColor); p.ButtonHoverColor = System.Drawing.ColorTranslator.FromHtml(options.ButtonHoverColor); p.ButtonBorderColor = System.Drawing.ColorTranslator.FromHtml(options.CloseButtonBorderColor); p.AnimationDuration = options.AnimationDuration; p.Delay = options.Delay; if (!String.IsNullOrEmpty(options.OnClick)) { EventHandler eh = null; eh = (sender, e) => { F.getWebBrowser().StringByEvaluatingJavaScriptFromString(escapeJs(options.OnClick)); p.Hide(); p.Click -= eh; }; p.Click += eh; } p.Size = new Size(options.Width, options.Height); p.Popup(); }
private void Form1_Load(object sender, EventArgs e) { server = "localhost"; database = "uretimplanlama_2"; uid = "root"; password = "******"; //string connectionString; connectionString = "SERVER=" + server + ";" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD="******";"; myConnection = new MySqlConnection(connectionString); myConnection.Open(); //this.WindowState = FormWindowState.Maximized; //this.Location = new Point(0, 0); //this.Size = Screen.PrimaryScreen.WorkingArea.Size; try { dsDovizKur = new DataSet(); dsDovizKur.ReadXml(@"http://www.tcmb.gov.tr/kurlar/today.xml"); DataRow dr = dsDovizKur.Tables[1].Rows[0]; lbl_usd.Text = dr[4].ToString().Replace('.', ','); dr = dsDovizKur.Tables[1].Rows[3]; lbl_eur.Text = dr[4].ToString().Replace('.', ','); dr = dsDovizKur.Tables[1].Rows[4]; lbl_gbp.Text = dr[4].ToString().Replace('.', ','); } catch { lbl_usd.Text = "Connection Fail!"; lbl_eur.Text = "Connection Fail!"; lbl_gbp.Text = "Connection Fail!"; } sc = new SmtpClient(); sc.Port = 587; sc.Host = "smtp.gmail.com"; sc.EnableSsl = true; sc.Credentials = new NetworkCredential("*****@*****.**", "123456qweasd"); komut = "SELECT DISTINCT proje_no FROM db_projeler"; da = new MySqlDataAdapter(komut, connection); myCommand = new MySqlCommand(komut, myConnection); MySqlDataReader myReader; myReader = myCommand.ExecuteReader(); while (myReader.Read()) { cmb_proje.Items.Add(myReader["proje_no"]); } myReader.Close(); ///////////////faturada vade fatura tarihe eklenip vade tarihe yazılıyor. burada kontrol ederken ona dikkat edilmeli. ayrıca check olayı?????????????? komut = "SELECT fatura_id,fatura_vade,fatura_vade_tarih FROM db_faturalar WHERE fatura_check=" + 1 + " "; da = new MySqlDataAdapter(komut, connection); myConnection = new MySqlConnection(connectionString); myCommand = new MySqlCommand(komut, myConnection); myConnection.Open(); myReader = myCommand.ExecuteReader(); // Always call Read before accessing data. while (myReader.Read()) { fatura_vade = myReader["fatura_vade"].ToString(); fatura_vade_tarih = Convert.ToDateTime(myReader["fatura_vade_tarih"]); tarih = fatura_vade_tarih.AddDays(int.Parse(fatura_vade)); now = DateTime.Now; if ((now - tarih).TotalDays < 5) { NotificationWindow.PopupNotifier popup = new NotificationWindow.PopupNotifier(); if (flag == 0) { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 1; popup.Popup(); flag = 1; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } else if (flag == 1) { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 2; popup.Popup(); flag = 2; popup.popupIndex++; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } else if (flag == 2) { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 3; popup.Popup(); flag = 3; popup.popupIndex++; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } else if (flag == 3) { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 4; popup.Popup(); flag = 4; popup.popupIndex++; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } else if (flag == 4) { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 5; popup.Popup(); popup.popupIndex++; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } else { popup.Image = Properties.Resources.information_alert_attention_sign_help_48; popup.TitleText = "Uyarı"; popup.ContentText = tarih + "Yaklaşan Vade Tarihi"; popup.popupIndex = 6; popup.Popup(); popup.popupIndex++; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "ALTINAY UYARI SİSTEMİ"); mail.To.Add("*****@*****.**"); mail.Subject = "FATURA UYARISI"; mail.IsBodyHtml = true; mail.Body = "MGEO müşterisine kesilen faturanızın ödemesi 5 gün içinde yapılmalıdır"; //sc.Send(mail); } } } myReader.Close(); myConnection.Close(); komut = "SELECT * FROM db_aktivite WHERE akt_oncelik='" + Convert.ToString("C*K ACİL") + "' AND akt_statu='" + Convert.ToString("AKTİF") + "'"; myCommand = new MySqlCommand(komut, myConnection); da = new MySqlDataAdapter(myCommand); dt = new DataTable(); // myReader = myCommand.ExecuteReader(); da.Fill(dt); dg_cokacil.DataSource = dt; dg_cokacil.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dg_cokacil.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// this.chart1.Series.Clear(); // this.chart1.ChartAreas.Clear(); this.chart1.Titles.Add("Faturalar"); series = this.chart1.Series.Add("Gelen Faturalar"); series.ChartType = SeriesChartType.Column; series.Color = Color.Red; series.MarkerStyle = MarkerStyle.Circle; series.MarkerColor = Color.Red; series.IsValueShownAsLabel = true; series.LabelAngle = 30; seriesCopy = chart1.Series.Add("Kesilen Faturalar"); seriesCopy.ChartType = series.ChartType; seriesCopy.Color = Color.Blue; seriesCopy.MarkerColor = series.MarkerColor; seriesCopy.MarkerStyle = series.MarkerStyle; seriesCopy.IsValueShownAsLabel = true; seriesCopy.LabelAngle = 30; seriesOngoru = chart1.Series.Add("Öngörülen Ödemeler"); seriesOngoru.ChartType = SeriesChartType.Column; seriesOngoru.Color = Color.Orange; seriesOngoru.MarkerColor = Color.Blue; seriesOngoru.MarkerStyle = MarkerStyle.Square; seriesOngoru.IsValueShownAsLabel = true; seriesOngoru.LabelAngle = 30; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// myConnection.Close(); maliyet_hesapla(); }
private async Task CheckStarsAndIssues(bool forceCheck) { if (!Repo.ShowOpenIssues && !Repo.ShowLikes) { return; } var lastCheck = forceCheck ? DateTime.MinValue : Repo.LastChecked; var(newData, repoInfo) = await GitHubUtils.GetAsync <GithubRepo>(Repo.RepoApiUrl, UserSettingsManager.Instance.GitHubToken, lastCheck); if (!newData) { return; } if (Repo.ShowLikes && Repo.LastTotalStars != repoInfo.Stargazers) { int change = repoInfo.Stargazers - Repo.LastTotalStars; lblLikes.BackColor = change > 0 ? Color.LightGreen : Color.LightPink; PopupMessage msg = new PopupMessage { Caption = Repo.DisplayName, Text = $"Stars: {repoInfo.Stargazers} ({(change > 0 ? "+" : string.Empty)}{change})", Image = Properties.Resources.Feature_32x32 }; using (var popupNotifier = new NotificationWindow.PopupNotifier()) { { popupNotifier.TitleText = msg.Caption; popupNotifier.ContentText = msg.Text; popupNotifier.IsRightToLeft = false; popupNotifier.Image = msg.Image; popupNotifier.TitleFont = new Font(popupNotifier.TitleFont.FontFamily, 16.0f); popupNotifier.ContentColor = change > 0 ? Color.ForestGreen : Color.Red; popupNotifier.ContentFont = new Font(popupNotifier.ContentFont.FontFamily, 14.0f); popupNotifier.IgnoreWhenFullScreen = true; popupNotifier.AutoContentHeight = true; } if (change > 0 || !UserSettingsManager.Instance.DoNotShowDecrementPopups) { popupNotifier.Popup(); } } } else { lblLikes.BackColor = SystemColors.Control; } Repo.LastTotalStars = repoInfo.Stargazers; lblLikes.Text = "Stars: " + repoInfo.Stargazers; List <GitHubIssue> relevantIssues = new List <GitHubIssue>(); if (Repo.ShowOpenIssues && Repo.OpenIssues != repoInfo.OpenIssues) { int change = repoInfo.OpenIssues - Repo.OpenIssues; string issuesInfo = string.Empty; if (change > 0) { var issues = await GitHubUtils.GetAsync <GitHubIssue[]>(Repo.RepoApiIssuesUrl, UserSettingsManager.Instance.GitHubToken, lastCheck); if (issues.newData) { relevantIssues = issues.result.Take(change).ToList(); //foreach (var issue in relevantIssues) //{ // if (issue.comments > 0) // { // var comments = await GitHubUtils.GetAsync<GitHubComment[]>(issue.comments_url, // UserSettingsManager.Instance.GitHubToken, lastCheck); // } //} issuesInfo = string.Join(Environment.NewLine, relevantIssues.Select(i => i.Title)); cmsIssues.Items.Clear(); foreach (var issue in relevantIssues) { cmsIssues.Items.Add(issue.Title, null, (_, __) => OpenLink(issue.html_url)); } } } PopupMessage msg = new PopupMessage { Caption = Repo.DisplayName, Text = $"Open Issues: {repoInfo.OpenIssues} ({(change > 0 ? "+" : string.Empty)}{change}): {issuesInfo}", Image = Properties.Resources.Feature_32x32, }; foreach (var issue in relevantIssues) { using (var popupNotifier = new NotificationWindow.PopupNotifier()) { { popupNotifier.TitleText = msg.Caption; popupNotifier.ContentText = issue.Title; popupNotifier.IsRightToLeft = false; popupNotifier.Image = msg.Image; popupNotifier.TitleFont = new Font(popupNotifier.TitleFont.FontFamily, 14.0f); popupNotifier.ContentColor = change > 0 ? Color.ForestGreen : Color.Red; popupNotifier.ContentFont = new Font(popupNotifier.ContentFont.FontFamily, 11); popupNotifier.IgnoreWhenFullScreen = true; popupNotifier.AutoContentHeight = true; } if (change > 0 || !UserSettingsManager.Instance.DoNotShowDecrementPopups) { popupNotifier.Popup(); } } } Repo.OpenIssues = repoInfo.OpenIssues; lnklblIssues.Text = "Open Issues: " + repoInfo.OpenIssues; lnklblIssues.BackColor = change > 0 ? Color.LightGreen : Color.LightPink; } else { lnklblIssues.BackColor = SystemColors.Control; } }