Example #1
0
        public Form1(string[] args)
        {
            this.Width = 800;
            this.Height = 600;
            InitializeComponent();
            _tabs = new TabControl();
            _tabs.Dock = DockStyle.Fill;
            Controls.Add(_tabs);

            var page = new TabPage("File0");
            page.Width = _tabs.Width;
            page.Height = Convert.ToInt32(_tabs.Height * 0.9);

            string path = calc(args);
            input(path);
            sum = new int[row, col];
            mark = new int[row, col];
            ans = -INF;

            MaxSum thismaxsum = new MaxSum(map, row, col, ref ans, ref mark, mode);
            DrawMaxSum(page);
            ShowMaxSum(page);
            _tabs.SelectedTab = page;
            _tabs.TabPages.Add(page);
        }
Example #2
0
        public override string ToString()
        {
            string str = Name + Environment.NewLine +
                         "Валюта: " + Currency.Name + Environment.NewLine +
                         "Под: " + Coefficient + "%" + Environment.NewLine +
                         "Сумма: ";

            if (MinSum == 0 & MaxSum == 0)
            {
                str += "не ограничена";
            }
            else if (MinSum == 0 & MaxSum > 0)
            {
                str += "до " + MaxSum.ToString("N3") + " " + Currency.Abbreviation;
            }
            else if (MinSum > 0 & MaxSum == 0)
            {
                str += "от " + MinSum.ToString("N3") + " " + Currency.Abbreviation;
            }
            else
            {
                str += "от " + MinSum.ToString("N3") + " " + Currency.Abbreviation + " до " + MaxSum.ToString("N3") + " " + Currency.Abbreviation;
            }
            return(str);
        }
Example #3
0
        public void FindSum_PassArray_SumIsCorrect(string array, int actualMaxvalue)
        {
            var testArr = array
                          .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                          .Select(num => int.Parse(num.Trim())).ToArray();
            MaxSum maxSum      = new MaxSum();
            var    maxSumValue = maxSum.FindSum(testArr);

            Assert.AreEqual(actualMaxvalue, maxSumValue);
        }
        public void Report()
        {
            //Console.Clear();
            Console.ForegroundColor = ConsoleColor.Green;
            var sum = MaxSum.ToString(CultureInfo.InvariantCulture);

            if (MaxSumIndices.Count == 0)
            {
                sum = Messages.None;
            }
            Console.Write(Messages.Sum);
            Console.WriteLine(sum);
            Console.Write(Messages.AtFollowingIndices);
            Display(MaxSumIndices);
            Console.Write(Messages.FaultyLines);
            Display(BadStringsIndices);
            Console.ForegroundColor = ConsoleColor.Gray;
        }
Example #5
0
 protected override void WndProc(ref Message m)
 {
     if (m.Msg == Program.WM_COPYDATA && (uint)m.WParam == 101)
     {
         var cd = (Program.COPYDATASTRUCT)Marshal.PtrToStructure(m.LParam, typeof(Program.COPYDATASTRUCT));
         string prevpath = cd.lpData;
         string path = calc2(prevpath);
         input(path);
         var page = new TabPage("File" + (++cas));
         page.Width = _tabs.Width;
         page.Height = Convert.ToInt32(_tabs.Height * 0.9);
         ans = -INF;
         MaxSum thismaxsum = new MaxSum(map, row, col, ref ans, ref mark, mode);
         DrawMaxSum(page);
         ShowMaxSum(page);
         _tabs.TabPages.Add(page);
         _tabs.SelectedTab = page;
         return;
     }
     base.WndProc(ref m);
 }