Inheritance: MonoBehaviour
        public ActionResult GenerateText(InputText inputTextType, string userInputText = "", int numberOfSentences = -1)
        {
            if (numberOfSentences == -1)
            {
                numberOfSentences = random.Next(1, 11);
            }

            Dictionary<string, List<string>> dict = null;
            switch (inputTextType)
            {
                case InputText.InDesertAndWilderness:
                    dict = PredefinedDictionaries.InDesertAndWilderness;
                    break;

                case InputText.LordOfTheRings:
                    dict = PredefinedDictionaries.Lotr;
                    break;

                case InputText.Other:
                    var dictGenerator = new DictionaryGenerator();
                    var d = dictGenerator.GenerateFrequencyTable(userInputText);
                    var g = new MarkovChainTextGenerator(d);
                    //return g.GetRandomChain(numberOfSentences);
                    return PartialView(new Chain(inputTextType, g.GetRandomChain(numberOfSentences)));
            }

            var generator = new MarkovChainTextGenerator(dict);

            //return generator.GetRandomChain(numberOfSentences);
            return PartialView(new Chain(inputTextType, generator.GetRandomChain(numberOfSentences)));
        }
        public Chain(InputText inputTextType, string text)
        {
            InputTextType = inputTextType;
            Text = text;

            Sentences = new List<string>();
            string[] separators = { "." };
            string[] split = text.Split(separators, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < split.Length; i++)
            {
                split[i] += ".";
                Sentences.Add(split[i]);
            }
        }
Ejemplo n.º 3
0
        private async Task Rescan(bool initial = false)
        {
            if (!initial)
            {
                SaveLaunchedCounts(entries);
            }

            LoadingIndicator.IsActive = true;
            InputText.IsEnabled       = false;

            entries.Clear();
            entries.AddRange(await StoreApp.FindAllStoreApps());
            entries.AddRange(DesktopApp.FindAllDesktopApps());
            entries.AddRange(UriLauncher.FindAllUriLaunchers());
            entries.AddRange(LoadAliases(entries));
            entries.Sort((x, y) => x.Name.CompareTo(y.Name));

            LoadLaunchedCounts(entries);

            LoadingIndicator.IsActive = false;
            InputText.IsEnabled       = true;
            InputText.Focus();
        }
Ejemplo n.º 4
0
        protected override void Execute(CodeActivityContext context)
        {
            this.ImgReview        = InputImage.Get(context);
            this.StrText          = InputText.Get(context);
            this.ListStrCandidate = CandidateStringList.Get(context);

            this.IntFrameWidth           = FrameWidth.Get(context);
            this.IntImageFrameHeight     = ImageFrameHeight.Get(context);
            this.IntTextFrameHeight      = TextFrameHeight.Get(context);
            this.IntFontSize             = FontSize.Get(context);
            this.IsDisableEnterKeySubmit = DisableEnterKeySubmit.Get(context);

            this.IsUnRead = false;
            this.IsModify = false;

            FormMain fm = new FormMain(this);

            fm.ShowDialog();

            IsModified.Set(context, this.IsModify);
            IsUnreadable.Set(context, this.IsUnRead);
            ReviewedText.Set(context, this.StrText);
        }
Ejemplo n.º 5
0
        private void RegisterComponents()
        {
            var required = ValidatorProvider.Global.GetCollection <string>(StringValidators.REQUIRED);

            var name = InputText.Create("Profile name:", "", required);

            ComponentsProvider.Global.Register(nameof(ProfileName), name);

            // var pass = InputText.Create("Profile password [Empty to ignore]:", "");
            // ComponentsProvider.Global.Register(nameof(ProfilePassword), pass);

            var user = InputText.Create("Jira username/email:", "", required);

            ComponentsProvider.Global.Register(nameof(User), user);

            var token = InputText.Create("Jira token:", "", required);

            ComponentsProvider.Global.Register(nameof(Pass), token);

            var url = InputText.Create <Uri?>("Jira server url", null);

            ComponentsProvider.Global.Register(nameof(ServerUrl), url);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Tokenise the input.
        /// </summary>
        /// <returns></returns>
        public List <List <string> > Tokenise()
        {
            if (string.IsNullOrEmpty(InputText))
            {
                return(new List <List <string> >());
            }
            List <char> split = new List <char>(Environment.NewLine.ToCharArray());

            split.Add('.');
            string[] lines = InputText.Split(split.ToArray());
            List <List <string> > sentences = new List <List <string> >();

            foreach (var line in lines)
            {
                string[] tokens = WordTokeniser.defaultSplitter(line);
                for (int i = 0; i < tokens.Length; i++)
                {
                    tokens[i] = WordTokeniser.emptyFilter(tokens[i]);
                }
                sentences.Add(new List <string>(tokens));
            }
            return(sentences);
        }
Ejemplo n.º 7
0
        public override void Execute()
        {
            if (InputBin?.Length > 0)
            {
                OutputText = new System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary(InputBin).ToString();
            }
            else
            {
                OutputText = string.Empty;
            }

            if (!string.IsNullOrEmpty(InputText))
            {
                OutputBin = Enumerable.Range(0, InputText.Length)
                            .Where(x => x % 2 == 0)
                            .Select(x => Convert.ToByte(InputText.Substring(x, 2), 16))
                            .ToArray();
            }
            else
            {
                OutputBin = new byte[] { }
            };
        }
    }
Ejemplo n.º 8
0
        private void DealWithSearchField()
        {
            InputText = this._inputBox.Text;

            if (SearchField.IsNotEmpty())
            {
                if (InputText.IsNotEmpty())
                {
                    ReplaceWhereItem(SearchField, InputText, SearchFieldTemplate, true);
                }
                else
                {
                    WhereSqlClauses.RemoveAll(item =>
                    {
                        var curItem = (WhereSqlClauseBuilder)item;
                        if (curItem.Count > 0 && ((SqlClauseBuilderItemIUW)curItem[0]).DataField == SearchField)
                        {
                            return(true);
                        }
                        return(false);
                    });
                }
            }
        }
Ejemplo n.º 9
0
        public void CloseWindow(string window)
        {
            switch (window)
            {
            case "Editor":
                _editor?.Close();
                _editor = null;
                break;

            case "Library":
                _library?.Hide();
                break;

            case "Reader":
                _reader?.Close();
                _reader = null;
                break;

            case "InputText":
                _inputText?.Close();
                _inputText = null;
                break;
            }
        }
Ejemplo n.º 10
0
        void POS_SO_P001_KeyEvent(WSWD.WmallPos.FX.Shared.OPOSKeyEventArgs e)
        {
            if (!e.IsControlKey)
            {
                m_isError = false;
            }

            if (e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_CLEAR)
            {
                if (txtPassword.Text.Length == 0 && txtCasNo.Text.Length == 0 && txtCasNo.IsFocused)
                {
                    e.IsHandled = true;
                    btnClose_Click(btnClose, EventArgs.Empty);
                }
                else
                {
                    if (this.FocusedControl != null)
                    {
                        InputText it = (InputText)this.FocusedControl;
                        if (it.Text.Length > 0)
                        {
                            it.SetFocus();
                            m_casDataRow = null;
                            return;
                        }
                    }

                    e.IsHandled = true;
                    this.PreviousControl();
                }
            }
            else if (e.Key.OPOSKey == OPOSMapKeys.KEY_ENTER)
            {
                ValidateOnEnter();
            }
        }
Ejemplo n.º 11
0
 private void ModernDialog_Loaded(object sender, RoutedEventArgs e)
 {
     InputText.Focus();
 }
Ejemplo n.º 12
0
        private void Button_Send_Power_Click(object sender, EventArgs e)
        {
            /* Obtain the string from the data entry box */
            string data = InputText.Text;

            /* Reset the data in the box to blank */
            InputText.ResetText();

            if (Pullup_Indicator.Visible && data != "")
            {
                OutputText.AppendText("Turn the Strong Pull-Up off to send data\r\n");
                OutputText.AppendText("------------------------------------------------------------------------------------------\r\n");
                return;
            }

            if (data == "" && Pullup_Selection != 0)
            {
                OutputText.AppendText("Please Enter Data to Send\r\n");
                OutputText.AppendText("------------------------------------------------------------------------------------------\r\n");
                return;
            }

            /* If the user only wants to send data and did not change the pullup option */
            if (Prev_Pullup_Selection == Pullup_Selection)
            {
                OutputString = "WWY" + data;
            }

            else
            {
                switch (Pullup_Selection)
                {
                case 0:
                    OutputString = "PNO";
                    break;

                case 1:
                    OutputString = "PWI" + data;
                    break;

                case 2:
                    OutputString = "PWY" + data;
                    break;

                default:
                    OutputText.AppendText("Please Select a power mode\r\n");
                    OutputText.AppendText("------------------------------------------------------------------------------------------\r\n");
                    break;
                }
            }

            Prev_Pullup_Selection = Pullup_Selection;

            try
            {
                serialPort1.WriteLine(OutputString);
            }
            catch (System.InvalidOperationException)
            {
                MessageBox.Show("You are not connected to a Serial Port!", "Serial Error");
                return;
            }
        }
Ejemplo n.º 13
0
 public void Destroy()
 {
     InputText.Dispose();
 }
        public void InputTextTestNoCalculate()
        {
            string inputText = "az11w6ab";

            Assert.Equal(0, InputText.TextCalculator(inputText, false, false));
        }
        public void InputTextTestCalculateText()
        {
            string inputText = "az11w6ab";

            Assert.Equal(53, InputText.TextCalculator(inputText, true, false));
        }
Ejemplo n.º 16
0
		void Paint(Element parent)
		{	
			new Div(parent, div=>{
				div.ClassName="span6 offset3 well";
				div.Hide();
			}) ;
			
			SearchDiv= new Div(default(Element), searchdiv=>{
				searchdiv.ClassName= "span6 offset3 nav";

				var inputFecha=new InputText(searchdiv, ip=>{
					ip.ClassName="input-medium search-query";
					ip.SetAttribute("data-mask","99.99.9999");
					ip.SetPlaceHolder("dd.mm.aaaa");
				}).Element(); 
				
				new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-search icon-large";
					abn.JSelect().Click(evt=>{
						if( ! inputFecha.Value.IsDateFormatted()){
							Div.CreateAlertErrorAfter(SearchDiv.Element(),"Digite una fecha valida");
							return;
						}
						LoadGastos( inputFecha.Value.ToServerDate() );

					});
				});

				BNew= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-plus-sign icon-large";
					abn.JSelect().Click(evt=>{
						FormDiv.FadeIn();
						GridDiv.FadeOut();
						Form.Element().Reset();
						BDelete.Element().Disabled=true;
					});
				});

				BDelete=new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-remove-sign icon-large";
					abn.Disabled=true;
					abn.JSelect().Click(evt=>{
						RemoveRow();
					});
				});

				BList= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-reorder icon-large";
					abn.Disabled=true;
					abn.JSelect().Click(evt=>{
						FormDiv.FadeOut();
						GridDiv.FadeIn();
						abn.Disabled=true;
					});
				});
				
			});
			SearchDiv.AppendTo(parent);
			
			
			FormDiv= new Div(default(Element), formdiv=>{
				formdiv.ClassName="span6 offset3 well";
				Form = new Form(formdiv, f=>{
					f.ClassName="form-horizontal";
					f.Action="api/Gasto/";
					f.Method="post";

					var inputId= new InputText(f, e=>{
						e.Name="Id";
						e.Hide();
					}); 

					var cbConcepto=new SelectField(f, (e)=>{
						e.Name="IdConcepto";
						e.ClassName="span12";
						new HtmlOption(e, o=>{
							o.Value="";
							o.Selected=true;
							o.Text="Seleccione el concepto ...";
						});											
						LoadConceptos(e);
					});
					
					var cbFuente= new SelectField(f, (e)=>{
						e.Name="IdFuente";
						e.ClassName="span12";
						new HtmlOption(e, o=>{
							o.Value="";
							o.Selected=true;
							o.Text="Seleccione la fuente de pago ...";
						});											
						LoadFuentes(e);
					});
					
					var fieldValor= new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Valor";
						field.SetPlaceHolder("$$$$$$$$$$");
						field.AutoNumericInit();
						field.Style.TextAlign="right";
					});
					
					new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Beneficiario";
						field.SetPlaceHolder("Pagado a ....");
					});
					
					new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Descripcion";
						field.SetPlaceHolder("Descripcion");
					});
										
					var bt = new SubmitButton(f, b=>{
						b.JSelect().Text("Guardar");
						b.LoadingText(" Guardando ...");
						b.ClassName="btn btn-info btn-block" ;
					});
					
					var vo = new ValidateOptions()
						.SetSubmitHandler( form=>{
							
							bt.ShowLoadingText();

							var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update");
							jQuery.PostRequest<BLResponse<Gasto>>(action, form.AutoNumericGetString(), cb=>{},"json")
								.Success(d=>{
									Cayita.Javascript.Firebug.Console.Log("Success guardar gasto",d);
									if(string.IsNullOrEmpty(inputId.Value()) )
										AppendRow(d.Result[0]);
									else
										UpdateRow(d.Result[0]);

									form.Reset();
								})
									.Error((request,  textStatus,  error)=>{
										Cayita.Javascript.Firebug.Console.Log("request", request );
										Cayita.Javascript.Firebug.Console.Log("error", error );
										Div.CreateAlertErrorBefore(form.Elements[0],
										                           textStatus+": "+ request.StatusText);
									})
									.Always(a=>{
										bt.ResetLoadingText();
									});
							
						})
							.AddRule((rule, msg)=>{
								rule.Element=fieldValor.Element();
								rule.Rule.Required();
								msg.Required("Digite el valor del gasto");
							})

							.AddRule((rule, msg)=>{
								rule.Element=cbConcepto.Element();
								rule.Rule.Required();
								msg.Required("Seleccione el concepto");
							})
							
							.AddRule((rule, msg)=>{
								rule.Element=cbFuente.Element();
								rule.Rule.Required();
								msg.Required("Seleccione al fuente del pago");
							});
					
					f.Validate(vo);				
				});
			});

			FormDiv.AppendTo(parent);
						
			GridDiv= new  Div(default(Element), gdiv=>{
				gdiv.ClassName="span10 offset1";

				TableGastos= new HtmlTable(gdiv, table=>{
					InitTable (table);
				});	
				gdiv.Hide();
			});

			GridDiv.AppendTo(parent);	
		}
Ejemplo n.º 17
0
        /// <summary>
        /// Process ENTER, CLEAR: next previous (clear)
        /// ENTER KEy for GiftNo; process PG01
        /// ENTER key for Amt: proces Korean won amount
        /// CLEAR key for GiftNo: Reset input current row
        ///
        /// </summary>
        /// <param name="e"></param>
        void POS_SL_P007_KeyEvent(WSWD.WmallPos.FX.Shared.OPOSKeyEventArgs e)
        {
            if (this.FocusedControl != null)
            {
                InputText    it   = (InputText)this.FocusedControl;
                SaleGridCell cell = (SaleGridCell)it.Parent;

                // 교환권번호컬럼
                if (cell.ColumnIndex == 1)
                {
                    // GiftNo, clear, reset input, invalid
                    if (it.Text.Length > 0 && e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_BKS)
                    {
                        //2015.08.26 정광호 수정
                        ResetInputs(true);
                        //ResetInputs();
                        return;
                    }

                    if (it.Text.Length > 0 && e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_CLEAR)
                    {
                        it.Text     = string.Empty;
                        e.IsHandled = true;
                        //2015.08.26 정광호 수정
                        ResetInputs(true);
                        //ResetInputs();
                        return;
                    }

                    if (it.Text.Length > 0 && e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_ENTER)
                    {
                        ValidateGiftNo(false, it.Text);
                        e.IsHandled = true;
                        return;
                    }

                    if (!e.IsControlKey)
                    {
                        StatusMessage = MSG_INPUT;
                    }
                }

                if (e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_CLEAR)
                {
                    SaleGridRow row  = (SaleGridRow)cell.Parent;
                    var         itNo = (InputText)row.Cells[1].Controls[0];

                    if (it.Text.Length > 0 && !it.ReadOnly && itNo.Text.Length == 0)
                    {
                        e.IsHandled = true;
                        it.Text     = string.Empty;
                        UpdateTotalGiftAmt();
                        return;
                    }

                    e.IsHandled = true;
                    this.PreviousControl();
                }
                else if (e.Key.OPOSKey == WSWD.WmallPos.FX.Shared.OPOSMapKeys.KEY_ENTER)
                {
                    // validate number enterred
                    if (cell.ColumnIndex == 3 && !it.ReadOnly)
                    {
                        var val = TypeHelper.ToInt64(it.Text.Replace(",", ""));
                        val     = ValidateMoney(val);
                        it.Text = val.ToString();
                    }

                    // update total git amount
                    UpdateTotalGiftAmt();
                    e.IsHandled = true;
                    this.NextControl();
                }
            }
        }
 /// <summary>
 /// Show message, request for input and use the default validator store to validate result
 /// </summary>
 /// <param name="message"></param>
 /// <param name="defaultValue"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 public static Task <T> Ask <T>(string message, T defaultValue = default, IValidatorCollection <T>?validators = null, StringConverterProvider?provider = null)
 {
     return(InputText.Create <T>(
                message, defaultValue, validators, provider)
            .RequestInput());
 }
Ejemplo n.º 19
0
        public void InsertTextAtCursorPos(string insertedText)
        {
            Contracts.AssertValue(insertedText);

            InputText       = InputText.Substring(0, CursorPosition) + insertedText + InputText.Substring(CursorPosition);
            CursorPosition += insertedText.Length;
        }
        protected override void Execute(CodeActivityContext context)
        {
            ActivityCompleted.Set(context, false);

            ActivityCanceled.Set(context, false);


            if (UserInteractionResponse.Get(context).UserInteractionType == UserInteractions.Enumerations.UserInteractionType.Prompt)
            {
                Workflows.UserInteractions.Response.PromptUserResponse response = (UserInteractions.Response.PromptUserResponse)UserInteractionResponse.Get(context);


                if (response.ButtonClicked != UserInteractions.Enumerations.UserPromptButtonClicked.None)
                {
                    ButtonClicked.Set(context, response.ButtonClicked);



                    if (response.InputText == null)
                    {
                        response.InputText = String.Empty;
                    }

                    InputText.Set(context, response.InputText);


                    if (response.SelectedValue == null)
                    {
                        response.SelectedValue = String.Empty;
                    }

                    SelectedValue.Set(context, response.SelectedValue);


                    if (response.SelectedText == null)
                    {
                        response.SelectedText = String.Empty;
                    }

                    SelectedText.Set(context, response.SelectedText);


                    Activities.CommonFunctions.WorkflowStepsAdd(

                        WorkflowManager.Get(context).Application,

                        1,

                        WorkQueueItemId.Get(context),

                        WorkflowSteps.Get(context),

                        "Button Clicked: " + ButtonClicked.Get(context).ToString() + "  |  Selected Text = " + SelectedText.Get(context).ToString()

                        );


                    // IF USER DID NOT CANCEL, OR THEY DID CANCEL AND CANCEL ALLOWED, MARK COMPLETED

                    if ((response.ButtonClicked != UserInteractions.Enumerations.UserPromptButtonClicked.Cancel)

                        || ((response.ButtonClicked == UserInteractions.Enumerations.UserPromptButtonClicked.Cancel) && (AllowCancel.Get(context))))
                    {
                        ActivityCompleted.Set(context, true);
                    }
                }
            }
        }
Ejemplo n.º 21
0
 public void Post([FromUri] string displayId, [FromBody] InputText input)
 {
     DisplayHandler.RenderText(displayId, input.Text);
 }
Ejemplo n.º 22
0
		void Paint(Element parent)
		{	
			new Div(parent, div=>{
				div.ClassName="span6 offset3 well";
				div.Hide();
			}) ;
			
			SearchDiv= new Div(default(Element), searchdiv=>{
				searchdiv.ClassName= "span6 offset3 nav";
				
				BNew = new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-plus-sign icon-large";
					abn.JSelect().Click(evt=>{
						GridDiv.Hide();
						FormDiv.FadeIn();
						Form.Element().Reset();
						BDelete.Element().Disabled=true;
						BList.Element().Disabled=false;
					});
				});
				
				BDelete= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-remove-sign icon-large";
					abn.Disabled=true;
					abn.JSelect().Click(evt=>{
						RemoveRow();
					});
				});
				
				BList= new IconButton(searchdiv, (abn, ibn)=>{
					ibn.ClassName="icon-reorder icon-large";
					abn.JSelect().Click(evt=>{
						FormDiv.Hide();
						GridDiv.FadeIn();
						BList.Element().Disabled=true;
					});
				});
				
			});
			SearchDiv.AppendTo(parent);
			
			GridDiv= new  Div(default(Element), gdiv=>{
				gdiv.ClassName="span6 offset3";
				TableFuentes= new HtmlTable(gdiv, table=>{
					InitTable(table);
					LoadFuentes(table);
				});
			});
			
			GridDiv.AppendTo(parent);
			
			
			FormDiv= new Div(default(Element), formdiv=>{
				formdiv.ClassName="span6 offset3 well";
				formdiv.Hide();
				Form = new Form(formdiv, f=>{
					f.ClassName="form-horizontal";
					f.Action="api/Fuente/";
					
					var inputId= new InputText(f, e=>{
						e.Name="Id";
						e.Hide();
					}); 
					
					var cbTipo= new SelectField(f, (e)=>{
						e.Name="Tipo";
						e.ClassName="span12";

						new HtmlOption(e, o=>{
							o.Value="";
							o.Selected=true;
							o.Text="Seleccione el tipo ";
						});

						new HtmlOption(e, o=>{
							o.Value="Credito";
							o.Text="Credito";
						});											
						new HtmlOption(e, o=>{
							o.Value="Debito";
							o.Text="Debito";
						});											
												
					});
					
					var fieldCodigo=new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Codigo";
						field.SetPlaceHolder("Codigo del Recurso ## Grupo ##.## Item");
					});
					
					var fieldNombre=new TextField(f,(field)=>{
						field.ClassName="span12";
						field.Name="Nombre";
						field.SetPlaceHolder("Nombre del Recurso");
					});
					
					
					var bt = new SubmitButton(f, b=>{
						b.JSelect().Text("Guardar");
						b.LoadingText(" Guardando ...");
						b.ClassName="btn btn-info btn-block" ;
					});
					
					var vo = new ValidateOptions()
						.SetSubmitHandler( form=>{
							
							bt.ShowLoadingText();
							var action= form.Action+(string.IsNullOrEmpty(inputId.Value())?"create":"update");
							jQuery.PostRequest<BLResponse<Fuente>>(action, form.Serialize(), cb=>{},"json")
								.Success(d=>{
									Cayita.Javascript.Firebug.Console.Log("Success guardar recurso",d);
									if(string.IsNullOrEmpty(inputId.Value()) )
										AppendRow(d.Result[0]);
									else
										UpdateRow(d.Result[0]);
									FormDiv.FadeOut();
									GridDiv.Show ();
									
								})
									.Error((request,  textStatus,  error)=>{
										Cayita.Javascript.Firebug.Console.Log("request", request );
										Div.CreateAlertErrorBefore(form.Elements[0],
										                           textStatus+": "+ request.StatusText);
									})
									.Always(a=>{
										bt.ResetLoadingText();
									});
							
						})	
							.AddRule((rule, msg)=>{
								rule.Element=cbTipo.Element();
								rule.Rule.Required();
								msg.Required("Seleccione tipo de Recurso");
							})
							.AddRule((rule,msg)=>{
								rule.Element=fieldNombre.Element();
								rule.Rule.Required().Maxlength(64);
								msg.Required("Indique el nombre del Recurso").Maxlength("Maximo 64 Caracteres");
							}).AddRule((rule,msg)=>{
								rule.Element=fieldCodigo.Element();
								rule.Rule.Required().Maxlength(5);
								msg.Required("Indique el codigo del Recurso").Maxlength("Maximo 5 caracteres");
							});
					
					f.Validate(vo);					
				});
			});

			FormDiv.AppendTo(parent);
		}
Ejemplo n.º 23
0
        /// <summary>
        /// 전문에서 확인성공
        /// </summary>
        /// <param name="giftAmt"></param>
        /// <param name="giftOtherData"></param>
        private void ConfirmNewGiftData(string giftAmt, string giftOtherData, string strGiftNo)
        {
            InputText   itNo   = null;
            InputText   itCnt  = null;
            InputText   itAmt  = null;
            Label       lblEtc = null;
            SaleGridRow curRow = null;

            if (m_scannedGiftNo)
            {
                //  get next empty
                foreach (SaleGridRow row in gpPQ11.Rows)
                {
                    //2015.08.27 정광호 수정---------------------------------------
                    //*************************************************************
                    //상품권번호없이 직접 입력한 row에 스캐닝 값이 들어가는것을 방지

                    //if (row.ItemData == null)
                    //{
                    //    itNo = (InputText)row.Cells[1].Controls[0];
                    //    itCnt = (InputText)row.Cells[2].Controls[0];
                    //    itAmt = (InputText)row.Cells[3].Controls[0];
                    //    lblEtc = (Label)row.Cells[4].Controls[0];

                    //    curRow = row;
                    //    break;
                    //}

                    if (row.Cells[2].Controls[0].Text.Length <= 0 && row.Cells[3].Controls[0].Text.Length <= 0)
                    {
                        itNo   = (InputText)row.Cells[1].Controls[0];
                        itCnt  = (InputText)row.Cells[2].Controls[0];
                        itAmt  = (InputText)row.Cells[3].Controls[0];
                        lblEtc = (Label)row.Cells[4].Controls[0];

                        curRow = row;
                        break;
                    }
                    //*************************************************************
                    //2015.08.27 정광호 수정---------------------------------------
                }
            }
            else
            {
                //2015.08.26 정광호 수정---------------------------------------
                //*************************************************************
                itNo   = (InputText)this.FocusedControl;
                curRow = (SaleGridRow)itNo.Parent.Parent;
                itCnt  = (InputText)curRow.Cells[2].Controls[0];
                itAmt  = (InputText)curRow.Cells[3].Controls[0];
                lblEtc = (Label)curRow.Cells[4].Controls[0];
            }

            if (itCnt != null)
            {
                //2015.08.26 정광호 수정---------------------------------------
                //*************************************************************
                itCnt.ReadOnly  = itAmt.ReadOnly = true;
                itNo.Text       = m_inputGiftNo;
                itCnt.Text      = "1";
                itAmt.Text      = giftAmt;
                lblEtc.Text     = giftOtherData;
                curRow.ItemData = new RtnPrsGiftData()
                {
                    GiftAmt   = TypeHelper.ToInt64(giftAmt),
                    GiftCount = 1,
                    GiftNo    = m_inputGiftNo,
                    GiftUsage = giftOtherData
                };

                // focus to next row
                if (curRow.RowIndex < gpPQ11.Rows.Length - 1)
                {
                    InputText it = (InputText)gpPQ11.Rows[curRow.RowIndex + 1].Cells[1].Controls[0];
                    it.SetFocus();
                }

                //*************************************************************
                //2015.08.26 정광호 수정---------------------------------------
            }

            // update total
            UpdateTotalGiftAmt();

            m_inputGiftNo   = string.Empty;
            m_scannedGiftNo = false;
        }
Ejemplo n.º 24
0
 public override int FirstStar() => InputText
 .Split("\n\n")
 .Sum(l => l
      .Replace("\n", "")
      .Distinct()
      .Count());
Ejemplo n.º 25
0
        private static IElement NewAction(XmlNode xmlNode, IElement parent = null)
        {
            IElement   element    = null;
            IElement   ne         = null; // child elements
            XmlElement importNode = (xmlNode as XmlElement);

            if (xmlNode.Name == "Action")
            {
                switch (importNode.GetAttribute("Type"))
                {
                case "AppTree":
                    AppTree appTree = new AppTree(Globals.EventAggregator)
                    {
                        ApplicationVariableBase = importNode.GetAttribute("ApplicationVariableBase"),
                        PackageVariableBase     = importNode.GetAttribute("PackageVariableBase"),
                        Title     = importNode.GetAttribute("Title"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("CenterTitle")))
                    {
                        appTree.CenterTitle = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("CenterTitle")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Size")))
                    {
                        appTree.Size = importNode.GetAttribute("Size");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Expanded")))
                    {
                        appTree.Expanded = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Expanded")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        appTree.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowCancel")))
                    {
                        appTree.ShowCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowCancel")));
                    }

                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, appTree);

                        /* This is handled by the only valid subelement in AppTree (SoftwareSets)
                         * if(ne is IChildElement)
                         * {
                         *  appTree.SubChildren.Add(ne as IChildElement);
                         * }
                         */
                    }
                    element = appTree;
                    break;

                case "DefaultValues":
                    DefaultValues defaultValues = new DefaultValues(Globals.EventAggregator)
                    {
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ValueTypes")))
                    {
                        string[] defaultValueTypes = importNode.GetAttribute("ValueTypes").Split(',');
                        defaultValues.ValueTypeList.Where(x => x.Name == "All").First().IsSelected = false;
                        foreach (string defaultValueType in defaultValueTypes)
                        {
                            if (defaultValues.ValueTypeList.Where(x => x.Name == defaultValueType).Count() > 0)
                            {
                                defaultValues.ValueTypeList.Where(x => x.Name == defaultValueType).First().IsSelected = true;
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowProgress")))
                    {
                        defaultValues.ShowProgress = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowProgress")));
                    }
                    element = defaultValues;
                    break;

                case "ErrorInfo":
                    ErrorInfo errorInfo = new ErrorInfo(Globals.EventAggregator)
                    {
                        Image     = importNode.GetAttribute("Image"),
                        InfoImage = importNode.GetAttribute("InfoImage"),
                        Name      = importNode.GetAttribute("Name"),
                        Title     = importNode.GetAttribute("Title"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("CenterTitle")))
                    {
                        errorInfo.CenterTitle = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("CenterTitle")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        errorInfo.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowCancel")))
                    {
                        errorInfo.ShowCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowCancel")));
                    }
                    element = errorInfo;
                    break;

                case "ExternalCall":
                    ExternalCall externalCall = new ExternalCall(Globals.EventAggregator)
                    {
                        ExitCodeVariable = importNode.GetAttribute("ExitCodeVariable"),
                        Title            = importNode.GetAttribute("Title"),
                        Condition        = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ExitCodeVariable")))
                    {
                        externalCall.ExitCodeVariable = importNode.GetAttribute("ExitCodeVariable");
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        externalCall.Content = CDATARemover(importNode.InnerXml);
                    }
                    element = externalCall;
                    break;

                case "FileRead":
                    FileRead fileRead = new FileRead(Globals.EventAggregator)
                    {
                        FileName  = importNode.GetAttribute("Filename"),
                        Variable  = importNode.GetAttribute("Variable"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DeleteLine")))
                    {
                        fileRead.DeleteLine = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DeleteLine")));
                    }
                    element = fileRead;
                    break;

                case "Info":
                    Info info = new Info(Globals.EventAggregator)
                    {
                        Image     = importNode.GetAttribute("Image"),
                        InfoImage = importNode.GetAttribute("InfoImage"),
                        Name      = importNode.GetAttribute("Name"),
                        Title     = importNode.GetAttribute("Title"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        info.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowCancel")))
                    {
                        info.ShowCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowCancel")));
                    }
                    if (int.TryParse(importNode.GetAttribute("Timeout"), out int infoTimeout))
                    {
                        info.Timeout = infoTimeout;
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("TimeoutAction")))
                    {
                        info.TimeoutAction = importNode.GetAttribute("TimeoutAction");
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        info.Content = CDATARemover(importNode.InnerXml);
                    }
                    element = info;
                    break;

                case "InfoFullScreen":
                    InfoFullScreen infoFullScreen = new InfoFullScreen(Globals.EventAggregator)
                    {
                        Image = importNode.GetAttribute("Image")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("BackgroundColor")))
                    {
                        infoFullScreen.BackgroundColor = importNode.GetAttribute("BackgroundColor");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("TextColor")))
                    {
                        infoFullScreen.TextColor = importNode.GetAttribute("TextColor");
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        infoFullScreen.Content = CDATARemover(importNode.InnerXml);
                    }
                    break;

                case "Input":
                    Input input = new Input(Globals.EventAggregator)
                    {
                        Name      = importNode.GetAttribute("Name"),
                        Title     = importNode.GetAttribute("Title"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Size")))
                    {
                        input.Size = importNode.GetAttribute("Size");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        input.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowCancel")))
                    {
                        input.ShowCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowCancel")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("CenterTitle")))
                    {
                        input.CenterTitle = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("CenterTitle")));
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, input);
                        if (ne is IChildElement)
                        {
                            input.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = input;
                    break;

                case "Preflight":
                    Preflight preflight = new Preflight(Globals.EventAggregator)
                    {
                        Title     = importNode.GetAttribute("Title"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Size")))
                    {
                        preflight.Size = importNode.GetAttribute("Size");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        preflight.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowCancel")))
                    {
                        preflight.ShowCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowCancel")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("CenterTitle")))
                    {
                        preflight.CenterTitle = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("CenterTitle")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowOnFailureOnly")))
                    {
                        preflight.CenterTitle = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowOnFailureOnly")));
                    }
                    if (int.TryParse(importNode.GetAttribute("Timeout"), out int preflightTimeout))
                    {
                        preflight.Timeout = preflightTimeout;
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("TimeoutAction")))
                    {
                        preflight.TimeoutAction = importNode.GetAttribute("TimeoutAction");
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, preflight);
                        if (ne is IChildElement)
                        {
                            preflight.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = preflight;
                    break;

                case "RandomString":
                    RandomString randomString = new RandomString(Globals.EventAggregator)
                    {
                        Variable  = importNode.GetAttribute("Variable"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("AllowedChars")))
                    {
                        randomString.AllowedChars = importNode.GetAttribute("AllowedChars");
                    }
                    if (int.TryParse(importNode.GetAttribute("Length"), out int randomLength))
                    {
                        randomString.Length = randomLength;
                    }
                    element = randomString;
                    break;

                case "RegRead":
                    RegRead regRead = new RegRead(Globals.EventAggregator)
                    {
                        Default   = importNode.GetAttribute("Default"),
                        Key       = importNode.GetAttribute("Key"),
                        Variable  = importNode.GetAttribute("Variable"),
                        Value     = importNode.GetAttribute("Value"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Reg64")))
                    {
                        regRead.Reg64 = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Reg64")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Hive")))
                    {
                        regRead.Hive = importNode.GetAttribute("Hive");
                    }
                    element = regRead;
                    break;

                case "RegWrite":
                    RegWrite regWrite = new RegWrite(Globals.EventAggregator)
                    {
                        Key       = importNode.GetAttribute("Key"),
                        Value     = importNode.GetAttribute("Value"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Reg64")))
                    {
                        regWrite.Reg64 = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Reg64")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Type")))
                    {
                        regWrite.ValueType = importNode.GetAttribute("Type");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Hive")))
                    {
                        regWrite.Hive = importNode.GetAttribute("Hive");
                    }
                    element = regWrite;
                    break;

                case "SaveItems":
                    SaveItems saveItems = new SaveItems(Globals.EventAggregator)
                    {
                        Items     = importNode.GetAttribute("Items"),
                        Path      = importNode.GetAttribute("Path"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    element = saveItems;
                    break;

                case "SoftwareDiscovery":
                    SoftwareDiscovery softwareDiscovery = new SoftwareDiscovery(Globals.EventAggregator)
                    {
                        Condition = importNode.GetAttribute("Condition"),
                    };
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, softwareDiscovery);
                        if (ne is IChildElement)
                        {
                            softwareDiscovery.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = softwareDiscovery;
                    break;

                case "Switch":
                    Switch switchClass = new Switch(Globals.EventAggregator)
                    {
                        OnValue   = importNode.GetAttribute("OnValue"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DontEval")))
                    {
                        switchClass.DontEval = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DontEval")));
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, switchClass);
                        if (ne is IChildElement)
                        {
                            switchClass.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = switchClass;
                    break;

                case "TSVar":
                    TSVar tsVar = new TSVar(Globals.EventAggregator)
                    {
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DontEval")))
                    {
                        tsVar.DontEval = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DontEval")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Name")))
                    {
                        tsVar.Variable = importNode.GetAttribute("Name");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Variable")))
                    {
                        tsVar.Variable = importNode.GetAttribute("Variable");
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        tsVar.Content = CDATARemover(importNode.InnerXml);
                    }
                    element = tsVar;
                    break;

                case "TSVarList":
                    TSVarList tsVarList = new TSVarList(Globals.EventAggregator)
                    {
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ApplicationVariableBase")))
                    {
                        tsVarList.ApplicationVariableBase = importNode.GetAttribute("ApplicationVariableBase");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("PackageVariableBase")))
                    {
                        tsVarList.PackageVariableBase = importNode.GetAttribute("PackageVariableBase");
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, tsVarList);
                        if (ne is IChildElement)
                        {
                            tsVarList.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = tsVarList;
                    break;

                case "UserAuth":
                    UserAuth userAuth = new UserAuth(Globals.EventAggregator)
                    {
                        Attributes       = importNode.GetAttribute("Attributes"),
                        Domain           = importNode.GetAttribute("Domain"),
                        DomainController = importNode.GetAttribute("DomainController"),
                        Group            = importNode.GetAttribute("Group"),
                        Title            = importNode.GetAttribute("Title")
                    };
                    if (int.TryParse(importNode.GetAttribute("MaxRetryCount"), out int uaMaxRetryCount))
                    {
                        userAuth.MaxRetryCount = uaMaxRetryCount;
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DisableCancel")))
                    {
                        userAuth.DisableCancel = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DisableCancel")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DoNotFallback")))
                    {
                        userAuth.DoNotFallback = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DoNotFallback")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("GetGroups")))
                    {
                        userAuth.GetGroups = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("GetGroups")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ShowBack")))
                    {
                        userAuth.ShowBack = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ShowBack")));
                    }
                    element = userAuth;
                    break;

                case "Vars":
                    Vars vars = new Vars(Globals.EventAggregator)
                    {
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Direction")))
                    {
                        vars.Direction = importNode.GetAttribute("Direction");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Filename")))
                    {
                        vars.Filename = importNode.GetAttribute("Filename");
                    }
                    element = vars;
                    break;

                case "WMIRead":
                    WMIRead wmiRead = new WMIRead(Globals.EventAggregator)
                    {
                        Class        = importNode.GetAttribute("Class"),
                        Default      = importNode.GetAttribute("Default"),
                        KeyQualifier = importNode.GetAttribute("KeyQualifier"),
                        Property     = importNode.GetAttribute("Property"),
                        Query        = importNode.GetAttribute("Query"),
                        Variable     = importNode.GetAttribute("Variable"),
                        Condition    = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Namespace")))
                    {
                        wmiRead.Namespace = importNode.GetAttribute("Namespace");
                    }
                    element = wmiRead;
                    break;

                case "WMIWrite":
                    WMIWrite wmiWrite = new WMIWrite(Globals.EventAggregator)
                    {
                        Class     = importNode.GetAttribute("Class"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Namespace")))
                    {
                        wmiWrite.Namespace = importNode.GetAttribute("Namespace");
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, wmiWrite);
                        if (ne is IChildElement)
                        {
                            wmiWrite.SubChildren.Add(ne as IChildElement);
                        }
                    }
                    element = wmiWrite;
                    break;
                }
            }
            else
            {
                switch (xmlNode.Name)
                {
                case "ActionGroup":
                    ActionGroup actionGroup = new ActionGroup(Globals.EventAggregator)
                    {
                        Name      = importNode.GetAttribute("Name"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x);
                        actionGroup.Children.Add(ne);
                    }
                    element = actionGroup;
                    break;

                case "Case":
                    Case caseClass = new Case(parent)
                    {
                        RegEx     = importNode.GetAttribute("RegEx"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("CaseInsensitive")))
                    {
                        caseClass.CaseInsensitive = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("CaseInsensitive")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DontEval")))
                    {
                        caseClass.DontEval = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DontEval")));
                    }
                    element = caseClass;
                    break;

                case "Check":
                    Check check = new Check(parent as Preflight)
                    {
                        CheckCondition   = importNode.GetAttribute("CheckCondition"),
                        Description      = importNode.GetAttribute("Description"),
                        ErrorDescription = importNode.GetAttribute("ErrorDescription"),
                        Text             = importNode.GetAttribute("Text"),
                        WarnCondition    = importNode.GetAttribute("WarnCondition"),
                        WarnDescription  = importNode.GetAttribute("WarnDescription"),
                        Condition        = importNode.GetAttribute("Condition")
                    };
                    element = check;
                    break;

                case "Choice":
                    Choice choice = new Choice(parent)
                    {
                        Option         = importNode.GetAttribute("Option"),
                        Value          = importNode.GetAttribute("Value"),
                        AlternateValue = importNode.GetAttribute("AlternateValue"),
                        Condition      = importNode.GetAttribute("Condition")
                    };
                    element = choice;
                    break;

                case "ChoiceList":
                    ChoiceList choiceList = new ChoiceList(parent)
                    {
                        OptionList         = importNode.GetAttribute("OptionList"),
                        ValueList          = importNode.GetAttribute("ValueList"),
                        AlternateValueList = importNode.GetAttribute("AlternateValueList"),
                        Condition          = importNode.GetAttribute("Condition")
                    };
                    element = choiceList;
                    break;

                case "Field":
                    Field field = new Field()
                    {
                        Name     = importNode.GetAttribute("Name"),
                        Hint     = importNode.GetAttribute("Hint"),
                        List     = importNode.GetAttribute("List"),
                        Prompt   = importNode.GetAttribute("Prompt"),
                        Question = importNode.GetAttribute("Question"),
                        RegEx    = importNode.GetAttribute("RegEx")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ReadOnly")))
                    {
                        field.ReadOnly = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ReadOnly")));
                    }
                    element = field;
                    break;

                case "InputCheckbox":
                case "CheckboxInput":
                    InputCheckbox inputCheckbox = new InputCheckbox(parent as Input)
                    {
                        CheckedValue   = importNode.GetAttribute("CheckedValue"),
                        Default        = importNode.GetAttribute("Default"),
                        Question       = importNode.GetAttribute("Question"),
                        Variable       = importNode.GetAttribute("Variable"),
                        UncheckedValue = importNode.GetAttribute("UncheckedValue"),
                        Condition      = importNode.GetAttribute("Condition")
                    };
                    element = inputCheckbox;
                    break;

                case "InputChoice":
                case "ChoiceInput":
                    InputChoice inputChoice = new InputChoice(parent as Input)
                    {
                        AlternateVariable = importNode.GetAttribute("AlternateValue"),
                        Default           = importNode.GetAttribute("Default"),
                        Question          = importNode.GetAttribute("Question"),
                        Variable          = importNode.GetAttribute("Variable"),
                        Condition         = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("AutoComplete")))
                    {
                        inputChoice.AutoComplete = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("AutoComplete")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Required")))
                    {
                        inputChoice.Required = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Required")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Sort")))
                    {
                        inputChoice.Sort = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Sort")));
                    }
                    if (int.TryParse(importNode.GetAttribute("DropDownSize"), out int inputChoiceDropDownSize))
                    {
                        inputChoice.DropDownSize = inputChoiceDropDownSize;
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, inputChoice);
                        inputChoice.SubChildren.Add(ne as IChildElement);
                    }
                    element = inputChoice;
                    break;

                case "InputInfo":
                case "InfoInput":
                    InputInfo inputInfo = new InputInfo(parent as Input)
                    {
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Color")))
                    {
                        inputInfo.Color = importNode.GetAttribute("Color");
                    }
                    if (int.TryParse(importNode.GetAttribute("DropDownSize"), out int inputInfoNumberOfLines))
                    {
                        inputInfo.NumberOfLines = inputInfoNumberOfLines;
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        inputInfo.Content = CDATARemover(importNode.InnerXml);
                    }
                    element = inputInfo;
                    break;

                case "InputText":
                case "TextInput":
                    InputText inputText = new InputText(parent as Input)
                    {
                        Default   = importNode.GetAttribute("Default"),
                        Hint      = importNode.GetAttribute("Hint"),
                        Prompt    = importNode.GetAttribute("Prompt"),
                        Question  = importNode.GetAttribute("Question"),
                        RegEx     = importNode.GetAttribute("RegEx"),
                        Variable  = importNode.GetAttribute("Variable"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ADValidate")))
                    {
                        inputText.ADValidate = importNode.GetAttribute("ADValidate");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ForceCase")))
                    {
                        inputText.ForceCase = importNode.GetAttribute("ForceCase");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("HScroll")))
                    {
                        inputText.HScroll = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("HScroll")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Password")))
                    {
                        inputText.Password = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Password")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("ReadOnly")))
                    {
                        inputText.ReadOnly = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("ReadOnly")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Required")))
                    {
                        inputText.Required = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Required")));
                    }
                    element = inputText;
                    break;

                case "Match":
                    Match match = new Match(parent as IParentElement)
                    {
                        DisplayName = importNode.GetAttribute("DisplayName"),
                        Variable    = importNode.GetAttribute("Variable"),
                        Version     = importNode.GetAttribute("Version"),
                        Condition   = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("VersionOperator")))
                    {
                        match.VersionOperator = importNode.GetAttribute("VersionOperator");
                    }
                    element = match;
                    break;

                case "Property":
                    Property property = new Property(parent)
                    {
                        Name      = importNode.GetAttribute("Name"),
                        Value     = importNode.GetAttribute("Value"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Type")))
                    {
                        property.Type = importNode.GetAttribute("Type");
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Key")))
                    {
                        property.Key = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Key")));
                    }
                    element = property;
                    break;

                case "Set":
                    Set set = new Set(parent)
                    {
                        Name      = importNode.GetAttribute("Name"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, set);
                        set.SubChildren.Add(ne as IChildElement);
                    }
                    element = set;
                    break;

                case "SoftwareGroup":
                    SoftwareGroup softwareGroup = new SoftwareGroup(parent)
                    {
                        Id        = importNode.GetAttribute("Id"),
                        Label     = importNode.GetAttribute("Label"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Default")))
                    {
                        softwareGroup.Default = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Default")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Required")))
                    {
                        softwareGroup.Required = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Required")));
                    }
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, softwareGroup);
                        softwareGroup.SubChildren.Add(ne as IChildElement);
                    }
                    element = softwareGroup;
                    break;

                case "SoftwareListRef":
                    SoftwareListRef softwareListRef = new SoftwareListRef(parent as IParentElement)
                    {
                        Id        = importNode.GetAttribute("Id"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    element = softwareListRef;
                    break;

                case "SoftwareRef":
                    SoftwareRef softwareRef = new SoftwareRef(parent)
                    {
                        Id        = importNode.GetAttribute("Id"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Hidden")))
                    {
                        softwareRef.Hidden = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Hidden")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Default")))
                    {
                        softwareRef.Default = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Default")));
                    }
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("Required")))
                    {
                        softwareRef.Required = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("Required")));
                    }
                    element = softwareRef;
                    break;

                case "SoftwareSets":
                    AppTree at = parent as AppTree;
                    ObservableCollection <IChildElement> e = new ObservableCollection <IChildElement>();
                    foreach (XmlNode x in importNode.ChildNodes)
                    {
                        ne = NewAction(x, at);
                        e.Add(ne as IChildElement);
                    }
                    at.SubChildren = e;
                    element        = null;
                    break;

                case "Text":
                    Text text = new Text(parent as IParentElement)
                    {
                        Type      = importNode.GetAttribute("Type"),
                        Value     = importNode.GetAttribute("Value"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    element = text;
                    break;

                case "Variable":
                    Variable variable = new Variable(parent)
                    {
                        Name      = importNode.GetAttribute("Name"),
                        Condition = importNode.GetAttribute("Condition")
                    };
                    if (!string.IsNullOrEmpty(importNode.GetAttribute("DontEval")))
                    {
                        variable.DontEval = Convert.ToBoolean(StringToBoolString(importNode.GetAttribute("DontEval")));
                    }
                    if (!string.IsNullOrEmpty(importNode.InnerXml))
                    {
                        variable.Content = CDATARemover(importNode.InnerXml);
                    }
                    element = variable;
                    break;
                }
            }
            return(element);
        }
Ejemplo n.º 26
0
        private void Update(EvaluationContext context)
        {
            if (InputText.DirtyFlag.IsDirty || SplitInto.DirtyFlag.IsDirty)
            {
                _splitInto = (EntityTypes)SplitInto.GetValue(context);
                var inputText = InputText.GetValue(context);

                if (inputText == null)
                {
                    Fragments.Value = null;
                    return;
                }

                if (!string.IsNullOrEmpty(inputText))
                {
                    inputText = inputText.Replace("\\n", "\n");
                }

                switch (_splitInto)
                {
                case EntityTypes.Characters:
                    _chunks    = new Regex("(.)").Split(inputText);
                    _delimiter = "";
                    break;

                case EntityTypes.Words:
                    _chunks    = new Regex("[\\s\\.\\;\\,()`:]+").Split(inputText);
                    _delimiter = " ";
                    break;

                case EntityTypes.Lines:
                    _chunks    = new Regex("\\n+").Split(inputText);
                    _delimiter = "\n";
                    break;

                case EntityTypes.Sentences:
                    _chunks    = new Regex("\\.[\\s\\.]*").Split(inputText);
                    _delimiter = ". ";
                    break;

                default:
                    _chunks = new string[0];
                    break;
                }

                _numberOfChunks = _chunks.Length > 0 && string.IsNullOrEmpty(_chunks[_chunks.Length - 1])
                                      ? _chunks.Length - 1
                                      : _chunks.Length;
                //_lastFragment = "";
            }

            var fragmentStart = FragmentStart.GetValue(context);
            var fragmentCount = FragmentCount.GetValue(context);

            if (_splitInto == EntityTypes.Characters)
            {
                fragmentCount *= 2;
            }

            Fragments.Value = GetFragment(fragmentStart, fragmentCount);
        }
        public void InputTextTestCalculateAll()
        {
            string inputText = "az11w6ab";

            Assert.Equal(70, InputText.TextCalculator(inputText, true, true));
        }
Ejemplo n.º 28
0
        private void InputText_TextChanged(object sender, EventArgs e)
        {
            if (InputText.Text.Length == MovingButton.Text.Length || InputText.Text.Length == MovingButton2.Text.Length || InputText.Text.Length == MovingButton3.Text.Length)
            {
                if (InputText.Text == MovingButton.Text)
                {
                    score++;
                    // toggle between char and word
                    if (score < 30)
                    {
                        showButtonText(MovingButton);
                    }

                    else if (score > 29)
                    {
                        showButtonWord(MovingButton);
                    }
                    /////////////////


                    if (score == 5)
                    {
                        //increase speed
                        timer1.Interval /= 2;
                    }
                    if (score == 10)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 2");
                        timer1.Start();
                        timer2 = 700;

                        //show 2 chars instead of one
                        showButtonText(MovingButton2);
                    }



                    if (score == 20)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 3");
                        timer1.Start();
                        timer3 = 700;

                        //show 3 chars instead of 2
                        showButtonText(MovingButton3);
                    }
                    if (score == 30)
                    {
                        MovingButton.Visible = false;
                        MovingButton.Text    = "أ";

                        MovingButton2.Visible = false;
                        MovingButton2.Text    = "أ";

                        MovingButton3.Visible = false;
                        MovingButton3.Text    = "أ";

                        timer1.Stop();
                        MessageBox.Show("Level 4");
                        timer1.Start();
                        timer = 700;

                        //show just 1 word
                        showButtonWord(MovingButton);
                    }

                    if (score == 40)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 5");
                        timer1.Start();
                        timer2 = 700;

                        //show 2 words
                        showButtonWord(MovingButton2);
                    }

                    if (score == 50)
                    {
                        timer1.Stop();

                        MessageBox.Show("Level 6");
                        timer1.Start();
                        timer3 = 700;

                        //show 3 words
                        showButtonWord(MovingButton3);

                        //increase speed
                        timer1.Interval *= 2;
                    }

                    if (score == 60)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 7");
                        timer1.Start();

                        timer3 = 700;
                        //showButtonWord(MovingButton3);
                    }

                    if (score == 70)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 8");
                        timer1.Start();

                        timer3 = 700;
                        // showButtonWord(MovingButton3);
                        //timer1.Interval /= 2;
                    }

                    ScoreLabel.Text = score.ToString();
                    timer           = 700;
                    RandomNum       = random.Next(100, 1000);
                    InputText.Clear();
                }
                else if (InputText.Text == MovingButton2.Text)
                {
                    score++;


                    if (score > 9 && score < 30)
                    {
                        showButtonText(MovingButton2);
                    }

                    else if (score > 39)
                    {
                        showButtonWord(MovingButton2);
                    }


                    if (score == 20)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 3");
                        timer1.Start();
                        timer3 = 700;
                        showButtonText(MovingButton3);
                        //timer1.Interval /= 5;
                    }

                    if (score == 30)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 4");
                        timer1.Start();

                        MovingButton.Visible = false;
                        MovingButton.Text    = "أ";

                        MovingButton2.Visible = false;
                        MovingButton2.Text    = "أ";

                        MovingButton3.Visible = false;
                        MovingButton3.Text    = "أ";
                        //timer1.Interval *= 10;
                        timer = 700;
                        showButtonWord(MovingButton);
                        //timer1.Interval *= 4;
                    }

                    if (score == 50)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 5");
                        timer1.Start();

                        timer3 = 700;
                        showButtonWord(MovingButton3);
                        //timer1.Interval /= 5;
                    }

                    ScoreLabel.Text = score.ToString();
                    InputText.Clear();
                    timer2     = 700;
                    RandomNum2 = random.Next(100, 1000);
                }

                else if (InputText.Text == MovingButton3.Text)
                {
                    score++;

                    if (score > 19 && score < 30)
                    {
                        showButtonText(MovingButton3);
                    }



                    if (score == 30)
                    {
                        timer1.Stop();
                        MessageBox.Show("Level 4");
                        timer1.Start();
                        MovingButton.Visible = false;
                        MovingButton.Text    = "أ";

                        MovingButton2.Visible = false;
                        MovingButton2.Text    = "أ";

                        MovingButton3.Visible = false;
                        MovingButton3.Text    = "أ";
                        //timer1.Interval *= 10;
                        timer = 700;
                        showButtonWord(MovingButton);
                        //timer1.Interval /= 4;
                    }

                    if (score > 49)
                    {
                        showButtonWord(MovingButton3);
                    }

                    ScoreLabel.Text = score.ToString();
                    timer3          = 700;
                    RandomNum3      = random.Next(100, 1000);
                    InputText.Clear();
                }

                else if (InputText.Text.Length >= (Math.Max(Math.Max(MovingButton.Text.Length, MovingButton2.Text.Length), MovingButton3.Text.Length)))
                {
                    InputText.Clear();
                }
            }
        }
        public void InputTextTestCalculateNum()
        {
            string inputText = "az11w6ab";

            Assert.Equal(17, InputText.TextCalculator(inputText, false, true));
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    protected override void Start()
    {
        Font fontArial = (Font)ResourcesManager.LoadResource("Interface/Fonts/Futura Oblique", "Chapter");
        Texture white = (Texture)ResourcesManager.LoadResource("Shared/white_pixel", "Chapter");
        float width = (Screen.width - (ButtonProperties.buttonBarScaleX * 2)) - (MARGIN * 2);
        float height = Screen.height / 12;
        float pos_y = Screen.height / 76.8f; //10; //Screen.height / 18;
        Rect rectFileName = new Rect((ButtonProperties.buttonBarScaleX) + MARGIN, pos_y, width, height);

        //mInput = new InputText(rectFileName, white, white, white, white, fontArial, white, Globals.NEW_CHAPTER_TEXT, false, 2);
        inputText = new InputText(rectFileName, null, null, null, null, fontArial, white, Globals.NEW_CHAPTER_TEXT, false, 2);
        inputText.TextSize = Mathf.RoundToInt(50 * (height / STANDARD_HEIGHT));
        inputText.TextPosition = TextAnchor.MiddleCenter;
        inputText.TextColor = Color.white;
        inputText.specialCharacters = new char[]{ ' ', '-', '_', '.', '/', ',' };
        inputText.maxLength = 20;
        inputText.Text = "";
        inputText.shadow=true;
        inputText.TextStyle=FontStyle.Bold;
        inputText.selectedCallBack = inputSelected;
        inputText.unSelectedCallBack = inputUnSelected;
        inputText.scaleMode = ScaleMode.StretchToFill;
        inputText.Alpha = 0;
        inputText.enable = false;

        if(Data.selChapter!=null){
            inputText.Text = Data.selChapter.Title;
            inputText.Fade(1, Globals.ANIMATIONDURATION, true, true, -2);
        }

        base.Start();

        mCamera.audio.loop = true;
        mCamera.audio.playOnAwake = false;
        mCamera.audio.clip = null;

        //SetCurrentChapterElements();
    }
Ejemplo n.º 31
0
        public bool Parse()
        {
            var lines = InputText.Split(Environment.NewLine.ToCharArray())
                        .Select(l => l.Trim())
                        .Where(l => l != string.Empty)
                        .ToList();

            questions = new List <Question>();
            int      questionIndex   = 0;
            Question currentQuestion = null;
            Answer   currentAnswer   = null;

            Category = string.Empty;
            bool isQuestion = false;
            bool inAnswer   = false;

            foreach (var line in lines)
            {
                if (StartWithNumber(line))
                {
                    string qName = string.Format("Вопрос №{0}", ++questionIndex);
                    currentQuestion = new Question(qName, RemoveNumber(line));
                    isQuestion      = true;
                    inAnswer        = false;
                    questions.Add(currentQuestion);
                }
                else if (StartWithLetter(line))
                {
                    currentAnswer = new Answer(RemoveLetter(line), EndWithPlus(line));
                    isQuestion    = false;
                    inAnswer      = true;
                    currentQuestion.Answers.Add(currentAnswer);
                }
                else
                {
                    if (isQuestion)
                    {
                        currentQuestion.Text.Add(line);
                    }
                    else if (inAnswer)
                    {
                        currentAnswer.Text.Add(line);
                        currentAnswer.Correct = EndWithPlus(line);
                    }
                    else
                    {
                        Category += line;
                    }
                }
            }
            foreach (var question in questions)
            {
                question.UpdateFinalText();
                foreach (var answer in question.Answers)
                {
                    answer.Text[answer.Text.Count - 1] = ClearStringEnd(
                        RemoveEndPlus(answer.Text[answer.Text.Count - 1])
                        );
                    answer.UpdateFinalText();
                }
                question.UpdateGrades();
            }
            return(true);
        }
Ejemplo n.º 32
0
 private void InputTex_TextChanged(object sender, TextChangedEventArgs e)
 {
     InputText.GetBindingExpression(TextBox.TextProperty).UpdateSource();
 }
Ejemplo n.º 33
0
        public override long SecondStar()
        {
            var fieldRegex  = new Regex(@"(.+): (\d+-\d+) or (\d+-\d+)");
            var ticketRegex = new Regex(@"(\d+)");
            var sections    = InputText.Split("\n\n");
            var fields      = sections
                              .ElementAt(0)
                              .Split("\n")
                              .Select(l => fieldRegex.Match(l).Groups.Values)
                              .Select(g => (Name: g.ElementAt(1).Value, FirstRange: RangeTuple(g.ElementAt(2).Value), SecondRange: RangeTuple(g.ElementAt(3).Value)))
                              .ToList();

            var orderedFields = new List <(int pos, (string Name, (int Min, int Max) FirstRange, (int Min, int Max) SecondRange))>();

            var dic = new Dictionary <int, List <(string Name, (int Min, int Max) FirstRange, (int Min, int Max) SecondRange)> >();

            var myTicket = ticketRegex.Matches(sections.ElementAt(1)).Select(v => long.Parse(v.Value)).ToList();
            var tickets  = sections
                           .ElementAt(2)
                           .Split("\n")
                           .Skip(1)
                           .Select(t => ticketRegex
                                   .Matches(t)
                                   .Select(v => long.Parse(v.Value))
                                   )
                           .Where(t => t.All(tn => fields.Any(f => tn >= f.FirstRange.Min && tn <= f.FirstRange.Max || tn >= f.SecondRange.Min && tn <= f.SecondRange.Max)))
                           .ToList();

            tickets.Add(myTicket);

            var count = fields.Count();

            for (var i = 0; i < count; i++)
            {
                foreach (var f in fields)
                {
                    var nums       = tickets.Select(t => t.ElementAt(i));
                    var fieldValid = nums.All(tn => tn >= f.FirstRange.Min && tn <= f.FirstRange.Max || tn >= f.SecondRange.Min && tn <= f.SecondRange.Max);

                    if (fieldValid)
                    {
                        if (dic.ContainsKey(i))
                        {
                            dic[i].Add(f);
                        }
                        else
                        {
                            dic[i] = new[] { f }.ToList();
                        }
                    }
                }
            }

            while (orderedFields.Count < 20)
            {
                var eee = dic.First(t => t.Value.Count == 1);
                var fir = eee.Value.First();
                orderedFields.Add((eee.Key, fir));

                foreach (var e in dic)
                {
                    var containss = e.Value.FirstOrDefault(f => f.Name == fir.Name);
                    if (containss != default)
                    {
                        e.Value.Remove(containss);
                    }
                }
            }

            return(orderedFields
                   .Where(t => t.Item2.Name.Contains("departure"))
                   .Select(t => myTicket[t.pos])
                   .Aggregate((a, b) => a * b));
        }
Ejemplo n.º 34
0
 private void LogText_KeyDown(object sender, KeyEventArgs e)
 {
     InputText.Focus();
 }
        private void FromInputToList(object param)
        {
            int ID = 0;

            try
            {
                if (IDUserValue != null)
                {
                    if (IsDigitsOnly(IDUserValue) == true)
                    {
                        ID = Convert.ToInt32(IDUserValue);
                    }
                }
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }


            try
            {
                var result = InputText.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);

                foreach (string item in result)
                {
                    Brush _color = new SolidColorBrush(Color.FromRgb(255, 255, 255));

                    TypeRow type    = TypeRow.data;
                    string  keyWord = item.Trim();

                    // C'è il carattere '='
                    int indexU = keyWord.IndexOf("=");
                    if (indexU != -1)
                    {
                        string numberID = keyWord.Substring(keyWord.IndexOf("=") + 1);

                        keyWord = keyWord.Substring(0, indexU);

                        numberID = numberID.Trim();
                        numberID = RemoveComma(numberID); // Tolgo la virgola
                        numberID = numberID.Trim();
                        if (IsDigitsOnly(numberID) == true)
                        {
                            ID     = Convert.ToInt32(numberID);
                            _color = new SolidColorBrush(Color.FromRgb(255, 255, 0));
                        }
                        else
                        {
                            Debugger.Break();
                        }
                    }

                    // Tolgo la virgola
                    keyWord = RemoveComma(keyWord);


                    // Capisco se è un commento
                    if (keyWord[0] == '/')
                    {
                        type   = TypeRow.comment;
                        _color = new SolidColorBrush(Color.FromRgb(0, 255, 0));
                    }

                    var    lastWord   = keyWord.Split('_').Last();
                    string traslation = SplitCamelCase(lastWord);
                    traslation = RemoveComma(traslation).Trim();

                    if (type == TypeRow.comment)
                    {
                        traslation = "";
                    }

                    WordList.Add(new RowData()
                    {
                        id           = ID,
                        Key          = keyWord,
                        Translate    = traslation,
                        TypeRow      = type,
                        ColorTextBox = _color
                    });


                    // AUmento l'iD solo se non è un commento
                    if (type == TypeRow.data)
                    {
                        ID++;
                    }
                }

                OnPropertyChanged("WordList");
            }
            catch (Exception ex)
            {
                Debugger.Break();
            }
        }
Ejemplo n.º 36
0
		public void Show()
		{
			Container = Div.CreateContainer(default(Element), container=>{
				Div.CreateRow(container, row=>{
					//
					new Div(row,element=>{

						element.ClassName="span4 offset4 well";
						new Legend(element, new LegendConfig{Text="Por favor inicie session"});
						
						new Form(element, fe=>{
							fe.Action= Config.Action;
							fe.Method = Config.Method;

							var cg = Div.CreateControlGroup(fe);
							
							var user= new InputText(cg.Element(), pe=>{
								pe.ClassName="span4";
								pe.SetPlaceHolder("nombre de usuario");
								pe.Name="UserName";
							});
							
							cg = Div.CreateControlGroup(fe);
							var pass =new InputPassword(cg.Element(), pe=>{
								pe.ClassName="span4";
								pe.SetPlaceHolder("Digite su clave");
								pe.Name="Password";
							});
																												
							var bt = new SubmitButton(fe, b=>{
								b.JSelect().Text("Iniciar Session");
								b.ClassName="btn btn-info btn-block";
								b.LoadingText("  autenticando....");
							});
														
							var vo = new ValidateOptions()
								.SetSubmitHandler( f=>{
									
									bt.ShowLoadingText();
									
									jQuery.PostRequest<LoginResponse>(f.Action, f.Serialize(), cb=>{
										Cayita.Javascript.Firebug.Console.Log("callback", cb);
									},"json")
										.Success(d=>{
											UserName= user.Element().Value;
											if(OnLogin!=null) OnLogin(d,this);
											
										})
											.Error((request,  textStatus,  error)=>{
												Div.CreateAlertErrorBefore(fe.Elements[0],textStatus+": "
												                           +( request.StatusText.StartsWith("ValidationException")?
												  "Usario/clave no validos":
												  request.StatusText));
											})
											.Always(a=>{
												bt.ResetLoadingText();
											})										;
									
									
								})
									.AddRule((rule, msg)=>{
										rule.Element=pass.Element();
										rule.Rule.Minlength(2).Required();
										msg.Minlength("minimo 2 caracteres").Required("Digite su password");
									})
									
									.AddRule( (rule, msg)=> {
										rule.Element= user.Element();
										rule.Rule.Required().Minlength(2);
										msg.Minlength("minimo 2 caracteres");
									});
							
							fe.Validate(vo);			
							
						});
						
					});

				});
			});
			
			Parent.AppendChild(Container.Element());
		}