private void загрузитьПоследнееСостояниеToolStripMenuItem_Click(object sender, EventArgs e) { BinaryFormatter binFormat = new BinaryFormatter(); Stream fStream = File.OpenRead("currstateCartogram.bin"); // JamesBondClass carFromDisk = //(JamesBondClass)binFormat.Deserialize(fStream); this.MyCartogram = (Cartogram)binFormat.Deserialize(fStream); fStream.Close(); this.g.Clear(Color.WhiteSmoke); NextTvs = this.MyCartogram.MynextTVS; this.MyCartogram.InitComponentsAfterDeserialize(this.g, this.pictureBox1, this.myPen); this.MyCartogram.RePaintAll(checkBox1.Checked, checkBox2.Checked, checkBox3.Checked); // MyCartogram.DrawAllAxis(); if (checkBox4.Checked) { MyCartogram.DrawGrid(this.NextTvs); } SetNewSuCord(); ReDrawSU(); }
private void Form1_Load(object sender, EventArgs e) { button1.BackColor = Color.CadetBlue; button3.BackColor = Color.DarkOrange; this.MaximizeBox = false; //this.MinimizeBox = false; pictureBox1.Dock = DockStyle.Fill; ////Этой хренькой я рисую границы ТВСок....Черной хренькой myPen = new System.Drawing.Pen(System.Drawing.Color.Black); myPen.Width = 4; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); g = Graphics.FromImage(myBitmap); MyCartogram = new Cartogram(g, pictureBox1, myPen); pictureBox1.Image = myBitmap; LinearGradientBrush lgbfon = new LinearGradientBrush( new Point(0, 0), new Point(pictureBox1.Width, pictureBox1.Height), Color.White, Color.Silver); g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); LinearGradientBrush lgb = new LinearGradientBrush( new Point(0, 0), new Point(1500, 0), Color.White, Color.Blue); // LinearGradientBrush lgb = new LinearGradientBrush() /// g.FillRectangle(lgb, this.ClientRectangle); // g.FillRectangle(Brushes.RoyalBlue, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //ЗАКРАСКА ФОНОМ БАССЕЙНА g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); LinearGradientBrush lgbdri = new LinearGradientBrush( new Point(0, 0), new Point(100, 0), Color.White, Color.Chocolate); //СТОЛ ДРИ g.FillRectangle(lgbdri, (int)(0.85 * this.pictureBox1.Width), (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); g.DrawString("ДРИ", myF, Brushes.Black, (int)(0.86 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = new SolidBrush(Color.Chocolate); //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); //MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawGrid(); MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); timer1.Enabled = true; ///ЛОГГЕР ОШИБОЧНО ЗАГРУЖЕННЫХ ТВС /// }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { toolTip1.SetToolTip(button2, "Поворот по часовой"); toolTip1.SetToolTip(button3, "Поворот против часовой"); pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; button4.Left = (tableLayoutPanel3.Width - button4.Width) / 2; tabPage1.BackColor = Color.Gray; button1.BackColor = Color.CadetBlue; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); pictureBox1.Image = myBitmap; g = Graphics.FromImage(myBitmap); myPen = new System.Drawing.Pen(Color.ForestGreen); myPen.Width = 2; MyCartogram = new Cartogram(g, pictureBox1, myPen); g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); //LinearGradientBrush lgbfon = new LinearGradientBrush( // new Point(0, 0), // new Point(pictureBox1.Width, pictureBox1.Height), // Color.White, // Color.Silver); //g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); ///для бассейна /// LinearGradientBrush lgb = new LinearGradientBrush( new Point(0, 0), new Point(1500, 0), Color.White, Color.Blue); //ЗАКРАСКА ФОНОМ БАССЕЙНА // g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); //g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); // LinearGradientBrush lgbdri = new LinearGradientBrush( // new Point((int)(0.95 * this.pictureBox1.Width), 0), // new Point(this.pictureBox1.Width, 0), // Color.White, // Color.Chocolate); // //СТОЛ ДРИ // g.FillRectangle(lgbdri, (int)(0.95 * this.pictureBox1.Width)+1, (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); ////g.DrawString(`) // Font myF1 = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 10, FontStyle.Bold); // g.DrawString("ДРИ", myF1, Brushes.Black, (int)(0.95 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = new SolidBrush(Color.Chocolate); //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawGrid(NextTvs); //MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; // label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); timer1.Enabled = true; // timer2.Enabled = true; //for (int i = 0; i < 20; i++) //{ // RotateRight(); // Thread.Sleep(100); //} //for (int i = 0; i < 20; i++) //{ // RotateLeft(); // Thread.Sleep(100); //} //MessageBox.Show(MyCartogram.getFA().ToString()); //MessageBox.Show(MyCartogram.getFstep().ToString()); }
private void button1_Click_2(object sender, EventArgs e) { // MessageBox.Show(MyCartogram.Zona[1].Cord.X.ToString() + "-" + MyCartogram.Zona[10].Cord.Y.ToString()); timer1.Enabled = false; if ((totalInZOne < 163) && (NextTvs < 163)) { const string message = "ТВС Загружена без замечаний ?"; const string caption = "Подтверждение"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.Yes) { updateFieldsIfYes(); MyCartogram.SetTVSColor(NextTvs, true); MyCartogram.Zona[NextTvs].Color = mybrash; MyCartogram.UpdateLoadNumber(checkBox1.Checked); this.NextTvs++; if (NextTvs + 1 < 164) { numericUpDown1.Value = NextTvs + 1; } } ///ТВС Загружена без замечаний else { var isload = MessageBox.Show("Загружена ли ТВС? (ДА - загружена, НЕТ - временно отложена)", caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (isload == DialogResult.Yes) { ///сюда будут писаться замечания если имеются /// string value = "";; if (MyConst.InputBoxZam("Введите замечание", "Пожалуйста введите причину замечания", ref value) == DialogResult.OK) { MyCartogram.Zona[NextTvs].Zamechanie = value; MyCartogram.Zona[NextTvs].Redmark = true; } updateFieldsIfYes(); MyCartogram.SetTVSSolidColor(Brushes.Brown, NextTvs, false); MyCartogram.Zona[NextTvs].Color = Brushes.Brown; MyCartogram.UpdateLoadNumber(checkBox1.Checked); this.NextTvs++; if (NextTvs + 1 < 164) { numericUpDown1.Value = NextTvs + 1; } // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == numericUpDown1.Value //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } } else { ///ТУТ ТЕКСТ ЕСЛИ ТВС ВООБЩЕ НЕ ЗАГРУЖЕНА /// MyCartogram.SetTVSSolidColor(Brushes.Red, NextTvs, false); MyCartogram.UpdateLoadNumber(checkBox1.Checked); MyCartogram.Zona[NextTvs].IsLoaded = false; MyCartogram.Zona[NextTvs].Color = Brushes.Red; MyCartogram.Zona[NextTvs].Smena = this.smena; string value = "";; if (MyConst.InputBoxZam("Введите замечание", "Пожалуйста введите причину замечания", ref value) == DialogResult.OK) { MyCartogram.Zona[NextTvs].Zamechanie = value; MyCartogram.Zona[NextTvs].Redmark = true; } listBox1.Items.Add((NextTvs + 1).ToString() + " в коор " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString() + " из-за " + MyCartogram.Zona[NextTvs].Zamechanie); StreamWriter errorLogger = new StreamWriter("LOGS/" + DateTime.Now.ToString().Replace(":", "_").Replace(",", "_") + ".csv", false, Encoding.GetEncoding("Windows-1251")); errorLogger.WriteLine((NextTvs + 1).ToString() + " в коор " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString() + " из-за " + MyCartogram.Zona[NextTvs].Zamechanie + "в " + DateTime.Now.ToString() + "в смену ы" + this.smena); errorLogger.Close(); // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == numericUpDown1.Value //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs++; if (NextTvs + 1 < 164) { numericUpDown1.Value = NextTvs + 1; } timer1.Enabled = true; } } ///////////////////////// /// ОТЧЕТ ДЛЯ ОНЛАЙН ПРОРИСОВКИ dataGridView1.Rows.Add(NextTvs, MyCartogram.Zona[NextTvs - 1].TVSnumber, MyCartogram.Zona[NextTvs - 1].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs - 1].Cord.Y.ToString(), MyCartogram.Zona[NextTvs - 1].IsLoaded.ToString(), MyCartogram.Zona[NextTvs - 1].LoadTime, MyCartogram.Zona[NextTvs - 1].Smena, MyCartogram.Zona[NextTvs - 1].VisotaOtmetka, MyCartogram.Zona[NextTvs - 1].Zamechanie); if (MyCartogram.Zona[NextTvs - 1].IsLoaded) { dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[3].Style.BackColor = Color.LightGreen; } else { dataGridView1.Rows[dataGridView1.RowCount - 1].Cells[3].Style.BackColor = Color.Red; } ///////////////////////// } //сколько всего в зоне else { if (totalInZOne == 163) { MessageBox.Show("Поздравляем, Вы загрузили все ТВС в активную зону"); } else { MessageBox.Show("Некоторые ТВС быди ранне не загружены. Пожалуйста выберете их как только они будут готовы к загрузке"); } } timer1.Enabled = true; // g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); // MyCartogram.RePaintAll(checkBox1.Checked); MyCartogram.DrawGrid(NextTvs); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form1_Load(object sender, EventArgs e) { // toolTip1.SetToolTip(button2, "Поворот по часовой"); // toolTip1.SetToolTip(button3, "Поворот против часовой"); pictureBox1.Height = Math.Min(tabPage1.Height, tabPage1.Width); pictureBox1.Width = pictureBox1.Height; pictureBox1.Left = (tabPage1.Width - pictureBox1.Width) / 2; pictureBox1.Top = 0; // button4.Left = (tableLayoutPanel3.Width - button4.Width) / 2; tabPage1.BackColor = Color.Gray; button1.BackColor = Color.CadetBlue; myBitmap = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height); pictureBox1.Image = myBitmap; g = Graphics.FromImage(myBitmap); myPen = new System.Drawing.Pen(Color.ForestGreen); myPen.Width = 2; MyCartogram = new Cartogram(g, pictureBox1, myPen); g.FillRectangle(Brushes.Gray, 0, 0, this.pictureBox1.Width, this.pictureBox1.Width); //LinearGradientBrush lgbfon = new LinearGradientBrush( // new Point(0, 0), // new Point(pictureBox1.Width, pictureBox1.Height), // Color.White, // Color.Silver); //g.FillRectangle(lgbfon, 0, 0, this.pictureBox1.Width, this.pictureBox1.Height); ///для бассейна /// //LinearGradientBrush lgb = new LinearGradientBrush( // new Point(0, 0), // new Point(1500, 0), // Color.White, // Color.Blue); //ЗАКРАСКА ФОНОМ БАССЕЙНА // g.FillRectangle(lgb, (int)(0.25 * this.pictureBox1.Width), (int)(0.95 * this.pictureBox1.Height), (int)(0.5 * this.pictureBox1.Width), (int)(0.05 * this.pictureBox1.Height)); //Font myF = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 14, FontStyle.Bold); //g.DrawString("БАССЕЙН", myF, Brushes.White, (int)(0.48 * this.pictureBox1.Width), (int)(0.97 * this.pictureBox1.Height)); // LinearGradientBrush lgbdri = new LinearGradientBrush( // new Point((int)(0.95 * this.pictureBox1.Width), 0), // new Point(this.pictureBox1.Width, 0), // Color.White, // Color.Chocolate); // //СТОЛ ДРИ // g.FillRectangle(lgbdri, (int)(0.95 * this.pictureBox1.Width)+1, (int)(0.1 * this.pictureBox1.Height), (int)(0.05 * this.pictureBox1.Width), (int)(0.20 * this.pictureBox1.Height)); ////g.DrawString(`) // Font myF1 = new Font(System.Windows.Forms.Control.DefaultFont.FontFamily, 10, FontStyle.Bold); // g.DrawString("ДРИ", myF1, Brushes.Black, (int)(0.95 * this.pictureBox1.Width), (int)(0.18 * this.pictureBox1.Height)); // g.FillRectangle(Brushes.Blue, (int)0.25 * this.pictureBox1.Width, (int)0.9 * this.pictureBox1.Height, (int)0.5 * this.pictureBox1.Width, (int)0.1 * this.pictureBox1.Height); mybrash = Color.Chocolate; //упорядочили все ТВС в порядке очередности загрузки //MessageBox.Show(Application.StartupPath + "\\draw.ini"); //MessageBox.Show(YYY.ToString()); MyCartogram.Show(); MyCartogram.UpdateLoadNumber(checkBox1.Checked); //отсортированные все ТВС в колекции по порядковому номеру загрузки MyCartogram.Zona.Sort(); // MyCartogram.UpdateTVSNumber(); MyCartogram.DrawAllAxis(); MyCartogram.DrawGrid(NextTvs); //MyCartogram.Zona.Sort(); //ЭТО БЫЛО НУЖНО ДО ТОГО КАК Я УПОРЯДОЧИЛ МАССИВ ТВС В ПОРЯДке ПОСЛЕДОВАТЕЛЬНОСТИ ЗАГРУЗКИ // var query = //from tvs in MyCartogram.Zona //where tvs.LoadNumber == 1 //select tvs; // foreach (var item in query) // { // this.NextTvs = item.TVSnumber; // } this.NextTvs = 0;// MyCartogram.Zona[2].TVSnumber; this.totalInDuty = 0; // label13.Text = "цель: " + MyCartogram.Zona[NextTvs].Cord.X.ToString() + "-" + MyCartogram.Zona[NextTvs].Cord.Y.ToString(); // timer2.Enabled = true; //for (int i = 0; i < 20; i++) //{ // RotateRight(); // Thread.Sleep(100); //} //for (int i = 0; i < 20; i++) //{ // RotateLeft(); // Thread.Sleep(100); //} ///ЭТО ЧИСТО ДЛЯ ВЫБОРА ЯЧЕЙКИ ГДЕ БУДЕТ СИГНАЛИЗАТОР comboBox1.Items.Clear(); foreach (Point item in MyConst.setka) { comboBox1.Items.Add(item); } comboBox1.SelectedIndex = 0; // RotateRight(); RotateLeft(); timer1.Enabled = true; if (File.Exists("currstateCartogram.bin")) { string message = "Обнаружен файл с предысторией. Восстановить состяние (ДА) или начать новое (НЕТ) ?"; const string caption = "Внимание!"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the no button was pressed ... if (result == DialogResult.Yes) { загрузитьПоследнееСостояниеToolStripMenuItem_Click(this, EventArgs.Empty); } } //Существует файл с предысторией работы }