Example #1
0
        public virtual int LoadFromFile()
        {
            COperation aAddtoBase = new COperation("1", "1");

            mOperationList.Add(aAddtoBase);
            return(1);
        }
Example #2
0
        public override int LoadFromFile() // Funkcja odczytujaca z pliku xml i wrzucająca składniki do listy
        {
            int i         = 0;
            int aListSize = mOperationList.Count();

            try
            {
                XDocument aXMLBase = XDocument.Load(mPath);
                mExtraList = (from COperation in aXMLBase.Root.Elements("Dzialanie")
                              select new COperation(
                                  COperation.Element("Rownanie").Value,
                                  COperation.Element("Wynik").Value
                                  )
                              ).ToList <COperation>();
                while (i < mExtraList.Count() && mExtraList[i] != null && aListSize != 3)
                {
                    mOperationList.Add(mExtraList[i]);
                    i++;
                    aListSize++;
                }
            }
            catch (FileNotFoundException)
            {
                return(-1);
            }

            return(1);
        }
Example #3
0
        public override int LoadFromFile() // Funkcja odczytujaca z pliku txt
        {
            string aOperation;
            string aScore;
            int    aTabLoad = mOperationList.Count();

            try
            {
                using (StreamReader aOnlyRead = new StreamReader(mPath))
                {
                    do
                    {
                        aOperation = aOnlyRead.ReadLine();
                        aScore     = aOnlyRead.ReadLine();
                        if (aOperation != null && aScore != null && aTabLoad != 3)
                        {
                            COperation aAddToBase = new COperation(aOperation, aScore);
                            mOperationList.Add(aAddToBase);
                            aTabLoad++;
                        }
                    } while ((aOperation != null || aScore != null) && aTabLoad != 3);
                }
            }
            catch (FileNotFoundException)
            {
                return(-1);
            }
            return(1);
        }
Example #4
0
 public void AddintoBase(COperation aRownanie) // Funkcja dodajaca element do listy
 {
     if (mOperationList.Count >= 3)
     {
         mOperationList.Insert(0, aRownanie);
         mOperationList.RemoveAt(3);
     }
     else
     {
         mOperationList.Insert(0, aRownanie);
     }
 }
Example #5
0
 private void Rownosc_Click(object sender, EventArgs e)
 {
     if (Wypisywacz.Text != null && Wypisywacz.Text != "")
     {
         COperation aAddtoBase = new COperation(Wypisywacz.Text);
         string     aName      = Wypisywacz.Text;
         FunctionofEqual(ref aName);
         Wypisywacz.Text  = aName;
         aAddtoBase.Score = aName;
         mBase.AddintoBase(aAddtoBase);
     }
 }
Example #6
0
 private void AddToLast_Click(object sender, EventArgs e)
 {
     if (Wypisywacz.Text != null && Wypisywacz.Text != "")
     {
         COperation aAddtoBase = new COperation(Wypisywacz.Text);
         string     aName      = Wypisywacz.Text;
         FunctionofEqual(ref aName);
         aAddtoBase.Score = aName;
         COperation aWasinBase = new COperation(mBase.SendMathOperation(), mBase.SendScore());
         aWasinBase = aWasinBase + aAddtoBase;
         mBase.AddintoBase(aWasinBase);
         Wypisywacz.Text = aWasinBase.Score;
         if (WyswietlenieBazy.Visible == true)
         {
             WyswietlenieBazy.Text = mBase.ShowaBase();
         }
     }
 }