Exemplo n.º 1
0
 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0 || e.RowIndex > dataGridView1.Rows.Count)
     {
         return;
     }
     m.fullnot.SetNot(RSS.ConvertToNotification(lastItems[e.RowIndex]));
     dataGridView1.ClearSelection();
     m.fullnot.Show();
 }
Exemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            int way = 0;

            try
            {
                way++;
                XmlNode[] oldmivz = new XmlNode[MAX_UPDATES];
                way++;
                mivz.CopyTo(oldmivz);
                way++;
                rss.Refresh();
                way++;
                mivz = rss.GetLastItems(Notification.NotificationTypes.Any, MAX_UPDATES);
                way++;
                Notification n = RSS.ConvertToNotification(mivz[0]);
                way++;
                if (RSS.ConvertToNotification(oldmivz[0]).title != n.title)
                {
                    way = 10;
                    bool flag = false;
                    for (int i = 0; i < 5 && !flag; i++)
                    {
                        if (RSS.ConvertToNotification(oldmivz[i]).description == n.description)
                        {
                            flag = true;
                        }
                    }
                    way++;
                    if (!flag)
                    {
                        way = 15;
                        not.ShowNotification(n);
                        way++;
                        mivz = rss.GetLastItems(Notification.NotificationTypes.Any, MAX_UPDATES);
                        way++;
                        Updates();
                        way++;
                    }
                }
                ads++;
                if (ads == 3)
                {
                    //webBrowser1.Refresh();
                    ads = 0;
                }
            }
            catch
            {
                new Error("קיימת בעיית תוכנה כללית, אם הבעיה מתמשכת פנה אלינו במייל: " + App.mail + "\r\n(קוד בעיה: " + way + ")").ShowDialog();
            }
        }
Exemplo n.º 3
0
 private void Updates()
 {
     dataGridView1.Rows.Clear();
     for (int i = 0; i < MAX_UPDATES; i++)
     {
         nots[i] = RSS.ConvertToNotification(mivz[i]);
         dataGridView1.Rows.Add(new object[]
         {
             nots[i].title
         });
     }
     dataGridView1.ScrollBars = ScrollBars.Both;
 }
Exemplo n.º 4
0
        private void numericUpDown1_ValueChanged(object sender, EventArgs e)
        {
            Notification not = null;

            lastItems = m.rss.GetLastItems(TYPE, m.rss.Count());
            dataGridView1.Rows.Clear();
            for (int i = 0; i < numericUpDown1.Value; i++)
            {
                not = RSS.ConvertToNotification(lastItems[i]);
                dataGridView1.Rows.Add(new object[]
                {
                    (i + 1).ToString(),
                    not.title,
                    not.time
                });
            }
        }
Exemplo n.º 5
0
        private void LoadApp(object sender, EventArgs e)
        {
            if (startTimer != null)
            {
                startTimer.Stop();
            }
            int code = 0;

            try
            {
                this.Enabled = false;
                bool firstconnect = false;
tryingToCreate:
                {
                    try
                    {
                        if (!Directory.Exists(App.path))
                        {
                            Directory.CreateDirectory(App.path);
                            firstconnect = true;
                        }
                    }
                    catch
                    {
                        if (App.path == Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/mivzaklive")
                        {
                            new Error("לתוכנה חסרות הרשאות לתיקיות Program Files / My Documents. נא להוסיף הרשאות או להפעיל כמנהל.").ShowDialog();
                            return;
                        }
                        else
                        {
                            App.path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/mivzaklive";
                            goto tryingToCreate;
                        }
                    }
                }
                code++;
                RegistryKey reg = Registry.CurrentUser.CreateSubKey("MivzakLive");
                if (firstconnect)
                {
                    reg.SetValue("Dir", App.path);
                }
                else
                {
                    App.path = reg.GetValue("Dir", Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "/mivzaklive").ToString();
                }
                reg.Close();
                code++;
                if (Process.GetProcessesByName("Alarm").Length > 1)
                {
                    new Error("התוכנה כבר פועלת.").ShowDialog();
                    return;
                }
                Loading load = new Loading(false);
                load.Show();
                load.progressBar1.Minimum = 0;
                load.progressBar1.Maximum = 12;
                load.progressBar1.Value   = 0;
                load.label1.Refresh();
                load.progressBar1.Refresh();
                if (!App.IsConnectedToInternet())
                {
                    new Error("לשימוש בתוכנה זו עליך להיות מחובר לאינטרנט.").ShowDialog();
                    return;
                }
                load.progressBar1.Value++;
                code++;
                File.WriteAllText(App.path + "/conf.tmp", App.ReadFromWeb(App.programurl + "configuration.cfg"));
                load.progressBar1.Value++;
                code++;
                if (App.INIGetKey(App.path + "/conf.tmp", "Lock") == "1")
                {
                    new Error(App.ReadFromWeb(App.INIGetKey(App.path + "/conf.tmp", "LockMessage"))).ShowDialog();
                    return;
                }
                client = new WebClient();
                load.progressBar1.Value++;
                code++;
                if (firstconnect)
                {
                    Directory.CreateDirectory(App.path);
                    for (int i = 0; i < App.files.Length; i++)
                    {
                        client.DownloadFile(App.programurl + "install/" + App.files[i], App.path + "/" + App.files[i]);
                    }
                }
                else
                {
                    bool testone = App.CheckFiles(1);
                    if (!testone)
                    {
                        new Error("קבצי התוכנה פגומים, הורד אותה מחדש (Error #1).").ShowDialog();
                        return;
                    }
                }
                load.progressBar1.Value++;
                code++;
                App.ReadConfiguration(App.path + "/setting.cfg", ' ', ref Variables.setting);
                load.progressBar1.Value++;
                code++;
                App.ReadConfiguration(App.path + "/" + Variables.setting["language"] + ".lang", '=', ref Variables.text);
                load.progressBar1.Value++;
                code++;
                if (!App.CheckFiles(2))
                {
                    new Error("קבצי התוכנה פגומים, הורד אותה מחדש (Error #2).");
                }
                load.progressBar1.Value++;
                code++;
                if (App.INIGetKey(App.path + "/conf.tmp", "NewestVersion") != App.version)
                {
                    load.Hide();
                    new UpdateVersion().ShowDialog();
                    return;
                }
                load.progressBar1.Value++;
                code++;
                string u = App.INIGetKey(App.path + "/conf.tmp", "Footer");
                if (u.EndsWith(".html"))
                {
                    webBrowser1.Visible = true;
                    pictureBox4.Visible = false;
                    webBrowser1.Url     = new Uri(u);
                }
                else
                {
                    webBrowser1.Visible = false;
                    pictureBox4.Visible = true;
                    client.DownloadFileAsync(new Uri(u), App.path + "/footer.jpg");
                    client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
                }
                load.progressBar1.Value++;
                code++;
                App.website = App.INIGetKey(App.path + "/conf.tmp", "Website");
                App.mail    = App.INIGetKey(App.path + "/conf.tmp", "Mail");
                File.Delete(App.path + "/conf.tmp");
                load.progressBar1.Value++;
                code++;
                rss  = new RSS(App.rssurl, true);
                mivz = rss.GetLastItems(Notification.NotificationTypes.Any, MAX_UPDATES);
                Updates();
                load.progressBar1.Value++;
                code++;
                notifyIcon1.Visible        = true;
                toolStripStatusLabel2.Text = "V " + App.version;
                toolStripStatusLabel6.Text = App.mail;
                for (int i = 0; i < checkedListBox1.Items.Count; i++)
                {
                    checkedListBox1.SetItemChecked(i, Convert.ToInt32(Variables.setting["not" + (i + 1)].ToString()) == 1);
                }
                not     = new Not(this);
                fullnot = new FullNot();
                load.progressBar1.Value++;
                code++;
                LoadMyLanguage();
                code++;
                timer1.Start();
                load.Close();
                dataGridView1.ClearSelection();
                this.Enabled = true;
                this.Focus();
                if (firstconnect)
                {
                    ToolTip tt = new ToolTip();
                    tt.IsBalloon   = true;
                    tt.ToolTipIcon = ToolTipIcon.Info;
                    tt.Show("לשינוי שפה לחץ על כאן\nClick here to switch language", this, 0, 0, 5000);
                    //File.Move(Application.ExecutablePath, App.path + "/Alarm.exe");
                }
                if (File.Exists(App.path + "/Changelog.txt"))
                {
                    new Changelog().ShowDialog();
                    string startup = Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "/Alarm.exe";
                    if (File.Exists(startup))
                    {
                        File.Copy(Application.ExecutablePath, startup, true);
                    }
                }
                code++;
            }
            catch
            {
                if (File.Exists(App.path + "/conf.tmp"))
                {
                    File.Delete(App.path + "/conf.tmp");
                }
                new Error("נוצרה בעיית טעינה, אנא נסה שוב. אם הבעיה חוזרת על עצמה צור קשר במייל: " + App.mail + "\r\n(קוד בעיה: " + code + ")").ShowDialog();
            }
        }