Example #1
0
			public void Add(PropertyBinding propertyBinding, MemberInfo memberInfo)
			{
				Entry entry = new Entry();
				entry.PropertyBinding = propertyBinding;
				entry.MemberInfo = memberInfo;
				_table.Add(propertyBinding.Name, entry);
			}
        private void Execute(Entry entry) {
            // Force reloading extensions if there were extensions installed
            // See http://orchard.codeplex.com/workitem/17465
            if (entry.MessageName == "IRecipeSchedulerEventHandler.ExecuteWork") {
                var ctx = _orchardHost().GetShellContext(entry.ShellSettings);
            }

            var shellContext = _shellContextFactory.CreateDescribedContext(entry.ShellSettings, entry.ShellDescriptor);
            using (shellContext.LifetimeScope) {
                using (var standaloneEnvironment = shellContext.LifetimeScope.CreateWorkContextScope()) {

                    ITransactionManager transactionManager;
                    if (!standaloneEnvironment.TryResolve(out transactionManager))
                        transactionManager = null;

                    try {
                        var eventBus = standaloneEnvironment.Resolve<IEventBus>();
                        Logger.Information("Executing event {0} in process {1} for shell {2}",
                                           entry.MessageName,
                                           entry.ProcessId,
                                           entry.ShellSettings.Name);
                        eventBus.Notify(entry.MessageName, entry.EventData);
                    }
                    catch {
                        // any database changes in this using(env) scope are invalidated
                        if (transactionManager != null)
                            transactionManager.Cancel();
                        throw;
                    }
                }
            }
        }
Example #3
0
 public override Stream OpenEntry(ArcFile arc, Entry entry)
 {
     if (entry.Size < 0x2C || !arc.File.View.AsciiEqual (entry.Offset, "ONCE"))
         return base.OpenEntry (arc, entry);
     var input = arc.File.CreateStream (entry.Offset+0x2C, entry.Size-0x2C);
     return new EncryptedStream (input);
 }
Example #4
0
 public static BARFile Load(string filename)
 {
     if (!File.Exists(filename)) return null;
     var file = File.OpenRead(filename);
     var bar = new BARFile() {
         stream = file,
         SourceFilename = filename,
     };
     var reader = new BinaryReader(file);
     reader.Read(bar.Id = new byte[8], 0, 8);
     int unknown = reader.ReadInt32();
     int entryC = reader.ReadInt32();
     bar.DirectorySize = reader.ReadInt32();
     bar.DirectoryOffset = reader.ReadInt32();
     int unknown2 = reader.ReadInt32();
     file.Seek(bar.DirectoryOffset, SeekOrigin.Begin);
     int[] offsets = new int[entryC];
     for (int o = 0; o < offsets.Length; ++o) offsets[o] = reader.ReadInt32();
     for (int e = 0; e < entryC; ++e) {
         Entry entry = new Entry();
         entry.Offset = reader.ReadInt32();
         entry.Size = reader.ReadInt32();
         entry.Size2 = reader.ReadInt32();
         byte b0 = reader.ReadByte(),
             b1 = reader.ReadByte(),
             b2 = reader.ReadByte(),
             b3 = reader.ReadByte();
         if (b3 != 0) file.Position += 4;
         for (var c = reader.ReadChar(); c != '\0'; c = reader.ReadChar()) {
             entry.Name += c;
         }
         bar.entries.Add(entry);
     }
     return bar;
 }
Example #5
0
        public Login()
        {
            Entry usuario = new Entry { Placeholder = "Usuario" };
            Entry clave = new Entry { Placeholder = "Clave", IsPassword = true };

            Button boton = new Button {
                Text = "Login",
                TextColor = Color.White,
                BackgroundColor = Color.FromHex ("77D065")
            };

            boton.Clicked += (sender, e) => {

            };

            //Stacklayout permite apilar los controles verticalmente
            StackLayout stackLayout = new StackLayout
            {
                Spacing = 20,
                Padding = 50,
                VerticalOptions = LayoutOptions.Center,
                Children =
                {
                    usuario,
                    clave,
                    boton
                }
            };

            //Como esta clase hereda de ContentPage, podemos usar estas propiedades directamente
            this.Content = stackLayout;
            this.Padding = new Thickness (5, Device.OnPlatform (20, 5, 5), 5, 5);
        }
Example #6
0
        public LoginPage()
        {
            user = new Entry {
                Placeholder = "Usuario"
            };
            pass = new Entry {
                IsPassword = true,
                Placeholder = "****"
            };

            Content = new StackLayout {
                Children = {
                    new Label {
                        Text = "Usuario"
                    },
                    user,
                    new Label {
                        Text = "Contraseña"
                    },
                    pass,
                    new Button {
                        Text = "Ingresar",
                        Command = new Command (Acceder)
                    }
                }
            };
        }
Example #7
0
		void CreateControls()
		{
			_picker = new DatePicker { Format = "D" };

			_manExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric };
			_manExpense.TextChanged += numberEntry_TextChanged;
			_womanExpense = new Entry { Placeholder = "Exemple : 0,00", Keyboard = Keyboard.Numeric };
			_womanExpense.TextChanged += numberEntry_TextChanged;
			_details = new Editor { BackgroundColor = AppColors.Gray.MultiplyAlpha(0.15d), HeightRequest = 150 };

			Content = new StackLayout
				{ 
					Padding = new Thickness(20),
					Spacing = 10,
					Children =
						{
							new Label { Text = "Date" },
							_picker,
							new Label { Text = "Man expense" },
							_manExpense,
							new Label { Text = "Woman expense" },
							_womanExpense,
							new Label { Text = "Informations" },
							_details
						}
					};
		}
        public void  put(int oid, object obj)
        {
            lock(this)
            {
                Entry[] tab = table;
                int index = (oid & 0x7FFFFFFF) % tab.Length;
                for (Entry e = tab[index]; e != null; e = e.next)
                {
                    if (e.oid == oid)
                    {
                        e.oref.Target = obj;
                        return ;
                    }
                }
                if (count >= threshold && !disableRehash)
                {
                    // Rehash the table if the threshold is exceeded
                    rehash();
                    tab = table;
                    index = (oid & 0x7FFFFFFF) % tab.Length;
                }
				
                // Creates the new entry.
                tab[index] = new Entry(oid, new WeakReference(obj), tab[index]);
                count++;
            }
        }
	/// <summary>
	/// Collect a list of usable delegates from the specified target game object.
	/// The delegates must be of type "void Delegate()".
	/// </summary>

	static List<Entry> GetMethods (GameObject target)
	{
		MonoBehaviour[] comps = target.GetComponents<MonoBehaviour>();

		List<Entry> list = new List<Entry>();

		for (int i = 0, imax = comps.Length; i < imax; ++i)
		{
			MonoBehaviour mb = comps[i];
			if (mb == null) continue;

			MethodInfo[] methods = mb.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public);

			for (int b = 0; b < methods.Length; ++b)
			{
				MethodInfo mi = methods[b];

				if (mi.GetParameters().Length == 0 && mi.ReturnType == typeof(void))
				{
					if (mi.Name != "StopAllCoroutines" && mi.Name != "CancelInvoke")
					{
						Entry ent = new Entry();
						ent.target = mb;
						ent.method = mi;
						list.Add(ent);
					}
				}
			}
		}
		return list;
	}
Example #10
0
		public void VisitBegins(BeginMethods begin)
		{
			Log.DebugLine(this, "-----------------------------------"); 
			Log.DebugLine(this, "{0}", begin.Type);				

			m_current = new Entry();
		}
		public RequiredFieldTriggerPage ()
		{
			var l = new Label {
				Text = "Entry requires length>0 before button is enabled",
			};
			l.FontSize = Device.GetNamedSize (NamedSize.Small, l); 

			var e = new Entry { Placeholder = "enter name" };

			var b = new Button { Text = "Save",

				HorizontalOptions = LayoutOptions.Center
			};
			b.FontSize = Device.GetNamedSize (NamedSize.Large ,b);

			var dt = new DataTrigger (typeof(Button));
			dt.Binding = new Binding ("Text.Length", BindingMode.Default, source: e);
			dt.Value = 0;
			dt.Setters.Add (new Setter { Property = Button.IsEnabledProperty, Value = false });
			b.Triggers.Add (dt);

			Content = new StackLayout { 
				Padding = new Thickness(0,20,0,0),
				Children = {
					l,
					e,
					b
				}
			};
		}
Example #12
0
 public void Store(Entry entry)
 {
     lock (_cache)
     {
         _cache[entry.Key] = entry;
     }
 }
Example #13
0
File: Spike.cs Project: adbk/spikes
        private void Foo()
        {

            Page p = new Page
            {
                //BackgroundColor = "white",
            };

            var l = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Micro),
            };

            var e = new Entry()
            {

                Keyboard = Keyboard.Numeric,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };


            var c = new ContentView()
            {
                Padding = new Thickness(5),
            };

            var sl = new StackLayout
            {
                Padding = new Thickness(5),
            };
        }
Example #14
0
 public void Execute()
 {
     if (_count == 0)
     {
         return;
     }
     Entry head;
     lock (this)
     {
         head = this._head;
         this._head = null;
     }
     for (; head != null; )
     {
         try
         {
             head.update.Action();
         }
         catch (System.Exception)
         {
         }
         head = head.next;
     }
     _count = 0;
 }
        public async Task UpdateEntryWithResult()
        {
            var key = new Entry() { { "ProductID", 1 } };
            var product = await _client.UpdateEntryAsync("Products", key, new Entry() { { "ProductName", "Chai" }, { "UnitPrice", 123m } }, true);

            Assert.Equal(123m, product["UnitPrice"]);
        }
Example #16
0
		public FilterPage ()
		{
			this.Icon = "slideout.png";
			this.Title = "Filter";

			_scope = App.AutoFacContainer.BeginLifetimeScope();

			var vm = _scope.Resolve<FilterViewModel> ();

			BindingContext = vm;

			var layout = new StackLayout ();

			layout.Children.Add (new Label() {Text = "Enter a filter"});
			layout.Children.Add (new Label() {Text = "Subject"});
			var subjectEntry = new Entry();
			subjectEntry.SetBinding (Entry.TextProperty, "Subject");
			layout.Children.Add (subjectEntry);
			var button = new Button () { Text = "Apply Filter" };
			button.SetBinding (Button.CommandProperty, "FilterMeasures");
			layout.Children.Add (button);

			Content = layout;


		}
Example #17
0
   public HelloWorld() 
     {      
	win = new Window();
	win.Title = "Hello World";
	win.Name = "EWL_WINDOW";
	win.Class = "EWLWindow";
	win.SizeRequest(200, 100);
	win.DeleteEvent += winDelete;
	
	win.Show();
	
	lbl = new Entry();
	//lbl.SetFont("/usr/share/fonts/ttf/western/Adeventure.ttf", 12);
	//lbl.SetColor(255, 0 , 0 , 255);
	//lbl.Style = "soft_shadow";
	//lbl.SizeRequest(win.Width, win.Height);
	//lbl.Disable();
	lbl.ChangedEvent += new EwlEventHandler(txtChanged);
	lbl.Text = "Enlightenment";
	
	Console.WriteLine(lbl.Text);
	Console.WriteLine(lbl.Text);
	
	lbl.TabOrderPush();
	
	win.Append(lbl);
	
	lbl.Show();
	
     }
		public LoginPageCS ()
		{
			var toolbarItem = new ToolbarItem {
				Text = "Sign Up"
			};
			toolbarItem.Clicked += OnSignUpButtonClicked;
			ToolbarItems.Add (toolbarItem);

			messageLabel = new Label ();
			usernameEntry = new Entry {
				Placeholder = "username"	
			};
			passwordEntry = new Entry {
				IsPassword = true
			};
			var loginButton = new Button {
				Text = "Login"
			};
			loginButton.Clicked += OnLoginButtonClicked;

			Title = "Login";
			Content = new StackLayout { 
				VerticalOptions = LayoutOptions.StartAndExpand,
				Children = {
					new Label { Text = "Username" },
					usernameEntry,
					new Label { Text = "Password" },
					passwordEntry,
					loginButton,
					messageLabel
				}
			};
		}
Example #19
0
        // dists is an array of reference objects (properties x, y, z, distance)
        // i1, i2, i3 indexes of the references to use to calculate the candidates
        // returns an array of two points (properties x, y, z). if the supplied reference points are disjoint then an empty array is returned
        public Candidate[] getCandidates(Entry[] dists, int i1, int i2, int i3)
        {
            Coordinate p1 = dists[i1].Coordinate;
            Coordinate p2 = dists[i2].Coordinate;
            Coordinate p3 = dists[i3].Coordinate;
            double distance1 = dists[i1].Distance;
            double distance2 = dists[i2].Distance;
            double distance3 = dists[i3].Distance;

            Coordinate p1p2 = diff(p2, p1);
            var d = length(p1p2);
            var ex = scalarProd(1/d, p1p2);
            var p1p3 = diff(p3, p1);
            var i = dotProd(ex, p1p3);
            var ey = diff(p1p3, scalarProd(i, ex));
            ey = scalarProd( 1/length(ey), ey);
            var j = dotProd(ey, diff(p3, p1));

            var x = (distance1*distance1 -distance2*distance2 + d*d) / (2*d);
            var y = ((distance1*distance1 - distance3*distance3 + i*i + j*j) / (2*j)) - (i*x/j);
            var zsq = distance1*distance1 - x*x - y*y;
            if (zsq < 0) {
            //console.log("inconsistent distances (z^2 = "+zsq+")");
            return new Candidate[] {};
            } else
            {
            var z = Math.Sqrt(zsq);
            var ez = crossProd(ex, ey);
            Coordinate coord1 = sum(sum(p1,scalarProd(x,ex)),scalarProd(y,ey));
            Coordinate coord2 = diff(coord1,scalarProd(z,ez));
            coord1 = sum(coord1,scalarProd(z,ez));

            return new Candidate[] { new Candidate(coord1), new Candidate(coord2) };
            }
        }
Example #20
0
        public LoginPage(ILoginManager ilm)
        {
            var button = new Button { Text = "Login" };
            button.Clicked += (sender, e) => {
                if (String.IsNullOrEmpty(username.Text) || String.IsNullOrEmpty(password.Text))
                {
                    DisplayAlert("Validation Error", "Username and Password are required", "Re-try");
                } else {
                    // REMEMBER LOGIN STATUS!

                    App.Current.Properties["IsLoggedIn"] = true;
                    ilm.ShowMainPage();
                }
            };

            username = new Entry { Text = "" };
            password = new Entry { Text = "" };
            Content = new StackLayout {
                Padding = new Thickness (10, 40, 10, 10),
                Children = {
                    new Label { Text = "Login", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) },
                    new Label { Text = "Username" },
                    username,
                    new Label { Text = "Password" },
                    password,
                    button
                }
            };
        }
		protected override void Init ()
		{
			var entry = new Entry {
				Text = "Setec Astronomy",
				FontFamily = "Comic Sans MS",
				HorizontalTextAlignment = TextAlignment.Center,
				Keyboard = Keyboard.Chat
			};

			var label = new Label ();
			var binding = new Binding ("Text") { Source = entry };

			var otherEntry = new Entry ();
			var otherBinding = new Binding ("Text") { Source = entry, Mode = BindingMode.TwoWay };
			otherEntry.SetBinding (Entry.TextProperty, otherBinding);

			label.SetBinding (Label.TextProperty, binding);

			var explanation = new Label() {Text = @"The Text value of the entry at the top should appear in the label and entry below, regardless of whether 'IsPassword' is on. 
Changes to the value in the entry below should be reflected in the entry at the top."};

			var button = new Button { Text = "Toggle IsPassword" };
			button.Clicked += (sender, args) => { entry.IsPassword = !entry.IsPassword; };

			Content = new StackLayout {
				Children = { entry, button, explanation, label, otherEntry }
			};
		}
        /// <summary>
        ///   Collects a list of usable routed events from the specified target game object.
        /// </summary>
        /// <param name="target">Game object to get all usable routes events of.</param>
        /// <returns>Usable routed events from the specified target game object.</returns>
        protected override List<Entry> GetApplicableMembers(GameObject target)
        {
            MonoBehaviour[] components = target.GetComponents<MonoBehaviour>();

            List<Entry> list = new List<Entry>();

            foreach (MonoBehaviour monoBehaviour in components)
            {
                if (monoBehaviour == null)
                {
                    continue;
                }

                FieldInfo[] fields = monoBehaviour.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);

                foreach (FieldInfo info in fields)
                {
                    if (info.FieldType != typeof(ViewEvent))
                    {
                        continue;
                    }

                    Entry entry = new Entry { Target = monoBehaviour, MemberName = info.Name };
                    list.Add(entry);
                }
            }
            return list;
        }
        static void MonitorLoop()
        {
            var timer = new Stopwatch ();
            timer.Start ();

            var process = Process.GetCurrentProcess();

            Entry last = new Entry { realTime = timer.Elapsed, cpuTime = process.TotalProcessorTime };

            while (true)
            {
                Thread.Sleep (1000);

                var now = new Entry { realTime = timer.Elapsed, cpuTime = process.TotalProcessorTime };

                LoadLastSecond = (now.cpuTime - last.cpuTime).TotalMilliseconds * 100.0 / (now.realTime - last.realTime).TotalMilliseconds;
                last = now;

                if (loads.Count == 60)
                {
                    var minuteAgo = loads.Dequeue ();
                    LoadLastMinute = (now.cpuTime - minuteAgo.cpuTime).TotalMilliseconds * 100.0 / (now.realTime - minuteAgo.realTime).TotalMilliseconds;
                }

                loads.Enqueue (now);
            }
        }
Example #24
0
		public bool DeleteBookmark (Entry entry)
		{
			var result = bookmarks.Remove (entry);
			if (result)
				FireChangedEvent (entry, BookmarkEventType.Deleted);
			return result;
		}
		public EsqueciMinhaSenhaPage()
		{
			var lblTexto = new Label
			{
				Style = Estilos._estiloFonteCategorias,
				YAlign = TextAlignment.Center,
				Text = AppResources.TextoEsqueciMinhaSenha
			};

			var entEmail = new Entry
			{
				Keyboard = Keyboard.Email
			};

			var btnEnviar = new Button
			{
				Text = AppResources.TextoResetarSenha,
				Style = Estilos._estiloPadraoButton,
				HorizontalOptions = LayoutOptions.Center
			};

			var mainLayout = new StackLayout
			{
				VerticalOptions = LayoutOptions.FillAndExpand,
				Orientation = StackOrientation.Horizontal,
				Padding = new Thickness(0, 20, 0, 0),
				Spacing = 10,
				Children = { lblTexto, entEmail, btnEnviar }
			};

			this.Content = mainLayout;
		}
Example #26
0
    static string AddPhone(string name, IList<string> phones)
    {
        string result;

#if DEBUG
        //Console.WriteLine("Adding {0} - {1}", name, string.Join(", ", phones.Select(Phone.Parse)));
#endif

        if (byName.ContainsKey(name))
        {
            result = "Phone entry merged";
        }

        else
        {
            result = "Phone entry created";

            var entry = new Entry(name);

            byName.Add(name, entry);
        }

        foreach (var phone in phones)
        {
            var phoneParsed = Phone.Parse(phone);

            var entry = byName[name];

            entry.AddPhone(phoneParsed);
            byPhone[phoneParsed].Add(entry);
        }

        return result;
    }
    public void OnGroupAtlases(BuildTarget target, PackerJob job, int[] textureImporterInstanceIDs)
    {
        List<Entry> entries = new List<Entry>();

        foreach (int instanceID in textureImporterInstanceIDs)
        {
            TextureImporter ti = EditorUtility.InstanceIDToObject(instanceID) as TextureImporter;

            //TextureImportInstructions ins = new TextureImportInstructions();
            //ti.ReadTextureImportInstructions(ins, target);

            TextureImporterSettings tis = new TextureImporterSettings();
            ti.ReadTextureSettings(tis);

            Sprite[] sprites = AssetDatabase.LoadAllAssetRepresentationsAtPath(ti.assetPath).Select(x => x as Sprite).Where(x => x != null).ToArray();
            foreach (Sprite sprite in sprites)
            {
                //在这里设置每个图集的参数
                Entry entry = new Entry();
                entry.sprite = sprite;
                entry.settings.format = (TextureFormat)Enum.Parse(typeof(TextureFormat), ParseTextuerFormat(ti.spritePackingTag).ToString());
                entry.settings.filterMode = FilterMode.Bilinear;
                entry.settings.colorSpace = ColorSpace.Linear;
                entry.settings.compressionQuality = (int)TextureCompressionQuality.Normal;
                entry.settings.filterMode = Enum.IsDefined(typeof(FilterMode), ti.filterMode) ? ti.filterMode : FilterMode.Bilinear;
                entry.settings.maxWidth = ParseTextureWidth(ti.spritePackingTag);
                entry.settings.maxHeight = ParseTextureHeight(ti.spritePackingTag);
                entry.atlasName = ParseAtlasName(ti.spritePackingTag);
                entry.packingMode = GetPackingMode(ti.spritePackingTag, tis.spriteMeshType);

                entries.Add(entry);
            }
            Resources.UnloadAsset(ti);
        }

        var atlasGroups =
            from e in entries
            group e by e.atlasName;
        foreach (var atlasGroup in atlasGroups)
        {
            int page = 0;
            // Then split those groups into smaller groups based on texture settings
            var settingsGroups =
                from t in atlasGroup
                group t by t.settings;
            foreach (var settingsGroup in settingsGroups)
            {
                string atlasName = atlasGroup.Key;
                if (settingsGroups.Count() > 1)
                    atlasName += string.Format(" (Group {0})", page);

                job.AddAtlas(atlasName, settingsGroup.Key);
                foreach (Entry entry in settingsGroup)
                {
                    job.AssignToAtlas(atlasName, entry.sprite, entry.packingMode, SpritePackingRotation.None);
                }
                ++page;
            }
        }
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="IgniteSessionStateItemCollection"/> class.
        /// </summary>
        /// <param name="reader">The binary reader.</param>
        internal IgniteSessionStateItemCollection(IBinaryRawReader reader)
        {
            Debug.Assert(reader != null);

            var count = reader.ReadInt();

            _dict = new Dictionary<string, int>(count);
            _list = new List<Entry>(count);

            for (var i = 0; i < count; i++)
            {
                var key = reader.ReadString();

                var valBytes = reader.ReadByteArray();

                if (valBytes != null)
                {
                    var entry = new Entry(key, true, valBytes);

                    _dict[key] = _list.Count;

                    _list.Add(entry);
                }
                else
                    AddRemovedKey(key);
            }
        }
Example #29
0
        public RegisterPage()
        {
            var emailET = new Entry { Placeholder = "Email" };
            var passwordET = new Entry { Placeholder = "Password", IsPassword = true };
            /*
            var phoneET = new Entry { Placeholder =  "Phone *" };
            var languageET = new Entry { Placeholder =  "Language" };
            var currencyET = new Entry { Placeholder =  "Currency"};
            var nameET= new Entry { Placeholder =  "Name" };
            var surnameET= new Entry { Placeholder = "Surname" };
            var refET = new Entry { Placeholder =  "Referal code"};
            */
            var confirmBtn = new Button { Text = "CONFIRM" };
            confirmBtn.Clicked += async (object sender, EventArgs e) =>
            {
                if (emailET.Text.Length > 0 && passwordET.Text.Length > 0)
                {
                    bool registred = await Api.getInstanse().login(emailET.Text, passwordET.Text);
                    if (registred)
                    {
                        await Navigation.PushAsync(new MainPage());
                    }
                }

            };

            Content = new StackLayout {
                Children = {
                    emailET,
                    passwordET,
                    confirmBtn
                }
            };
        }
Example #30
0
        protected override void Init()
        {
            var label = new Label { Text = "Label" };
            var entry = new Entry { AutomationId = "entry" };
            var grid = new Grid();

            grid.Children.Add(label, 0, 0);
            grid.Children.Add(entry, 1, 0);
            var tableView = new TableView
            {
                Root = new TableRoot
                {
                    new TableSection
                    {
                        new ViewCell
                        {
                            View = grid
                        }
                    }
                }
            };

            Content = new StackLayout
            {
                Children = { tableView }
            };
        }
Example #31
0
 public static Entry TextColor(this Entry entry, Color textColor)
 {
     entry.TextColor = textColor;
     return(entry);
 }
Example #32
0
 public static Entry IsTextPredictionEnabled(this Entry entry, bool enabled)
 {
     entry.IsTextPredictionEnabled = enabled;
     return(entry);
 }
Example #33
0
 public static Entry IsPassword(this Entry entry, bool isPassword)
 {
     entry.IsPassword = isPassword;
     return(entry);
 }
Example #34
0
 public static Entry HorizontalTextAlignment(this Entry entry, TextAlignment alignment)
 {
     entry.HorizontalTextAlignment = alignment;
     return(entry);
 }
Example #35
0
 public static Entry FontSize(this Entry entry, double fontSize)
 {
     entry.FontSize = fontSize;
     return(entry);
 }
Example #36
0
 public static Entry FontFamily(this Entry entry, string fontFamily)
 {
     entry.FontFamily = fontFamily;
     return(entry);
 }
Example #37
0
 public static Entry FontAttributes(this Entry entry, FontAttributes attributes)
 {
     entry.FontAttributes = attributes;
     return(entry);
 }
Example #38
0
        public override void BuildContents()
        {
            AddContent(HTML.Form());

            try
            {
                string hMode = Dispatch.EitherField("HiddenMode");
                string mate_MaintenanceId = Dispatch.EitherField("mate_MaintenanceId");
                int errorflag = 0;
                string errormessage = string.Empty;
                EntryGroup BadTypeNewEntry = new EntryGroup("BadTypeNewEntry");
                //CostAdjustmentProductNewEntry.Title = "Add CostAdjustmentProduct"; 
                Entry bred_busreportidEntry = BadTypeNewEntry.GetEntry("badt_maintenanceid");
                if (bred_busreportidEntry != null)
                {
                    bred_busreportidEntry.DefaultValue = mate_MaintenanceId;
                    bred_busreportidEntry.ReadOnly = true;
                }

                AddTabHead("DecoratePerson");
                if (hMode == "Save")
                {
                    Record BadType = new Record("BadType");
                    BadTypeNewEntry.Fill(BadType);
                    if (BadTypeNewEntry.Validate())
                    {
                        BadType.SaveChanges();
                        string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&mate_MaintenanceId=" + mate_MaintenanceId + "&J=Summary";
                        url = url.Replace("Key37", "DecorateCompid");
                        url = url + "&Key37=" + mate_MaintenanceId;
                        Dispatch.Redirect(url);
                        errorflag = -1;
                    }
                    else
                    {
                        errorflag = 1;
                    }
                }
                if (errorflag != -1)
                {
                    if (errorflag == 2)
                    {
                        AddError(errormessage);
                    }

                    AddContent(HTML.InputHidden("HiddenMode", ""));
                    VerticalPanel vpMainPanel = new VerticalPanel();
                    vpMainPanel.AddAttribute("width", "100%");
                    string sUrl = "javascript:document.EntryForm.HiddenMode.value='Save';";
                    BadTypeNewEntry.GetHtmlInEditMode();
                    vpMainPanel.Add(BadTypeNewEntry);
                    AddContent(vpMainPanel);
                    AddSubmitButton("Save", "Save.gif", sUrl);
                    string url = UrlDotNet(ThisDotNetDll, "RunDataPage") + "&mate_MaintenanceId=" + mate_MaintenanceId + "&J=Summary";
                    url = url.Replace("Key37", "DecoratePersonid");
                    url = url + "&Key37=" + mate_MaintenanceId;
                    AddUrlButton("Cancel", "cancel.gif", url);
                }

            }
            catch (Exception e)
            {
                AddError(e.Message);
            }
        }
Example #39
0
 public override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     _entries.Add(Entry.FromDraw(gameTime));
 }
Example #40
0
 public static Entry Text(this Entry entry, string text, Color color)
 {
     entry.Text      = text;
     entry.TextColor = color;
     return(entry);
 }
Example #41
0
        private Grid GetFormulario()
        {
            Grid contenedor = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = 250
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition()
                    {
                        Width = 150
                    },
                    new ColumnDefinition()
                }
            };
            Grid imagenContenedor = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = 180
                    },
                    new RowDefinition()
                    {
                        Height = 50
                    }
                },
                ColumnDefinitions = { new ColumnDefinition() }
            };
            Grid formularioContenedor = new Grid()
            {
                RowDefinitions =
                {
                    new RowDefinition()
                    {
                        Height = 38
                    },
                    new RowDefinition()
                    {
                        Height = 38
                    },
                    new RowDefinition()
                    {
                        Height = 38
                    },
                    new RowDefinition()
                    {
                        Height = 38
                    },
                    new RowDefinition()
                },
                ColumnDefinitions = { new ColumnDefinition() }
            };

            imgProducto                    = new Image();
            imgProducto.Margin             = new Thickness(5, 10, 5, 0);
            btnSubirImagen                 = new Button();
            btnSubirImagen.Text            = "Subir Imagen";
            btnSubirImagen.Clicked        += BtnSubirImagen_Clicked;
            btnSubirImagen.BackgroundColor = Color.Pink;
            btnSubirImagen.FontAttributes  = FontAttributes.Bold;

            entCodigo   = new Entry();
            entNombre   = new Entry();
            entCantidad = new Entry();
            entPrecio   = new Entry();

            entCodigo.IsEnabled     = false;
            entCodigo.Placeholder   = "Código";
            entNombre.Placeholder   = "Nombre";
            entCantidad.Placeholder = "Cantidad";
            entPrecio.Placeholder   = "Precio";

            entCodigo.VerticalOptions   = LayoutOptions.Center;
            entNombre.VerticalOptions   = LayoutOptions.Center;
            entCantidad.VerticalOptions = LayoutOptions.Center;
            entPrecio.VerticalOptions   = LayoutOptions.Center;

            entCodigo.WidthRequest   = 30;
            entNombre.WidthRequest   = 30;
            entCantidad.WidthRequest = 30;
            entPrecio.WidthRequest   = 30;

            imagenContenedor.Children.Add(imgProducto);
            imagenContenedor.Children.Add(btnSubirImagen, 0, 1);
            formularioContenedor.Children.Add(entCodigo);
            formularioContenedor.Children.Add(entNombre, 0, 1);
            formularioContenedor.Children.Add(entCantidad, 0, 2);
            formularioContenedor.Children.Add(entPrecio, 0, 3);

            contenedor.Children.Add(imagenContenedor);
            contenedor.Children.Add(formularioContenedor, 1, 0);

            return(contenedor);
        }
Example #42
0
        internal override void Process()
        {
            if (State == 1)
            {
                this.Device.State = Logic.Enums.State.WAR_EMODE;
            }
            else
            {
                if (this.Device.State == Logic.Enums.State.IN_PC_BATTLE)
                {
                    if (this.Device.Player.Avatar.Battle_ID > 0)
                    {
                        var Battle = Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
                        if (Battle != null)
                        {
                            if (Battle.Commands.Count > 0)
                            {
                                Level Player = Core.Players.Get(Battle.Defender.UserId, false);

                                if (Utils.IsOdd(Resources.Random.Next(1, 1000)))
                                {
                                    int lost = (int)Battle.LoseTrophies();
                                    Player.Avatar.Trophies += (int)Battle.WinTrophies();

                                    if (this.Device.Player.Avatar.Trophies >= lost)
                                    {
                                        this.Device.Player.Avatar.Trophies -= (int)Battle.LoseTrophies();
                                    }
                                    else
                                    {
                                        this.Device.Player.Avatar.Trophies = 0;
                                    }

                                    Battle.Replay_Info.Stats.Defender_Score         = (int)Battle.WinTrophies();
                                    Battle.Replay_Info.Stats.Attacker_Score         = lost > 0 ? -lost : 0;
                                    Battle.Replay_Info.Stats.Destruction_Percentage = Resources.Random.Next(49);
                                }
                                else
                                {
                                    int lost = (int)Battle.LoseTrophies();
                                    if (Player.Avatar.Trophies >= lost)
                                    {
                                        Player.Avatar.Trophies -= (int)Battle.LoseTrophies();
                                    }
                                    else
                                    {
                                        Player.Avatar.Trophies = 0;
                                    }

                                    this.Device.Player.Avatar.Trophies     += (int)Battle.WinTrophies();
                                    Battle.Replay_Info.Stats.Attacker_Score = (int)Battle.WinTrophies();
                                    Battle.Replay_Info.Stats.Defender_Score = lost > 0 ? -lost : 0;

                                    Battle.Replay_Info.Stats.Destruction_Percentage = Resources.Random.Next(50, 100);
                                    if (Battle.Replay_Info.Stats.Destruction_Percentage == 100)
                                    {
                                        Battle.Replay_Info.Stats.TownHall_Destroyed = true;
                                    }
                                }
                                this.Device.Player.Avatar.Refresh();
                                Player.Avatar.Refresh();

                                Battle.Set_Replay_Info();
                                this.Device.Player.Avatar.Inbox.Add(
                                    new Mail
                                {
                                    Stream_Type = Logic.Enums.Avatar_Stream.ATTACK,
                                    Battle_ID   = this.Device.Player.Avatar.Battle_ID
                                });

                                //if (Core.Players.Get(Battle.Defender.UserId, Constants.Database) == null)
                                {
                                    //if (Player.Avatar.Guard < 1)
                                    Player.Avatar.Inbox.Add(
                                        new Mail
                                    {
                                        Stream_Type = Logic.Enums.Avatar_Stream.DEFENSE,
                                        Battle_ID   = this.Device.Player.Avatar.Battle_ID
                                    });
                                }
                                Core.Resources.Battles.Save(Battle);
                            }
                            else
                            {
                                Core.Resources.Battles.TryRemove(this.Device.Player.Avatar.Battle_ID);
                            }
                        }
                        this.Device.Player.Avatar.Battle_ID = 0;
                    }

                    this.Device.State = Logic.Enums.State.LOGGED;
                }
                else if (this.Device.State == Logic.Enums.State.IN_AMICAL_BATTLE)
                {
                    var   Alliance = Resources.Clans.Get(this.Device.Player.Avatar.ClanId, false);
                    Entry Stream   = Alliance.Chats.Get(this.Device.Player.Avatar.Amical_ID);
                    if (Stream != null)
                    {
                        Alliance.Chats.Remove(Stream);
                    }
                    this.Device.State = Logic.Enums.State.LOGGED;
                }
                else if (this.Device.State == Logic.Enums.State.SEARCH_BATTLE)
                {
                    if (this.Device.Player.Avatar.Variables.IsBuilderVillage)
                    {
                        this.Device.Player.Avatar.Battle_ID_V2 = 0;

                        Resources.Battles_V2.Dequeue(this.Device.Player);
                    }

                    this.Device.State = Logic.Enums.State.LOGGED;
                }
                else if (this.Device.State == Logic.Enums.State.IN_1VS1_BATTLE)
                {
                    long UserID   = this.Device.Player.Avatar.UserId;
                    long BattleID = this.Device.Player.Avatar.Battle_ID_V2;
                    var  Home     = Resources.Battles_V2.GetPlayer(BattleID, UserID);
                    var  Enemy    = Resources.Battles_V2.GetEnemy(BattleID, UserID);
                    var  Battle   = Resources.Battles_V2[BattleID];

                    Home.Set_Replay_Info();
                    Home.Finished = true;

                    if (Utils.IsOdd(Resources.Random.Next(1, 1000)))
                    {
                        Home.Replay_Info.Stats.Destruction_Percentage = Resources.Random.Next(49);
                    }
                    else
                    {
                        Home.Replay_Info.Stats.Destruction_Percentage = Resources.Random.Next(50, 100);
                        Home.Replay_Info.Stats.Attacker_Stars        += 1;
                        if (Home.Replay_Info.Stats.Destruction_Percentage == 100)
                        {
                            Home.Replay_Info.Stats.TownHall_Destroyed = true;
                            Home.Replay_Info.Stats.Attacker_Stars    += 2;
                        }
                    }

                    if (Enemy.Finished)
                    {
                        new V2_Battle_Result(Battle.GetEnemy(UserID).Device, Battle).Send();
                    }

                    new V2_Battle_Result(this.Device, Battle).Send();


                    this.Device.Player.Avatar.Battle_ID_V2 = 0;
                    this.Device.State = Logic.Enums.State.LOGGED;
                }

                new Own_Home_Data(this.Device).Send();

                if (this.Device.Player.Avatar.ClanId > 0)
                {
                }
            }
        }
 private void EditFlyoutItem_OnClick(object sender, RoutedEventArgs e)
 {
     Entry selectedEntry = GetEntryFromSelectedItem(e);
     if (selectedEntry == null) return;
     Frame.Navigate(typeof (EditView), selectedEntry);
 }
Example #44
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     _entries.Add(Entry.FromUpdate(gameTime));
 }
 private void DeleteFlyoutItem_OnClick(object sender, RoutedEventArgs e)
 {
     Entry selectedEntry = GetEntryFromSelectedItem(e);
     DataHandler.Instance.RemoveEntry(selectedEntry);
     EntriesOfSelectedCategory.Remove(selectedEntry);
 }
Example #46
0
		protected override void Init()
		{
			var stack = new StackLayout();
			var columnDefinitionsLabel = new Label();
			var rowDefinitionsLabel = new Label();
			var operationLabel = new Label();
			var batchLabel = new Label();

			var batchEntry = new Entry() { AutomationId = "batch" };

			var grid = new Grid();
			stack.Children.Add(grid);

			Action update = () =>
			{
				var col = "";
				foreach (var def in grid.ColumnDefinitions)
					col += $"{def.Width} ";
				columnDefinitionsLabel.Text = $"Col: {grid.ColumnDefinitions.Count()}={col}";

				var row = "";
				foreach (var def in grid.RowDefinitions)
					row += $"{def.Height} ";
				rowDefinitionsLabel.Text = $"Row: {grid.RowDefinitions.Count()}={row}";

				operationLabel.Text = $"Id: {s_id}";

				foreach (AbsoluteLayout layout in grid.Children)
				{
					var label = (Label)layout.Children[1];
					label.Text = $"{label.AutomationId}: " +
						$"{Grid.GetColumn(layout)}x{Grid.GetRow(layout)} " +
						$"{Grid.GetColumnSpan(layout)}x{Grid.GetRowSpan(layout)}";
				}
			};
			grid.LayoutChanged += (o, x) => update();

			var dashboard = new StackLayout();
			stack.Children.Add(dashboard);
			dashboard.Children.Add(columnDefinitionsLabel);
			dashboard.Children.Add(rowDefinitionsLabel);
			dashboard.Children.Add(operationLabel);
			dashboard.Children.Add(batchLabel);

			var buttons = new Grid();
			stack.Children.Add(buttons);

			var addRow = new Button() { Text = "R" };
			addRow.Clicked += (o, e) =>
			{
				grid.RowDefinitions.Add(new RowDefinition());
				update();
			};
			buttons.Children.AddHorizontal(addRow);

			var addColumn = new Button() { Text = "C" };
			addColumn.Clicked += (o, e) =>
			{
				grid.ColumnDefinitions.Add(new ColumnDefinition());
				update();
			};
			buttons.Children.AddHorizontal(addColumn);

			var addHorizontal = new Button() { Text = "H" };
			addHorizontal.Clicked += (o, e) =>
				grid.Children.AddHorizontal(CreateBox());
			buttons.Children.AddHorizontal(addHorizontal);

			var addVertical = new Button() { Text = "V" };
			addVertical.Clicked += (o, e) =>
				grid.Children.AddVertical(CreateBox());
			buttons.Children.AddHorizontal(addVertical);

			var clearButton = new Button() { Text = "*" };
			clearButton.Clicked += (o, e) =>
			{
				grid.Children.Clear();
				grid.ColumnDefinitions.Clear();
				grid.RowDefinitions.Clear();
				update();
			};
			buttons.Children.AddHorizontal(clearButton);

			var command = new Grid();
			stack.Children.Add(command);

			command.Children.AddHorizontal(batchEntry);
			Grid.SetColumnSpan(batchEntry, 3);

			var batchButton = new Button() { Text = "!" };
			batchButton.Clicked += (o, e) =>
			{
				clearButton.SendClicked();
				foreach (var x in batchEntry.Text)
				{
					if (x == 'H') addHorizontal.SendClicked();
					if (x == 'V') addVertical.SendClicked();
					if (x == 'C') addColumn.SendClicked();
					if (x == 'R') addRow.SendClicked();
				}
				batchLabel.Text = $"Batch: {batchEntry.Text}";
				update();
				batchEntry.Text = string.Empty;
			};
			command.Children.AddHorizontal(batchButton);

			update();
			this.Content = stack;
		}
Example #47
0
        public registrationViewModel()
        {
            //Registration first page
            var registrationPage1 = new ContentView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text              = "Terms and condition text bla bla bla testing blabla",
                            VerticalOptions   = LayoutOptions.CenterAndExpand,
                            HorizontalOptions = LayoutOptions.CenterAndExpand,
                        },
                    }
                }
            };

            //Picker for second page= combox showing list of countries
            Picker countrypicker = new Picker()
            {
                Title           = "Countries",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            foreach (string colorName in nameToColor.Keys)
            {
                countrypicker.Items.Add(colorName);
            }

            //Registration second page
            var registrationPage2 = new ContentView
            {
                Content = new StackLayout
                {
                    //Spacing = 20,
                    //Padding = 50,
                    Children =
                    {
                        new Label {
                            Text = "Company Profile", FontAttributes = FontAttributes.Bold, BackgroundColor = Color.FromHex("#E5E7E8")
                        },
                        new Label {
                            Text = "Company Name: *"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Company Registration No: *"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Mailing Address: *"
                        },
                        countrypicker,
                    },
                }
            };

            //Registration third page
            var registrationPage3 = new ContentView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text = "Contact Person", FontAttributes = FontAttributes.Bold, BackgroundColor = Color.FromHex("#E5E7E8")
                        },
                        new Label {
                            Text = "Name: *"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Telephone No: *"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Mobile No:"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Fax No: *"
                        },
                        new Entry {
                        },
                        new Label {
                            Text = "Email Address: *"
                        },
                        new Entry {
                        },
                    },
                }
            };

            //Registration fourth page
            var registrationPage4 = new ContentView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text = "User Id and Password", FontAttributes = FontAttributes.Bold, BackgroundColor = Color.FromHex("#E5E7E8")
                        },
                        new Label {
                            Text = "User ID: *"
                        },
                        new Entry {
                            Placeholder = "At least 6 characters"
                        },
                        new Label {
                            Text = "Password: *"
                        },
                        new Entry {
                            Placeholder = "At least 8 characters", IsPassword = true
                        },
                        new Label {
                            Text = "Retype Password: *"
                        },
                        new Entry {
                            Placeholder = "Must be same as above", IsPassword = true
                        },
                    },
                }
            };



            //Grid design for Registration fifth page
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            //Interface for UPK section
            CustomCheckbox checkbox1    = new CustomCheckbox();
            var            instruction1 = new Label {
                Text = "Please enter the exact license number as stated on the certificate (e.g. UPKJ-B/00011)"
            };
            var instruction2 = new Label {
                Text = "For those who registered in the year 2004 and above please enter the license number as 'UPKJ' at the beginning of the number instead of 'UPK' . If any issue arises, please contact SFS for verification."
            };
            var firstcheckboxtext = new Label {
                Text = "UPK", HorizontalTextAlignment = TextAlignment.Center
            };
            var license1 = new Entry {
                Placeholder = "1."
            };
            var license2 = new Entry {
                Placeholder = "2."
            };
            var license3 = new Entry {
                Placeholder = "3."
            };
            var license4 = new Entry {
                Placeholder = "4."
            };

            grid.Children.Add(instruction1, 0, 3, 0, 4);

            grid.Children.Add(checkbox1, 0, 4);
            grid.Children.Add(firstcheckboxtext, 0, 5);
            grid.Children.Add(license1, 1, 4);
            grid.Children.Add(license2, 2, 4);
            grid.Children.Add(license3, 1, 5);
            grid.Children.Add(license4, 2, 5);

            //Interface for CIDB section
            CustomCheckbox checkbox2  = new CustomCheckbox();
            var            gradelabel = new Label {
                Text = "Grade :", HorizontalTextAlignment = TextAlignment.Center
            };
            var categorylabel = new Label {
                Text = "Category :", HorizontalTextAlignment = TextAlignment.Center
            };
            var specializationlabel = new Label {
                Text = "Specialization: "
            };
            var secondcheckboxtext = new Label {
                Text = "CIDB", HorizontalTextAlignment = TextAlignment.Center
            };
            Picker gradepicker = new Picker()
            {
                Title           = "- Grade -",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            for (int i = 1; i < 8; i++)
            {
                gradepicker.Items.Add("G" + i);
            }

            Picker categorypicker = new Picker()
            {
                Title           = "- Category -",
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            categorypicker.Items.Add("CE - Civil Engineering Construction");
            categorypicker.Items.Add("B - Building Construction");
            categorypicker.Items.Add("ME - Mechanical and Electrical");

            grid.Children.Add(checkbox2, 0, 7);
            grid.Children.Add(secondcheckboxtext, 0, 8);
            grid.Children.Add(gradelabel, 0, 9);
            grid.Children.Add(categorylabel, 1, 9);
            grid.Children.Add(specializationlabel, 2, 9);

            grid.Children.Add(gradepicker, 0, 10);
            grid.Children.Add(categorypicker, 1, 10);

            //Registration fifth page
            var registrationPage5 = new ContentView
            {
                Content = new StackLayout
                {
                    Children =
                    {
                        new Label {
                            Text = "Please select where applicable:", FontAttributes = FontAttributes.Bold, BackgroundColor = Color.FromHex("#E5E7E8")
                        },
                        grid,
                    },
                },
            };

            MyItemsSource = new ObservableCollection <View>()
            {
                registrationPage1,
                registrationPage2,
                registrationPage3,
                registrationPage4,
                registrationPage5
            };


            MyCommand = new Command(() =>
            {
                Debug.WriteLine("Position selected.");
            });
        }
 private void CopyToClipboardFlyoutItem_OnClick(object sender, RoutedEventArgs e)
 {
     Entry selectedEntry = GetEntryFromSelectedItem(e);
     if (selectedEntry == null) return;
     SetClipboardContent(selectedEntry);
 }
        public AddUpdateCustomerPage(string customerName = "", string customerAddress = "", string customerMobileNumber = "")
        {
            Title = "";
            Label addNewCustomerLabel = new Label
            {
                Text = "Add New Customer",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label))
            };

            Entry customerNameEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Placeholder       = "Enter Enter customer name",
                Text     = customerName,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            Entry customerAddressEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Placeholder       = "Enter customer address",
                Text     = customerAddress,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            Entry customerMobileNumberEntry = new Entry
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                Keyboard          = Keyboard.Telephone,
                Placeholder       = "Enter customer mobile number",
                Text     = customerMobileNumber,
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Entry))
            };

            customerMobileNumberEntry.Behaviors.Add(new NumberValidationBehavior());

            Button addCustomerButton = new Button
            {
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                WidthRequest      = 400,
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
            };

            if (string.IsNullOrWhiteSpace(customerName))
            {
                addCustomerButton.Text = "Add Customer";
            }
            else
            {
                addCustomerButton.Text = "Update Customer";
            }
            addCustomerButton.Clicked += async(s, e) =>
            {
                if (string.IsNullOrWhiteSpace(customerNameEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer name", "OK");
                }
                else if (string.IsNullOrWhiteSpace(customerAddressEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer address", "OK");
                }
                else if (string.IsNullOrWhiteSpace(customerMobileNumberEntry.Text))
                {
                    await DisplayAlert("Omkar Electricals", "Please enter customer mobile number", "OK");
                }
                else if (customerMobileNumberEntry.Text.Length != 10)
                {
                    await DisplayAlert("Omkar Electricals", "Please enter valid 10 digit mobile number", "OK");
                }
                else
                {
                    //Insert customer to db
                    using (CustomerDatabase customerDatabase = new CustomerDatabase())
                    {
                        bool status = await customerDatabase.InsertOrUpdateCustomerAsync(new Customer { CustomerName = customerNameEntry.Text.Trim(), CustomerAddress = customerAddressEntry.Text.Trim(), CustomerMobileNumber = long.Parse(customerMobileNumberEntry.Text.Trim()) });

                        if (status)
                        {
                            await DisplayAlert("Omkar Electricals", "Customer record inserted successfully", "OK");

                            await Navigation.PopAsync();
                        }
                        else
                        {
                            HockeyApp.MetricsManager.TrackEvent("Something went wrong while inserting customer to database");
                            await DisplayAlert("Omkar Electricals", "Something went wrong while inserting customer to database", "OK");
                        }
                    }
                }
            };

            Content = new StackLayout
            {
                Children          = { addNewCustomerLabel, customerNameEntry, customerAddressEntry, customerMobileNumberEntry, addCustomerButton },
                Spacing           = 10,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
        }
Example #50
0
        /// <summary>
        /// Begins when the behavior attached to the view
        /// </summary>
        /// <param name="bindable">bindable value</param>
        protected override void OnAttachedTo(StackLayout bindable)
        {
            this.editorLayout = bindable;

            this.editorScrollView = bindable.FindByName <ScrollView>("editorScrollView");
            this.eventNameText    = bindable.FindByName <Entry>("eventNameText");
            this.organizerText    = bindable.FindByName <Entry>("organizerText");

            this.cancelButton = bindable.FindByName <Button>("cancelButton");
            this.saveButton   = bindable.FindByName <Button>("saveButton");

            this.endDatePicker = bindable.FindByName <DatePicker>("endDate_picker");
            this.endTimePicker = bindable.FindByName <TimePicker>("endTime_picker");

            this.startDatePicker = bindable.FindByName <DatePicker>("startDate_picker");
            this.startTimePicker = bindable.FindByName <TimePicker>("startTime_picker");
            this.switchAllDay    = bindable.FindByName <Switch>("switchAllDay");

            this.startTimeZonePicker = bindable.FindByName <Picker>("startTimeZonePicker");
            this.startTimeZonePicker.SelectedIndex         = 0;
            this.startTimeZonePicker.ItemsSource           = TimeZoneCollection.TimeZoneList;
            this.startTimeZonePicker.SelectedIndexChanged += this.StartTimeZonePicker_SelectedIndexChanged;

            this.endTimeZonePicker = bindable.FindByName <Picker>("endTimeZonePicker");
            this.endTimeZonePicker.SelectedIndex         = 0;
            this.endTimeZonePicker.ItemsSource           = TimeZoneCollection.TimeZoneList;
            this.endTimeZonePicker.SelectedIndexChanged += this.EndTimeZonePicker_SelectedIndexChanged;

            this.endTimeLabelLayout        = bindable.FindByName <Grid>("endTimeLabel_layout");
            this.startDateTimePickerLayout = bindable.FindByName <Grid>("StartdateTimePicker_layout");
            this.startDatePickerLayout     = bindable.FindByName <Grid>("start_datepicker_layout");
            this.organizerLayout           = bindable.FindByName <Grid>("organizer_layout");

            this.startTimePickerLayout   = bindable.FindByName <Grid>("start_timepicker_layout");
            this.startTimeLabelLayout    = bindable.FindByName <Grid>("startTimeLabel_layout");
            this.endDateTimePickerLayout = bindable.FindByName <Grid>("EndDateTimePicker_layout");

            this.endDatePickerLayout     = bindable.FindByName <Grid>("end_datepicker_layout");
            this.endDateTimePickerLayout = bindable.FindByName <Grid>("EndDateTimePicker_layout");
            this.endTimePickerLayout     = bindable.FindByName <Grid>("end_timepicker_layout");

            //// Editor Layout Date and time Picker Alignment for UWP
            if (Device.RuntimePlatform == "UWP" && Device.Idiom == TargetIdiom.Desktop)
            {
                this.startDatePicker.HorizontalOptions = LayoutOptions.StartAndExpand;
                this.startTimePicker.HorizontalOptions = LayoutOptions.StartAndExpand;

                this.endDatePicker.HorizontalOptions = LayoutOptions.StartAndExpand;
                this.endTimePicker.HorizontalOptions = LayoutOptions.StartAndExpand;

                this.startDatePicker.WidthRequest = 450;
                this.startTimePicker.WidthRequest = 450;

                this.endDatePicker.WidthRequest = 450;
                this.endTimePicker.WidthRequest = 450;
            }

            this.saveButton.Clicked   += this.SaveButton_Clicked;
            this.cancelButton.Clicked += this.CancelButton_Clicked;
            this.switchAllDay.Toggled += this.SwitchAllDay_Toggled;
        }
Example #51
0
 private static void processingMovedEntry(object sender, Entry <Metadata> e)
 {
     Log.Debug($"mirror process moved {e.Type} {e.Name} {e.Data}");
 }
Example #52
0
 public override Stream OpenEntry(ArcFile arc, Entry entry)
 {
     return(new SteinsGateEncryptedStream(arc.File, entry.Offset, entry.Size));
 }
Example #53
0
        /// <summary>
        /// Loads the robots.txt from the specified TextReader.
        /// </summary>
        /// <param name="reader">The TextReader used to feed the robots.txt data into the document. May not be null.</param>
        /// <param name="baseUri"></param>
        public void Load(TextReader reader, Uri baseUri)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            _baseUri = baseUri;

            List <UserAgentEntry> userAgentsGroup = new List <UserAgentEntry>();
            bool addedEntriesToUserAgent          = false;

            do
            {
                string line = reader.ReadLine();
                if (line == null)
                {
                    break;
                }

                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                Entry entry;
                if (!Entry.TryParse(_baseUri, line, out entry))
                {
                    continue;
                }

                if (entry.Type == EntryType.UserAgent)
                {
                    UserAgentEntry userAgentEntry = (UserAgentEntry)entry;
                    if (addedEntriesToUserAgent)
                    {
                        userAgentsGroup.Clear();
                        addedEntriesToUserAgent = false;
                    }

                    UserAgentEntry foundUserAgentEntry = FindExplicitUserAgentEntry(userAgentEntry.UserAgent);
                    if (foundUserAgentEntry == null)
                    {
                        _entries.Add(userAgentEntry);
                        userAgentsGroup.Add(userAgentEntry);
                    }
                    else
                    {
                        userAgentsGroup.Add(foundUserAgentEntry);
                    }
                }
                else if (entry.Type == EntryType.Comment)
                {
                    _entries.Add(entry);
                }
                else if (entry.Type == EntryType.Sitemap)
                {
                    _entries.Add(entry);
                }
                else if (userAgentsGroup.Count > 0)
                {
                    foreach (UserAgentEntry userAgent in userAgentsGroup)
                    {
                        userAgent.AddEntry(entry);
                    }
                    addedEntriesToUserAgent = true;
                }
                else
                {
                    continue;
                }
            } while (true);
        }
Example #54
0
        private async void TlbIpPublicada_ClickedAsync(object sender, EventArgs e)
        {
            Rg.Plugins.Popup.Pages.PopupPage animationPopup = new Rg.Plugins.Popup.Pages.PopupPage();
            var scaleAnimation = new ScaleAnimation
            {
                PositionIn  = MoveAnimationOptions.Bottom,
                PositionOut = MoveAnimationOptions.Bottom,
                ScaleIn     = 1,
                ScaleOut    = 1,
                //DurationIn = 400,
                //DurationOut = 800,
                EasingIn = Easing.Linear,
                //EasingOut = Easing.CubicOut,
                HasBackgroundAnimation = true,
            };
            Label IpPublica = new Label
            {
                Text              = "IP PUBLICADA ",
                FontSize          = 13,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = 2
            };
            Label lblIp = new Label
            {
                Text              = "IP PUBLICADA",
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.Center,
                Margin            = 1
            };

            ingresarIP = new Entry
            {
                Placeholder = "Ingrese IP",
                Text        = App.Current.Properties["IpPublicado"].ToString()
            };
            StackLayout layoutIngresarIpPublica = new StackLayout
            {
                Children =
                {
                    lblIp, ingresarIP
                }
            };
            Button btnCambiarIpPublicada = new Button
            {
                Text            = "ACTUALIZAR IP",
                BackgroundColor = Color.DarkGoldenrod,
                HeightRequest   = 35,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                TextColor       = Color.White
            };

            btnCambiarIpPublicada.Clicked += BtnCambiarIpPublicada_ClickedAsync;

            animationPopup.Content = new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = 0,
                Margin            = 0,
                Children          =
                {
                    new Frame
                    {
                        Padding       = 10,
                        HeightRequest = 150,
                        WidthRequest  = 250,
                        Content       = new StackLayout
                        {
                            Children =
                            {
                                layoutIngresarIpPublica,
                                btnCambiarIpPublicada
                            }
                        }
                    }
                }
            };
            animationPopup.Animation = scaleAnimation;
            //PopupNavigation.PushAsync(animationPopup);
            await PopupNavigation.Instance.PushAsync(animationPopup);
        }
Example #55
0
 public void Set <T>(string key, T t, ShouldBeSnapshotted candidateForSnapshot = ShouldBeSnapshotted.No)
 {
     stash[key] = new Entry(t, candidateForSnapshot);
 }
Example #56
0
 private static void enqueuedMovedEntry(object sender, Entry <Metadata> e)
 {
     Log.Debug($"mirror enqueue moved {e.Type} {e.Name} {e.Data}");
 }
Example #57
0
        private static bool CopySlot(ref Entry oldEntry, DictionaryImpl <TKey, TKeyStore, TValue> newTable)
        {
            Debug.Assert(newTable != null);

            // Blindly set the hash from 0 to TOMBPRIMEHASH, to eagerly stop
            // fresh put's from claiming new slots in the old table when the old
            // table is mid-resize.
            var hash = oldEntry.hash;

            if (hash == 0)
            {
                hash = Interlocked.CompareExchange(ref oldEntry.hash, TOMBPRIMEHASH, 0);
                if (hash == 0)
                {
                    // slot was not claimed, copy is done here
                    return(true);
                }
            }

            if (hash == TOMBPRIMEHASH)
            {
                // slot was trivially copied, but not by us
                return(false);
            }

            // Prevent new values from appearing in the old table.
            // Box what we see in the old table, to prevent further updates.
            // NOTE: Read of the value below must happen before reading of the key,
            // however this read does not need to be volatile since we will have
            // some fences in between reads.
            object oldval = oldEntry.value;

            // already boxed?
            Prime box = oldval as Prime;

            if (box != null)
            {
                // volatile read here since we need to make sure
                // that the key read below happens after we have read oldval above
                Volatile.Read(ref box.originalValue);
            }
            else
            {
                do
                {
                    box = EntryValueNullOrDead(oldval) ?
                          TOMBPRIME :
                          new Prime(oldval);

                    // CAS down a box'd version of oldval
                    // also works as a complete fence between reading the value and the key
                    object prev = Interlocked.CompareExchange(ref oldEntry.value, box, oldval);

                    if (prev == oldval)
                    {
                        // If we made the Value slot hold a TOMBPRIME, then we both
                        // prevented further updates here but also the (absent)
                        // oldval is vacuously available in the new table.  We
                        // return with true here: any thread looking for a value for
                        // this key can correctly go straight to the new table and
                        // skip looking in the old table.
                        if (box == TOMBPRIME)
                        {
                            return(true);
                        }

                        // Break loop; oldval is now boxed by us
                        // it still needs to be copied into the new table.
                        break;
                    }

                    oldval = prev;
                    box    = oldval as Prime;
                }while (box == null);
            }

            if (box == TOMBPRIME)
            {
                // Copy already complete here, but not by us.
                return(false);
            }

            // Copy the value into the new table, but only if we overwrite a null.
            // If another value is already in the new table, then somebody else
            // wrote something there and that write is happens-after any value that
            // appears in the old table.  If putIfMatch does not find a null in the
            // new table - somebody else should have recorded the null-not_null
            // transition in this copy.
            object originalValue = box.originalValue;

            Debug.Assert(originalValue != TOMBSTONE);

            // since we have a real value, there must be a nontrivial key in the table
            // regular read is ok because value is always CASed down after the key
            // and we ensured that we read the key after the value with fences above
            var  key           = oldEntry.key;
            bool copiedIntoNew = newTable.PutSlotCopy(key, originalValue, hash);

            // Finally, now that any old value is exposed in the new table, we can
            // forever hide the old-table value by gently inserting TOMBPRIME value.
            // This will stop other threads from uselessly attempting to copy this slot
            // (i.e., it's a speed optimization not a correctness issue).
            // Check if we are not too late though, to not pay for MESI RFO and
            // GC fence needlessly.
            if (oldEntry.value != TOMBPRIME)
            {
                oldEntry.value = TOMBPRIME;
            }

            // if we failed to copy, it means something has already appeared in
            // the new table and old value should have been copied before that (not by us).
            return(copiedIntoNew);
        }
Example #58
0
    private void Window(int p_id)
    {
        _scrollPos = GUILayout.BeginScrollView(_scrollPos);
        for (int i = 0; i < _entryList.Count; i++)
        {
            Entry __entry = _entryList[i];

            if (_collapse && i > 0 && __entry.message == _entryList[i - 1].message)
            {
                continue;
            }

            if (__entry.type != -1)
            {
                switch ((LogType)__entry.type)
                {
                case LogType.Assert:
                case LogType.Error:
                case LogType.Exception:
                    GUI.contentColor = Color.red;
                    break;

                case LogType.Warning:
                    GUI.contentColor = Color.yellow;
                    break;

                default:
                    GUI.contentColor = Color.white;
                    break;
                }
            }
            else
            {
                GUI.contentColor = Color.gray;
            }
            GUILayout.Label("[" + __entry.time.Hour.ToString("00") + ":" + __entry.time.Minute.ToString("00") + ":" + __entry.time.Second.ToString("00") + "] " + __entry.message);
        }
        GUILayout.EndScrollView();

        GUILayout.BeginHorizontal();
        {
            GUI.contentColor = Color.white;
            DateTime __cacheTime = DateTime.Now;
            GUILayout.Label("[" + __cacheTime.Hour.ToString("00") + ":" + __cacheTime.Minute.ToString("00") + ":" + __cacheTime.Second.ToString("00") + "]", GUILayout.ExpandWidth(false));

            GUI.SetNextControlName("COMMAND_TEXT_FIELD_CONSOLE");
            _commandCache = GUILayout.TextField(_commandCache);

            if (GUILayout.Button(new GUIContent("Run", "Run the commands entered in the text field."), GUILayout.ExpandWidth(false)) && _commandCache != "")
            {
                RunCommand();
            }

            if (GUILayout.Button(new GUIContent("Clear entries", "Clear the contents of the console."), GUILayout.ExpandWidth(false)))
            {
                _entryList.Clear();
            }

            bool __cacheColapse = _collapse;
            _collapse = GUILayout.Toggle(_collapse, new GUIContent("Collapse", "Hide repeated messages."), GUILayout.ExpandWidth(false));
            if (__cacheColapse != _collapse)
            {
                _scrollPos = new Vector2(_scrollPos.x, Mathf.Infinity);
            }
        }
        GUILayout.EndHorizontal();
    }
Example #59
0
        private Task <string> InputBox(string text)
        {
            // wait in this proc, until user did his input
            var tcs = new TaskCompletionSource <string>();

            var lblTitle = new Label {
                Text = text, HorizontalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold
            };
            var lblMessage = new Label {
                Text = "Доплата", FontSize = 8
            };
            var txtInput = new Entry {
                Keyboard = Keyboard.Numeric
            };

            var btnOk = new Button
            {
                Text            = "Принять",
                WidthRequest    = 100,
                BackgroundColor = Color.FromRgb(0.8, 0.8, 0.8),
            };

            btnOk.Clicked += async(s, e) =>
            {
                // close page
                var result = txtInput.Text;
                await Navigation.PopModalAsync();

                // pass result
                tcs.SetResult(result);
            };

            var btnCancel = new Button
            {
                Text            = "Отмена",
                WidthRequest    = 100,
                BackgroundColor = Color.FromRgb(0.8, 0.8, 0.8)
            };

            btnCancel.Clicked += async(s, e) =>
            {
                // close page
                await Navigation.PopModalAsync();

                // pass empty result
                tcs.SetResult(null);
            };



            var slButtons = new StackLayout
            {
                Orientation = StackOrientation.Horizontal,
                Children    = { btnOk, btnCancel },
            };

            // var PaymentLayout

            var layout = new StackLayout
            {
                Padding           = new Thickness(0, 40, 0, 0),
                VerticalOptions   = LayoutOptions.StartAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Orientation       = StackOrientation.Vertical,
                Children          = { lblTitle, txtInput, lblMessage, slButtons },
            };

            // create and show page
            var page = new ContentPage();

            page.Content = layout;
            Navigation.PushModalAsync(page);
            // open keyboard
            txtInput.Focus();

            // code is waiting her, until result is passed with tcs.SetResult() in btn-Clicked
            // then proc returns the result
            return(tcs.Task);
        }
 private void inicializarComponente()
 {
     _tituloLabel = new Label
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         FontAttributes    = FontAttributes.Bold,
         Text = "Endereço"
     };
     _cepEntry = new Entry
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         Placeholder       = "CEP",
         Keyboard          = Keyboard.Numeric
     };
     _cepEntry.TextChanged += async(object sender, TextChangedEventArgs e) => {
         if (e.NewTextValue.Length == 8)
         {
             _cepEntry.Unfocus();
             UserDialogs.Instance.ShowLoading("Obtendo Endereço");
             try{
                 Endereco = await new BLL.CepBLL().pegarPorCep(e.NewTextValue);
                 UserDialogs.Instance.HideLoading();
             }
             catch (Exception error) {
                 UserDialogs.Instance.HideLoading();
                 UserDialogs.Instance.ShowError("Erro ao tentar obter o endereço, verifique sua conexão, ou tente novamente em alguns instantes");
             }
         }
     };
     _ufEntry = new Entry
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         Placeholder       = "UF",
         IsEnabled         = false
     };
     _cidadeEntry = new Entry
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         Placeholder       = "Cidade",
         IsEnabled         = false
     };
     _ruaEntry = new Entry
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         Placeholder       = "Rua",
         IsEnabled         = false
     };
     _numeroEntry = new Entry
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         Placeholder       = "Número",
         Keyboard          = Keyboard.Numeric
     };
     _verNoMapa = new MapaDropDownList
     {
         VerticalOptions   = LayoutOptions.Start,
         HorizontalOptions = LayoutOptions.Fill,
         TituloPadrao      = "Mapa",
         Placeholder       = "Ver endereço no mapa"
     };
 }