Пример #1
0
		public void ReadFromStream (Stream stream)
		{
			this.stream = stream;

			byte[] section_name_buf = new byte[4];
			string section_name;

			sections = new Dictionary<string,SectionData>();

			while (true) {
				stream.Read (section_name_buf, 0, 4);

				SectionData sec_data = new SectionData();

				sec_data.data_length = Util.ReadDWord (stream);
				sec_data.data_position = stream.Position;

				section_name = Encoding.ASCII.GetString (section_name_buf, 0, 4);

				sections.Add (section_name, sec_data);

				if (stream.Position + sec_data.data_length >= stream.Length)
					break;

				stream.Position += sec_data.data_length;
			}

			/* parse only the sections we really care
			 * about up front.  the rest are done as
			 * needed.  this speeds up the Play Custom
			 * screen immensely. */

			/* find out what version we're dealing with */
			ParseSection ("VER ");
			if (sections.ContainsKey ("IVER"))
				ParseSection ("IVER");
			if (sections.ContainsKey ("IVE2"))
				ParseSection ("IVE2");

			/* strings */
			ParseSection ("STR ");

			/* load in the map info */

			/* map name/description */
			ParseSection ("SPRP");

			/* dimension */
			ParseSection ("DIM ");

			/* tileset info */
			ParseSection ("ERA ");

			/* player information */
			ParseSection ("OWNR");
			ParseSection ("SIDE");
		}
Пример #2
0
 public Section( FramedStream stream )
 {
     stream.PushFrame( 12 );
     Header = new SectionHeader( stream );
     stream.PopFrame();
     stream.PushFrame( Header.Size );
     Data = SectionData.FromStream( Header,  stream );
     stream.PopFrame();
 }
 private void Btn_unSelectedAll_Click(object sender, RoutedEventArgs e)
 {//unselect all
     try
     {
         int x = selectedInvoices.Count;
         for (int i = 0; i < x; i++)
         {
             lst_selectedInvoices.SelectedIndex = 0;
             Btn_unSelectedInvoice_Click(null, null);
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #4
0
 private void Tb_email_LostFocus(object sender, RoutedEventArgs e)
 {
     try
     {
         if (isFirstTime)
         {
             validateEmail(tb_email, p_errorEmail, tt_errorEmail);
         }
         else
         {
             SectionData.validateEmail(tb_email, p_errorEmail, tt_errorEmail);
         }
     }
     catch (Exception ex)
     { SectionData.ExceptionMessage(ex, this); }
 }
Пример #5
0
        private void Btn_itemsInGrid_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                grid_itemCards.Visibility     = Visibility.Collapsed;
                grid_itemsDatagrid.Visibility = Visibility.Visible;
                path_itemsInGrid.Fill         = (SolidColorBrush)(new BrushConverter().ConvertFrom("#178DD2"));
                path_itemsInCards.Fill        = (SolidColorBrush)(new BrushConverter().ConvertFrom("#4e4e4e"));

                Txb_searchitems_TextChanged(null, null);
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #6
0
        public SectionData GetSectionData(Section value1)
        {
            Boolean isValueEr = _positions.ContainsKey(value1);

            if (isValueEr == true)
            {
                SectionData SD = _positions[value1];
                return(SD);
            }
            else
            {
                _positions.Add(value1, null);
                SectionData SD = _positions[value1];
                return(SD);
            }
        }
Пример #7
0
    //Use this for first section
    public SectionData createSection(float min, float max, float range) {
        SectionData data = new SectionData(dimensions);
        Vector2 temp = getBounds((min + max) / 2f, range, min, max);
        min = temp.x;
        max = temp.y;
        
        data.botLeft = Random.Range(min, max);
        data.botRight = Random.Range(min, max);
        data.topLeft = Random.Range(min, max);
        data.topRight = Random.Range(min, max);

        //Now the data from the corners needs to be averaged and applied to each individual block
        data.fillValues();

        return data;
    }
        private void WriteSection(SectionData section, StringBuilder sb)
        {
            // Write blank line before section, but not if it is the first line
            if (sb.Length > 0) sb.AppendLine();

            // Leading comments
            WriteComments(section.LeadingComments, sb);

            //Write section name
            sb.AppendLine(string.Format("{0}{1}{2}", Configuration.SectionStartChar, section.SectionName, Configuration.SectionEndChar));

            WriteKeyValueData(section.Keys, sb);

            // Trailing comments
            WriteComments(section.TrailingComments, sb);
        }
Пример #9
0
        private void LoadSelectedSection()
        {
            ClearBarrierCubes();
            ClearCubes();
            SectionData selectedSectionData = _levels.LevelDatas[_selectedLevel].Sections[_selectedSection];

            foreach (var cubeData in selectedSectionData.CubeDatas)
            {
                Cube cube = CubeFactory.Instance.CreateCube(cubeData.CellPosition, cubeData.CubeType, _grid.transform);
            }
            foreach (var cubeData in selectedSectionData.BarrierDatas)
            {
                BarrierCube barrierCube = CubeFactory.Instance.CreateBarrierCube(cubeData.StartCellPosition, cubeData.EndCellPosition, _grid.transform);
            }
            Debug.Log($"Loaded {selectedSectionData.CubeDatas.Count} cubes and {selectedSectionData.BarrierDatas.Count} barrier cubes from Level {_selectedLevel}, Section {_selectedSection}");
        }
Пример #10
0
        public void remove_key_from_section()
        {
            string strKeyTest   = "Mykey";
            string strValueTest = "My value";

            var sd = new SectionData("section_test");

            //Add key
            sd.Keys.AddKey(strKeyTest);
            Assert.That(sd.Keys.Count, Is.EqualTo(1));
            Assert.That(sd.Keys.ContainsKey(strKeyTest), Is.True);

            sd.Keys.RemoveKey(strKeyTest);
            Assert.That(sd.Keys.Count, Is.EqualTo(0));
            Assert.That(sd.Keys.ContainsKey(strKeyTest), Is.False);
        }
Пример #11
0
 private void Btn_selectedAll_Click(object sender, RoutedEventArgs e)
 {//select all
     try
     {
         int x = allItemUnits.Count;
         for (int i = 0; i < x; i++)
         {
             dg_allItems.SelectedIndex = 0;
             Btn_selectedItem_Click(null, null);
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #12
0
        public static Dictionary <string, string> GetSectionItemsFromConfigIni(IniData data, string sect)
        {// возвращает словарь данных, заполненный парами из секции sect
            SectionData section = data.Sections.GetSectionData(sect);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Clear();
            if (section != null) // секция найдена
            {
                foreach (KeyData key in section.Keys)
                {
                    dictionary.Add(key.KeyName, key.Value);
                }
            }

            return(dictionary);
        }
Пример #13
0
        private void Btn_properties_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                refreashBachgroundClick(btn_properties);

                grid_main.Children.Clear();
                grid_main.Children.Add(UC_porperty.Instance);
                Button button = sender as Button;
                MainWindow.mainWindow.initializationMainTrack(button.Tag.ToString(), 1);
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #14
0
        private void Btn_stock_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                uc_stock uc = new uc_stock();
                main.Children.Add(uc);
                Button button = sender as Button;
                MainWindow.mainWindow.initializationMainTrack(button.Tag.ToString(), 2);

                sc_main.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #15
0
        public void add_keys_to_section()
        {
            string strKeyTest   = "Mykey";
            string strValueTest = "My value";

            var sd = new SectionData("section_test");

            //Add key
            sd.Keys.AddKey(strKeyTest);
            Assert.That(sd.Keys.Count, Is.EqualTo(1));
            Assert.That(sd.Keys.ContainsKey(strKeyTest), Is.True);

            //Assign value
            sd.Keys.GetKeyData(strKeyTest).Value = strValueTest;
            Assert.That(sd.Keys.GetKeyData(strKeyTest).Value, Is.EqualTo(strValueTest));
        }
        private void Btn_clear_Click(object sender, RoutedEventArgs e)
        {//clear
            try
            {
                tb_name.Clear();
                tb_cost.Clear();
                tb_notes.Clear();

                SectionData.clearValidate(tb_name, p_errorName);
                SectionData.clearValidate(tb_cost, p_errorCost);
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #17
0
        public void GiveStartingPositions(List <IParticipant> part, Track t)
        {
            LinkedList <Section>     Sectiontemplist = t.Sections;
            LinkedListNode <Section> current         = Sectiontemplist.Last;

            IParticipant[] partArray = new IParticipant[part.Count];
            int            i         = 0;

            foreach (IParticipant p in part)
            {
                partArray[i] = p;
                i++;
            }
            int count     = 0;
            int partcount = 0;

            while (count < Sectiontemplist.Count)
            {
                while (partcount < part.Count)
                {
                    if (current.Value.SectionType == SectionTypes.StartGrid)
                    {
                        SectionData tempData = getSectionData(current.Value);
                        if (tempData.Right == null)
                        {
                            tempData.Right         = partArray[partcount];
                            tempData.DistanceRight = 1;
                            partcount++;
                        }
                        else
                        {
                            tempData.Left         = partArray[partcount];
                            tempData.DistanceLeft = 0;
                            count++;
                            partcount++;
                            current = current.Previous;
                        }
                    }
                    else
                    {
                        current = current.Previous;
                        count++;
                    }
                }
                count++;
            }
        }
        private void fillPieChart()
        {
            List <string>         titles = new List <string>();
            IEnumerable <int>     x      = null;
            IEnumerable <decimal> cashes = null;

            titles.Clear();

            var cashTemp = closingTemp.GroupBy(m => m.posId).Select(
                g => new
            {
                posId      = g.Key,
                branchName = g.FirstOrDefault().branchName,
                branchId   = g.FirstOrDefault().branchId,
                cash       = g.LastOrDefault().cash
            });

            titles.AddRange(cashTemp.Select(jj => jj.branchName));

            var result = cashTemp.GroupBy(m => m.branchId)
                         .Select(
                g => new
            {
                branchId = g.Key,
                cash     = g.Sum(s => s.cash),
            });

            cashes = result.Select(m => decimal.Parse(SectionData.DecTostring(m.cash.Value)));

            SeriesCollection piechartData = new SeriesCollection();

            for (int i = 0; i < cashes.Count(); i++)
            {
                List <decimal> final = new List <decimal>();
                List <string>  lable = new List <string>();
                final.Add(cashes.ToList().Skip(i).FirstOrDefault());
                piechartData.Add(
                    new PieSeries
                {
                    Values     = final.AsChartValues(),
                    Title      = titles.Skip(i).FirstOrDefault(),
                    DataLabels = true,
                }
                    );
            }
            chart1.Series = piechartData;
        }
        private void Btn_shipping_Click(object sender, RoutedEventArgs e)
        {//shippings
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                MaterialDesignThemes.Wpf.HintAssist.SetHint(cb_vendors, MainWindow.resourcemanager.GetString("trShippingCompanyHint"));
                SectionData.ReportTabTitle(txt_tabTitle, this.Tag.ToString(), (sender as Button).Tag.ToString());

                cb_vendors.SelectedItem = null;
                selectedTab             = 3;

                paint();
                ReportsHelp.paintTabControlBorder(grid_tabControl, bdr_shipping);
                path_shipping.Fill = (SolidColorBrush)(new BrushConverter().ConvertFrom("#4E4E4E"));

                fillEvents();

                hideAllColumn();
                //show columns
                col_date.Visibility        = Visibility.Visible;
                col_amount.Visibility      = Visibility.Visible;
                col_proccesType.Visibility = Visibility.Visible;

                chk_allVendors.IsChecked = true;
                fillDateCombo(cb_vendorsDate);
                ShippingCombo = statisticModel.getShippingForStatementCombo(statement);
                //ShippingCombo = statisticModel.getShippingCombo(statement);
                fillShippingCombo(ShippingCombo, cb_vendors);

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #20
0
        private void Btn_save_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_serialNum);
                }
                if (_serialCount <= itemCount)
                {
                    if (lst_serials.Items.Count == itemCount)
                    {
                        serialList = new List <string>();
                        for (int i = 0; i < lst_serials.Items.Count; i++)
                        {
                            serialList.Add(lst_serials.Items[i].ToString());
                        }

                        _serialCount = 0;
                        valid        = true;
                        DialogResult = true;
                        this.Close();
                    }
                    else
                    {
                        //Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trShouldInputOneSerialNumberAtLeast"), animation: ToasterAnimation.FadeIn);
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trSerialNumbersEqualItemsNumber"), animation: ToasterAnimation.FadeIn);
                    }
                }
                else
                {
                    Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trErrorSerialMoreItemCountToolTip"), animation: ToasterAnimation.FadeIn);
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_serialNum);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_serialNum);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #21
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("POS.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("POS.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                #endregion

                listCash = await statisticModel.GetBytypeAndSideForPos("all", "p");

                accCombo = listCash.GroupBy(g => g.updateUserAcc).Select(g => new AccountantCombo {
                    Accountant = g.FirstOrDefault().updateUserAcc
                }).ToList();

                fillAccCombo();

                Btn_payments_Click(btn_payments, null);

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #22
0
        private async void Btn_deleteInventory_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }
                if (inventory.inventoryId != 0)
                {
                    #region
                    Window.GetWindow(this).Opacity = 0.2;
                    wd_acceptCancelPopup w = new wd_acceptCancelPopup();
                    w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxDelete");
                    w.ShowDialog();
                    Window.GetWindow(this).Opacity = 1;
                    #endregion
                    if (w.isOk)
                    {
                        int res = await inventory.delete(inventory.inventoryId, MainWindow.userID.Value, false);

                        if (res > 0)
                        {
                            Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopDelete"), animation: ToasterAnimation.FadeIn);

                            clearInventory();
                        }
                        else
                        {
                            Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                        }
                    }
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #23
0
        private async void Btn_itemsTaxNote_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                SectionData.StartAwait(grid_main);
                Window.GetWindow(this).Opacity = 0.2;

                wd_notes w = new wd_notes();
                w.maxLength = 100;
                //   w.note = "Test note...";
                itemtax_note_row = printList.Where(X => X.name == "itemtax_note").FirstOrDefault();
                itemtax_note     = itemtax_note_row.value;

                w.note = itemtax_note;
                w.ShowDialog();
                if (w.isOk)
                {
                    // MessageBox.Show(w.note);
                    //save
                    int res = 0;
                    itemtax_note_row.value = w.note.Trim();
                    res = await setvalueModel.Save(itemtax_note_row);



                    if (res > 0)
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                    await FillprintList();

                    await MainWindow.Getprintparameter();
                }

                Window.GetWindow(this).Opacity = 1;
                SectionData.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                SectionData.EndAwait(grid_main);
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #24
0
        private async void Btn_savePrintHeader_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                //  SectionData.validateEmptyComboBox(cb_serverStatus, p_errorServerStatus, tt_errorServerStatus, "trEmptyServerStatus");
                if (!cb_printHeader.Text.Equals(""))
                {
                    int res = 0;
                    show_header_row.value = cb_printHeader.SelectedValue.ToString();
                    res = await setvalueModel.Save(show_header_row);

                    //   int res = await progDetailsModel.updateIsonline(isOnline);


                    if (res > 0)
                    {
                        Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopSave"), animation: ToasterAnimation.FadeIn);
                    }
                    else
                    {
                        Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn);
                    }
                    await FillprintList();

                    fillPrintHeader();
                    await MainWindow.Getprintparameter();
                }

                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #25
0
 private void validateEmpty(string name, object sender)
 {
     try
     {
         if (name == "TextBox")
         {
             if ((sender as TextBox).Name == "tb_name")
             {
                 SectionData.validateEmptyTextBox((TextBox)sender, p_errorName, tt_errorName, "trEmptyNameToolTip");
             }
             else if ((sender as TextBox).Name == "tb_email")
             {
                 SectionData.validateEmptyTextBox((TextBox)sender, p_errorEmail, tt_errorEmail, "ssssssssssssssssssssss");
             }
             else if ((sender as TextBox).Name == "tb_port")
             {
                 SectionData.validateEmptyTextBox((TextBox)sender, p_errorPort, tt_errorPort, "sssssssssssssssssssssssssssss");
             }
             else if ((sender as TextBox).Name == "tb_smtpClient")
             {
                 SectionData.validateEmptyTextBox((TextBox)sender, p_errorSmtpClient, tt_errorSmtpClient, "sssssssssssssssssssssssssssss");
             }
         }
         else if (name == "ComboBox")
         {
             if ((sender as ComboBox).Name == "cb_side")
             {
                 SectionData.validateEmptyComboBox((ComboBox)sender, p_errorSide, tt_errorSide, "sssssssssssssss");
             }
             else if ((sender as ComboBox).Name == "cb_branchId")
             {
                 SectionData.validateEmptyComboBox((ComboBox)sender, p_errorBranchId, tt_errorBranchId, "sssssssssssssss");
             }
         }
         else if (name == "PasswordBox")
         {
             if ((sender as PasswordBox).Name == "pb_password")
             {
                 SectionData.showPasswordValidate((PasswordBox)sender, p_errorPassword, tt_errorPassword, "ssssssssssssssssssssssss");
             }
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #26
0
 private void Tb_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         string name = sender.GetType().Name;
         validateEmpty(name, sender);
         var txb = sender as TextBox;
         if ((sender as TextBox).Name == "tb_cashPointsRequired")
         {
             SectionData.InputJustNumber(ref txb);
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #27
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                MainWindow.mainWindow.initializationMainTrack(this.Tag.ToString(), 1);

                #region translate
                if (MainWindow.lang.Equals("en"))
                {
                    MainWindow.resourcemanager = new ResourceManager("POS.en_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.LeftToRight;
                }
                else
                {
                    MainWindow.resourcemanager = new ResourceManager("POS.ar_file", Assembly.GetExecutingAssembly());
                    grid_main.FlowDirection    = FlowDirection.RightToLeft;
                }
                translate();
                #endregion

                await refreshDestroyDetails();
                await fillItemCombo();
                await fillUsers();

                branchModel = await branchModel.getBranchById(MainWindow.branchID.Value);

                Tb_search_TextChanged(null, null);
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #28
0
        public void Btn_receiptInvoice_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                refreashBachgroundClick(btn_reciptInvoice);
                grid_main.Children.Clear();
                grid_main.Children.Add(uc_receiptInvoice.Instance);

                Button button = sender as Button;
                MainWindow.mainWindow.initializationMainTrack(button.Tag.ToString(), 1);
                //MainWindow.mainWindow.initializationMainTrack(btn_reciptInvoice.Tag.ToString(), 1);
            }
            catch (Exception ex)
            {
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #29
0
 private void SetParticipantNextSectionRight(Section vorigeSection, SectionData sectionData)
 {
     if (GetSectionData(vorigeSection).Right == null)
     {
         GetSectionData(vorigeSection).Right         = sectionData.Right;
         GetSectionData(vorigeSection).DistanceRight = 0;
         sectionData.Right         = null;
         sectionData.DistanceRight = 0;
     }
     else if (GetSectionData(vorigeSection).Left == null)
     {
         GetSectionData(vorigeSection).Left         = sectionData.Right;
         GetSectionData(vorigeSection).DistanceLeft = sectionData.DistanceRight - 100;
         sectionData.Right         = null;
         sectionData.DistanceRight = 0;
     }
 }
 private void validateEmpty(string name, object sender)
 {
     try
     {
         if (name == "PasswordBox")
         {
             if ((sender as PasswordBox).Name == "pb_oldPassword")
             {
                 if (((PasswordBox)sender).Password.Equals(""))
                 {
                     SectionData.showPasswordValidate((PasswordBox)sender, p_errorOldPassword, tt_errorOldPassword, "trEmptyPasswordToolTip");
                 }
                 else
                 {
                     SectionData.clearPasswordValidate((PasswordBox)sender, p_errorOldPassword);
                 }
             }
             else if ((sender as PasswordBox).Name == "pb_newPassword")
             {
                 if (((PasswordBox)sender).Password.Equals(""))
                 {
                     SectionData.showPasswordValidate((PasswordBox)sender, p_errorNewPassword, tt_errorNewPassword, "trEmptyPasswordToolTip");
                 }
                 else
                 {
                     SectionData.clearPasswordValidate((PasswordBox)sender, p_errorNewPassword);
                 }
             }
             else if ((sender as PasswordBox).Name == "pb_confirmPassword")
             {
                 if (((PasswordBox)sender).Password.Equals(""))
                 {
                     SectionData.showPasswordValidate((PasswordBox)sender, p_errorConfirmPassword, tt_errorConfirmPassword, "trEmptyPasswordToolTip");
                 }
                 else
                 {
                     SectionData.clearPasswordValidate((PasswordBox)sender, p_errorConfirmPassword);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #31
0
 private void validateEmpty(string name, object sender)
 {
     try
     {
         if (name == "TextBox")
         {
             if ((sender as TextBox).Name == "tb_name")
             {
                 SectionData.validateEmptyTextBox((TextBox)sender, p_errorName, tt_errorName, "trEmptyNameToolTip");
             }
         }
     }
     catch (Exception ex)
     {
         SectionData.ExceptionMessage(ex, this);
     }
 }
Пример #32
0
        private async void Btn_Inventory_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                if (_InventoryType.Equals("d") && invItemsLocations.Count > 0)
                {
                    await addInventory("d"); // d:draft
                }
                inventory = await inventory.getByBranch("n", MainWindow.branchID.Value);

                if (inventory.inventoryId == 0)
                {
                    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trNoInventory"), animation: ToasterAnimation.FadeIn);
                }
                else
                {
                    if (_InventoryType == "n" && invItemsLocations.Count > 0)
                    {
                    }
                    else
                    {
                        txt_titleDataGrid.Text = MainWindow.resourcemanager.GetString("trStocktaking");
                        _InventoryType         = "n";
                        await refreshDocCount(inventory.inventoryId);
                        await fillInventoryDetails();
                    }
                }
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
        private void Btn_preview_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (sender != null)
                {
                    SectionData.StartAwait(grid_main);
                }

                //if (MainWindow.groupObject.HasPermissionAction(basicsPermission, MainWindow.groupObjects, "report") || SectionData.isAdminPermision())
                //{
                #region
                Window.GetWindow(this).Opacity = 0.2;
                /////////////////////
                string pdfpath = "";
                pdfpath = @"\Thumb\report\temp.pdf";
                pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath);
                BuildReport();
                LocalReportExtensions.ExportToPDF(rep, pdfpath);
                ///////////////////
                wd_previewPdf w = new wd_previewPdf();
                w.pdfPath = pdfpath;
                if (!string.IsNullOrEmpty(w.pdfPath))
                {
                    w.ShowDialog();
                    w.wb_pdfWebViewer.Dispose();
                }
                Window.GetWindow(this).Opacity = 1;
                #endregion
                //}
                //else
                //    Toaster.ShowInfo(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trdontHavePermission"), animation: ToasterAnimation.FadeIn);
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
            }
            catch (Exception ex)
            {
                if (sender != null)
                {
                    SectionData.EndAwait(grid_main);
                }
                SectionData.ExceptionMessage(ex, this);
            }
        }
Пример #34
0
    private static void LoadSections()
    {
        #if UNITY_EDITOR
        Scene scene = SceneManager.GetActiveScene();
        activeSceneName = scene.name;
        AssetPath       = "Assets/Data/" + activeSceneName + "_Sections.asset";

        sectionData = AssetDatabase.LoadAssetAtPath <SectionData>(AssetPath);

        if (!sectionData)
        {
            sectionData = CreateInstance <SectionData>();
            Directory.CreateDirectory(Path.GetDirectoryName(AssetPath));
            AssetDatabase.CreateAsset(sectionData, AssetPath);
        }
        #endif
    }
Пример #35
0
        /*
        public IniWriter(IniData data)
        {

            if (data == null)
            {
                this.data = new IniData();
            }
            else
            {
                this.data = data;
            }

            parser = new FileIniDataParser();

        }*/

        /// <summary>
        ///     EN: Add section if section not exist and select, otherwise only select.
        /// </summary>
        /// <param name="section">Section name</param>
        /// <example>Example: How to add and select section</example>
        /// <code>AddAndSelectSection("General")</code>
        public void addAndSelectSection(string section)
        {
            if (data != null)
            {
                if (data.Sections.GetSectionData(section) != null)
                {
                    // Get section from data
                    sectionData = data.Sections.GetSectionData(section);
                }
                else
                {
                    // Creating section
                    data.Sections.AddSection(section);
                    // Get section from data
                    sectionData = data.Sections.GetSectionData(section);
                }
            }
        }
Пример #36
0
    //Use this for when there is other data used for the section. -1 denotes not used
    public SectionData createSection(float min, float max, float range, float topLeft, float botLeft, float botRight) {
        SectionData data = new SectionData(dimensions);
        float avgStartHeight = 0;
        float totalNums = 0;
        if (topLeft != -1) {
            avgStartHeight += topLeft;
            totalNums += 1f;
        }
        if (botLeft != -1) {
            avgStartHeight += botLeft;
            totalNums += 1f;
        }
        if (botRight != -1) {
            avgStartHeight += botRight;
            totalNums += 1f;
        }
        avgStartHeight /= totalNums;

        Vector2 temp = getBounds(avgStartHeight, range, min, max);
        min = temp.x;
        max = temp.y;


        if (topLeft != -1)
            data.topLeft = topLeft;
        else
            data.topLeft = Random.Range(min, max);

        if (botLeft != -1)
            data.botLeft = botLeft;
        else
            data.botLeft = Random.Range(min, max);

        if (botRight != -1)
            data.botRight = botRight;
        else
            data.botRight = Random.Range(min, max);

        data.topRight = Random.Range(min, max);


        data.fillValues();
        return data;
    }
        public void resolve_case_insensitive_names()
        {

            var data = new IniDataCaseInsensitive();
            var section = new SectionData("TestSection");
            section.Keys.AddKey("keY1", "value1");
            section.Keys.AddKey("KEY2", "value2");
            section.Keys.AddKey("KeY2", "value3");

            data.Sections.Add(section);

            Assert.That(data.Sections.ContainsSection("testsection"));
            Assert.That(data.Sections.ContainsSection("TestSection"));
            Assert.That(data["TestSection"]["key1"], Is.EqualTo("value1"));
            Assert.That(data["TestSection"]["keY1"], Is.EqualTo("value1"));
            Assert.That(data["TestSection"]["KEY2"], Is.EqualTo("value3"));
            Assert.That(data["TestSection"]["KeY2"], Is.EqualTo("value3"));
            Assert.That(data["TestSection"]["key2"], Is.EqualTo("value3"));
        }
        private void WriteSection(SectionData section, StringBuilder sb)
        {
            // Write blank line before section, but not if it is the first line
            if (sb.Length > 0) sb.AppendLine();

            // Leading comments
            WriteComments(section.LeadingComments, sb);

            //Write section name
            sb.AppendLine(string.Format("{0}{1}{2}", Configuration.SectionStartChar, section.SectionName, Configuration.SectionEndChar));

			if (section.Keys.Any()) {
				var maxChars = section.Keys.Max( key => key.KeyName.Length );
				var frmtPrfx = "{0,-" + maxChars.ToString() + "}";

				WriteKeyValueData(section.Keys, sb, frmtPrfx);
			}

            // Trailing comments
            WriteComments(section.TrailingComments, sb);
        }
		private void CreateTable()
		{
			_sectionDataList = new List<SectionData>();

		    var section1 = new SectionData("IdentityProviderInformation")
		    {
		        Title =
		            "Below you should see the token from your Identity Provider. If not press Log In in the Navigation Bar to get a new token."
		    };

		    if (null != _data)
			{
				string[] fields = {"Created", "Expires", "Is Expired", "Token Type", "Token"};
				foreach (var field in fields)
				{
				    var section1Data = new Data
				    {
				        Accessory = UITableViewCellAccessory.None, 
                        Label = field
				    };
				    switch (field)
					{
						case "Created": section1Data.Subtitle = _data.created.ToString(CultureInfo.InvariantCulture); break;
						case "Expires": section1Data.Subtitle = _data.expires.ToString(CultureInfo.InvariantCulture); break;
						case "Is Expired": section1Data.Subtitle = _data.IsExpired.ToString(CultureInfo.InvariantCulture); break;
						case "Token Type": section1Data.Subtitle = _data.tokenType.ToString(CultureInfo.InvariantCulture); break;
						case "Token": section1Data.Subtitle = _data.securityToken; break;
					}

					section1Data.CellStyle = UITableViewCellStyle.Subtitle;
				
					section1.SData.Add(section1Data);
				}
			}
			_sectionDataList.Add(section1);
		}
        void RemoveSettings(SectionData srcSection, SectionData dstSection)
        {
            // Must have data
            if (srcSection == null || dstSection == null)
                return;

            // Gather all keys missing in source
            List<string> keysToRemove = new List<string>();
            foreach (var key in dstSection.Keys)
            {
                if (!srcSection.Keys.ContainsKey(key.KeyName))
                    keysToRemove.Add(key.KeyName);
            }

            // Remove keys
            foreach(var name in keysToRemove)
            {
                Debug.Log("SettingsManager: Removing setting " + name);
                dstSection.Keys.RemoveKey(name);
            }
        }
Пример #41
0
 internal TableOfContentsSection(LytroFile file, SectionData sectionData)
     : base(file, sectionData)
 {
     this.SectionType = SectionTypes.LFP_TEXT;
     this.Name = "table";
 }
Пример #42
0
        /// <summary>
        /// Processes all lines based on the control information and builds the cache data for later.
        /// </summary>
        /// <param name="lines"></param>
        private void BuildSections(string[] lines)
        {
            SectionData currentSection = null;
            for (int i = 0; i < lines.Length; i++)
            {
                try
                {
                    string line = lines[i];
                    if (line.Length == 0)
                    {
                        continue;
                    }

                    // Check if the line denotes a section start. In this case, skip this line but remember the section.
                    SectionDefinition newSection = null;
                    if (IsLineSectionMarker(line, out newSection))
                    {
                        // Only switch to new section if it is a different section!
                        if (currentSection == null || (newSection.SectionString.String != currentSection.Definition.SectionString.String))
                        {
                            // Create new section
                            SectionData sectionData = new SectionData(newSection);
                            _sections.Add(sectionData);

                            currentSection = sectionData;

                            continue;
                        }
                    }

                    // Check if we currently are in no section (this is the case when there is some jabber at the beginning we don't care about).
                    if (currentSection == null)
                    {
                        continue;
                    }

                    // Add to current section
                    currentSection.Lines.Add(line);
                }
                catch (Exception ex)
                {
                    Logger.Instance.LogFormat(LogType.Warning, this, "Error while parsing line '{0}'. The error message was: {1}", i, ex.Message);
                }
            }
        }
 private static SectionData getSectionData(MultiPartSection section)
 {
     string contentDisposition = section.Headers["Content-Disposition"];
     if (contentDisposition == null)
     {
         return null;
     }
     string[] parts = contentDisposition.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
         .Select(p => p.Trim())
         .ToArray();
     var lookup = parts
         .Select(p => p.Split(new char[] { '=' }, 2))
         .Where(p => p.Length == 2)
         .ToLookup(p => p[0], p => p[1].Trim(' ', '"'), StringComparer.CurrentCultureIgnoreCase);
     SectionData data = new SectionData();
     data.Name = getName(lookup["name"].FirstOrDefault());
     data.FileName = getName(lookup["filename"].FirstOrDefault());
     data.ContentType = section.Headers["Content-Type"];
     data.Contents = copyData(section.Content);
     return data;
 }
            public TableViewDataSource()
            {
                _data = new List<SectionData>();

                SectionData section1 = new SectionData("section1");
                section1.Data.Add("item 1");
                section1.Data.Add("item 2");
                section1.Data.Add("item 3");
                section1.Title = "Basic";
                _data.Add(section1);

                SectionData section2 = new SectionData("section2");
                section2.Data.Add("option a");
                section2.Data.Add("option b");
                section2.Title = "Advanced";
                _data.Add(section2);
            }
        void AddSettings(SectionData srcSection, SectionData dstSection)
        {
            // Must have data
            if (srcSection == null || dstSection == null)
                return;

            // Add source keys missing in destination
            foreach (var key in srcSection.Keys)
            {
                if (!dstSection.Keys.ContainsKey(key.KeyName))
                {
                    Debug.Log("SettingsManager: Adding setting " + key.KeyName);
                    dstSection.Keys.AddKey(key);
                }
            }
        }
Пример #46
0
 internal RawImageSection(LytroFile file, SectionData sectionData)
     : base(file, sectionData)
 {
     this.SectionType = SectionTypes.LFP_RAW_IMAGE;
     this.Name = "raw";
 }
Пример #47
0
 internal LookUpTableSection(LytroFile file, SectionData sectionData)
     : base(file, sectionData)
 {
     this.SectionType = SectionTypes.LFP_DEPTH_LUT;
     this.Name = "depth";
 }
Пример #48
0
 public IndexBuilder(int APIversion, EventHandler handler, SectionData basis)
     : base(APIversion, handler, basis)
 {
 }
Пример #49
0
        /// <summary>
        ///     EN: Add section if section not exist and select, otherwise only select.
        ///     Add comment to section if comment not exist, otherwise delete old comment and add new.
        /// </summary>
        /// <param name="section">Section name to add</param>
        /// <param name="comment">Section comment</param>
        /// <example>Example: How to add section with comment and select this section</example>
        /// <code>AddAndSelectSection("General", "This is a general section")</code>
        public void addAndSelectSection(string section, string comment)
        {
            if (data != null)
            {
                if (data.Sections.GetSectionData(section) != null)
                {
                    // Get section from data
                    sectionData = data.Sections.GetSectionData(section);
                }
                else
                {
                    // Creating section
                    data.Sections.AddSection(section);
                    // Get section from data
                    sectionData = data.Sections.GetSectionData(section);
                }

                if (comment != null && !comment.Equals(""))
                {
                    if (sectionData.Comments.Count > 0)
                    {
                        sectionData.Comments.Clear();
                    }

                    sectionData.Comments.Add(comment);
                }
            }
        }
		private void ReadSection (XmlTextReader reader, string sectionName)
		{
			string attName;
			string nameValue = null;
			string typeValue = null;
			string allowLoc = null, allowDef = null;
			bool allowLocation = true;
			AllowDefinition allowDefinition = AllowDefinition.Everywhere;

			while (reader.MoveToNextAttribute ()) {
				attName = reader.Name;
				if (attName == null)
					continue;

				if (attName == "allowLocation") {
					if (allowLoc != null)
						ThrowException ("Duplicated allowLocation attribute.", reader);

					allowLoc = reader.Value;
					allowLocation = (allowLoc == "true");
					if (!allowLocation && allowLoc != "false")
						ThrowException ("Invalid attribute value", reader);

					continue;
				}

				if (attName == "allowDefinition") {
					if (allowDef != null)
						ThrowException ("Duplicated allowDefinition attribute.", reader);

					allowDef = reader.Value;
					try {
						allowDefinition = (AllowDefinition) Enum.Parse (
								   typeof (AllowDefinition), allowDef);
					} catch {
						ThrowException ("Invalid attribute value", reader);
					}

					continue;
				}

				if (attName == "type")  {
					if (typeValue != null)
						ThrowException ("Duplicated type attribute.", reader);
					typeValue = reader.Value;
					continue;
				}
				
				if (attName == "name")  {
					if (nameValue != null)
						ThrowException ("Duplicated name attribute.", reader);

					nameValue = reader.Value;
					if (nameValue == "location")
						ThrowException ("location is a reserved section name", reader);
					continue;
				}

				ThrowException ("Unrecognized attribute.", reader);
			}

			if (nameValue == null || typeValue == null)
				ThrowException ("Required attribute missing", reader);

			if (sectionName != null)
				nameValue = sectionName + '/' + nameValue;

			reader.MoveToElement();
			object o = LookForFactory (nameValue);
			if (o != null && o != removedMark)
				ThrowException ("Already have a factory for " + nameValue, reader);

			SectionData section = new SectionData (nameValue, typeValue, allowLocation, allowDefinition);
			section.FileName = fileName;
			factories [nameValue] = section;
			MoveToNextElement (reader);
		}
Пример #51
0
 public TextSection(LytroFile file, SectionData sectionData)
     : base(file, sectionData)
 {
     this.SectionType = SectionTypes.LFP_TEXT;
 }
Пример #52
0
 internal JpegSection(LytroFile file, SectionData sectionData)
     : base(file, sectionData)
 {
     this.SectionType = SectionTypes.LFP_JPEG;
     this.Name = "image";
 }
		private void CreateTableData()
		{
			_sectionDataList = new List<SectionData>();

		    var section1 = new SectionData("IdentityProviderInformation")
		    {
		        Footer = "Log in the application with your account of choice."
		    };

		    if (null != _providerInformation)
			{
				foreach (var provider in _providerInformation)
				{
				    var section1Data = new Data
				    {
				        Accessory = UITableViewCellAccessory.DisclosureIndicator,
				        Label = provider.Name,
				        CellStyle = UITableViewCellStyle.Default
				    };
				    if (provider.ImageUrl != null || provider.ImageUrl != "")
						provider.LoadImageFromImageUrl();
					section1Data.Image = provider.Image;
					
					section1.SData.Add(section1Data);
				}
			}
			
			_sectionDataList.Add(section1);
		}
		object CreateNewHandler (string sectionName, SectionData section)
		{
			Type t = Type.GetType (section.TypeName);
			if (t == null)
				throw new ConfigurationException ("Cannot get Type for " + section.TypeName);

			Type iconfig = typeof (IConfigurationSectionHandler);
			if (!iconfig.IsAssignableFrom (t))
				throw new ConfigurationException (sectionName + " does not implement " + iconfig);
			
			object o = Activator.CreateInstance (t, true);
			if (o == null)
				throw new ConfigurationException ("Cannot get instance for " + t);

			return o;
		}