void TryToConnectInternet() { try { LoadCodeDict(); lessMy = Worker.GetLessons(GroupStr[0], Worker.GetTimestampThisDay(), CodeDict); myLessons1.LoadTable(lessMy, GroupStr[0], CodeDict); settingsUC1.CodeDict = CodeDict; myLessons1.Enabled = true; myLessons2.Enabled = true; myLessons3.Enabled = true; settingsUC1.Enabled = true; ContactBtn.Enabled = true; Friend2LessBtn.Enabled = true; FriendLessBtn.Enabled = true; MyLesButton.Enabled = true; SettingsBtn.Enabled = true; noInternet1.Visible = false; } catch (Exception) { } }
private void MyLesButton_Click(object sender, EventArgs e) { if (CheckNet()) { SidePanel.Height = MyLesButton.Height; SidePanel.Top = MyLesButton.Top; myLessons1.BringToFront(); try { if (lessMy == null || !myLessons1.TableLoaded) { lessMy = Worker.GetLessons(GroupStr[0], Worker.GetTimestampThisDay(), CodeDict); myLessons1.dayindex = 0; } myLessons1.LoadTable(lessMy, GroupStr[0], CodeDict); } catch (Exception) { NoInternetReaction(); } } else { NoInternetReaction(); } }
private void Friend2LessBtn_Click(object sender, EventArgs e) { if (CheckNet()) { SidePanel.Height = Friend2LessBtn.Height; SidePanel.Top = Friend2LessBtn.Top; myLessons3.BringToFront(); try { if (lessfrnd2 == null || !myLessons3.TableLoaded) { lessfrnd2 = Worker.GetLessons(GroupStr[2], Worker.GetTimestampThisDay(), CodeDict); } { myLessons3.LoadTable(lessfrnd2, GroupStr[2], CodeDict); myLessons3.dayindex = 0; } } catch (Exception) { NoInternetReaction(); } } else { NoInternetReaction(); } }
private void NextDayBtn_Click(object sender, EventArgs e) { dayindex += 1; TableLoaded = false; try { Lessons les = Worker.GetLessons(group, Worker.GetTimestampThisDay() + dayindex * 86400, codedict); this.countOflesson = les.LessonCount; ChangeLesVar?.Invoke(les); LoadTable(les, this.group, this.codedict); } catch (Exception) { NoInternetEv?.Invoke(); } }
void LoadFrnd2less(Lessons les) { this.lessfrnd2 = les; }
void LoadFrndless(Lessons les) { this.lessFrn = les; }
void LoadMyless(Lessons les) { this.lessMy = les; }
public void LoadTable(Lessons les, string grp, JsnDec dic) { Lab_group.Text = grp; int i = les.LessonCount; group = grp; codedict = dic; //if (countOflesson == null) countOflesson = i; MakeVisible(false, countOflesson.Value); if (TableLoaded == false) { TableLoaded = true; this.countOflesson = les.LessonCount; DateTime dt = new DateTime(1970, 1, 1); dt = dt.AddSeconds(les.timestamp); Lab_date.Text = dt.ToString().Substring(0, 10); if (i != 0 && i < 7) { LabFree.Visible = false; do { switch (i) { case 5: { Lab_name4.Text = les.lessons[4].name; Lab_room4.Text = les.lessons[4].room; Lab_teacher4.Text = les.lessons[4].teacher; Lab_time4.Text = les.lessons[4].time; } break; case 4: { Lab_name3.Text = les.lessons[3].name; Lab_room3.Text = les.lessons[3].room; Lab_teacher3.Text = les.lessons[3].teacher; Lab_time3.Text = les.lessons[3].time; } break; case 3: { Lab_name2.Text = les.lessons[2].name; Lab_room2.Text = les.lessons[2].room; Lab_teacher2.Text = les.lessons[2].teacher; Lab_time2.Text = les.lessons[2].time; } break; case 2: { Lab_name1.Text = les.lessons[1].name; Lab_room1.Text = les.lessons[1].room; Lab_teacher1.Text = les.lessons[1].teacher; Lab_time1.Text = les.lessons[1].time; } break; case 1: { Lab_name0.Text = les.lessons[0].name; Lab_room0.Text = les.lessons[0].room; Lab_teacher0.Text = les.lessons[0].teacher; Lab_time0.Text = les.lessons[0].time; } break; } i = i - 1; } while (i > 0); } else { LabFree.Visible = true; } } }