Exemplo n.º 1
0
        public MainForm()
        {
            bool checkinternet = CheckConnection(checkinternetping); if (checkinternet == false)

            {
                MessageBox.Show("Nelze se připojit ke vzdálenému serveru.", "Chyba", MessageBoxButtons.OK, MessageBoxIcon.Error); GV.OK = 0; if (Application.MessageLoop)
                {
                    Application.Exit();
                }
                else
                {
                    Environment.Exit(1);
                }
            }

            if (GV.OK == 1)
            {
                InitializeComponent();

                var     json     = new WebClient().DownloadString(String.Format(website));
                CB_JSON app_json = JsonConvert.DeserializeObject <CB_JSON>(json);

                if (app_json.Kaktus_version != version)
                {
                    Text = "Kaktus - Dobíječka - " + version + " (" + app_json.Kaktus_version + ")";
                    text_version_aktualni.Visible   = false;
                    text_version_neaktualni.Visible = true;
                }
                else
                {
                    Text = "Kaktus - Dobíječka - " + version + "";
                    text_version_aktualni.Visible   = true;
                    text_version_neaktualni.Visible = false;
                }

                if (app_json.Kaktus_dobijecka == "1")
                {
                    notifyIcon1.Visible         = true;
                    notifyIcon1.BalloonTipTitle = "KAKTUS - DOBÍJEČKA!";
                    notifyIcon1.BalloonTipText  = "Právě probíhá dobíječka.";
                    notifyIcon1.BalloonTipIcon  = ToolTipIcon.Warning;
                    notifyIcon1.ShowBalloonTip(5000);
                    notifyIcon1.Icon = Properties.Resources.icon_active;

                    text_main.Text      = "Právě probíhá dobíječka!";
                    text_main.ForeColor = Color.Green;
                    text_main.Font      = new Font("Microsoft Sans Serif", 23, FontStyle.Bold);
                }
                else
                {
                    notifyIcon1.Icon    = Properties.Resources.faicon;
                    text_main.Text      = "Právě neprobíhá dobíječka";
                    text_main.ForeColor = Color.Red;
                    text_main.Font      = new Font("Microsoft Sans Serif", 21, FontStyle.Bold);
                }

                InitTimer();
            }
        }
Exemplo n.º 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            bool checkinternet = CheckConnection(checkinternetping);

            if (checkinternet == false)
            {
                text_main.Text      = "Nelze se připojit k serveru";
                text_main.ForeColor = Color.Red;
                text_main.Font      = new Font("Microsoft Sans Serif", 21, FontStyle.Bold);
                GV.OK = 0;
            }
            else
            {
                GV.OK = 1;
            }

            if (GV.OK == 1)
            {
                var     json     = new WebClient().DownloadString(String.Format(website));
                CB_JSON app_json = JsonConvert.DeserializeObject <CB_JSON>(json);

                if (app_json.Kaktus_version != version)
                {
                    Text = "Kaktus - Dobíječka - " + version + " (" + app_json.Kaktus_version + ")";
                    text_version_aktualni.Visible   = false;
                    text_version_neaktualni.Visible = true;
                }
                else
                {
                    Text = "Kaktus - Dobíječka - " + version + "";
                    text_version_aktualni.Visible   = true;
                    text_version_neaktualni.Visible = false;
                }

                if (app_json.Kaktus_dobijecka == "1")
                {
                    notifyIcon1.Visible         = true;
                    notifyIcon1.BalloonTipTitle = "KAKTUS - DOBÍJEČKA!";
                    notifyIcon1.BalloonTipText  = "Právě probíhá dobíječka.";
                    notifyIcon1.BalloonTipIcon  = ToolTipIcon.Warning;
                    notifyIcon1.ShowBalloonTip(5000);
                    notifyIcon1.Icon = Properties.Resources.icon_active;

                    text_main.Text      = "Právě probíhá dobíječka!";
                    text_main.ForeColor = Color.Green;
                    text_main.Font      = new Font("Microsoft Sans Serif", 23, FontStyle.Bold);
                }
                else
                {
                    notifyIcon1.Icon    = Properties.Resources.faicon;
                    text_main.Text      = "Právě neprobíhá dobíječka";
                    text_main.ForeColor = Color.Red;
                    text_main.Font      = new Font("Microsoft Sans Serif", 21, FontStyle.Bold);
                }
            }
        }