Remove() public method

public Remove ( Element e ) : void
e Element
return void
示例#1
0
        private void Delete(Element element, Section section)
        {
            var e = element as Gistacular.Elements.NameTimeStringElement;
            if (e == null || e.Tag == null)
                return;

            var gist = e.Tag as GistModel;
            if (gist == null)
                return;

            this.DoWork(() => {
                Application.Client.API.DeleteGist(gist.Id);

                InvokeOnMainThread(() => {
                    section.Remove(element);
                });
            });
        }
示例#2
0
        public void PopulateElements(LoadMoreElement lme, Section section, string typeLable, string valueLabel, UIKeyboardType entryKeyboardType, string deleteLabel, IList<string> labelList)
        {
            lme.Animating = false;

            var type = new StyledStringElement(typeLable) { Accessory = UITableViewCellAccessory.DetailDisclosureButton };
            section.Insert(section.Count - 1, type);
            var value = new EntryElement(null, valueLabel, null);
            value.KeyboardType = entryKeyboardType;
            section.Insert(section.Count - 1, value);

            var deleteButton = new StyledStringElement(deleteLabel)
            {
                TextColor = UIColor.Red,
            };

            deleteButton.Tapped += () =>
            {
                section.Remove(type);
                section.Remove(value);
                section.Remove(deleteButton);
            };

            // Show/Hide Delete Button
            var deleteButtonOn = false;
            type.AccessoryTapped += () =>
            {
                if (!deleteButtonOn)
                {
                    deleteButtonOn = true;
                    section.Insert(type.IndexPath.Row + 2, UITableViewRowAnimation.Bottom, deleteButton);
                }
                else
                {
                    deleteButtonOn = false;
                    section.Remove(deleteButton);
                }
            };

            type.Tapped += () =>
            {
                var labelScreen = new LabelListScreen(labelList);
                var navigation = new UINavigationController(labelScreen);
                NavigationController.PresentViewController(navigation, true, null);
            };
        }
		//
		// This method is invoked when the application has loaded and is ready to run. In this
		// method you should instantiate the window, load the UI into it and then make the window
		// visible.
		//
		// You have 17 seconds to return from this method, or iOS will terminate your application.
		//
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			fullPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "test.db");
			try
			{
				System.IO.Directory.CreateDirectory(fullPath);
				System.IO.Directory.Delete(fullPath);
			}
			catch
			{
			}


			serverURL = new EntryElement ("Server", "ZSS Server URL", "http://:8080");
			serverURL.KeyboardType = UIKeyboardType.Url;
			dbFileElement = new EntryElement ("DBFile", "", "");
			dbFileElement.AutocapitalizationType = UITextAutocapitalizationType.None;
			dbFileElement.AutocorrectionType = UITextAutocorrectionType.No;

			schemeElement = new EntryElement ("Scheme", "Auth Scheme", "");
			schemeElement.AutocapitalizationType = UITextAutocapitalizationType.None;
			schemeElement.AutocorrectionType = UITextAutocorrectionType.No;

			userElement = new EntryElement ("User", "User name", "");
			userElement.AutocapitalizationType = UITextAutocapitalizationType.None;
			userElement.AutocorrectionType = UITextAutocorrectionType.No;

			passElement = new EntryElement ("Password", "Password", "", true);
			passElement.AutocapitalizationType = UITextAutocapitalizationType.None;
			passElement.AutocorrectionType = UITextAutocorrectionType.No;

			authCheckboxElement = new CheckboxElement ("Send Auth Information", true);

			var syncButton = new StyledStringElement ("Sync", () => {
				SyncButtonClicked (authCheckboxElement.Value, serverURL.Value, dbFileElement.Value, schemeElement.Value, userElement.Value, passElement.Value);
			});
			syncButton.Alignment = UITextAlignment.Center;
			syncButton.BackgroundColor = UIColor.Orange;
			var authSection = new Section ("Authentication") {
				authCheckboxElement,
				schemeElement,
				userElement,
				passElement

			};
			root = new RootElement ("Sync") {
				new Section ("Server") {
					serverURL,
					dbFileElement
				},
				authSection,
				new Section ("") {
					syncButton
				}
			};
			root.UnevenRows = true;
			authCheckboxElement.Tapped += () => {
				if (authCheckboxElement.Value == false)
				{
					authSection.Remove(schemeElement);
					authSection.Remove(userElement);
					authSection.Remove(passElement);
				}
				else
				{
					authSection.Add(schemeElement);
					authSection.Add(userElement);
					authSection.Add(passElement);
				}
			};

			DialogViewController dvc = new DialogViewController (root);


			window.RootViewController = new UINavigationController(dvc);
			window.MakeKeyAndVisible ();
			LoadValues ();

			return true;
		}
		public CalloutViewCtrl () : base(null)
		{
			this.CentersCheck = new CheckboxElement[Centers.Length];
			for (int i = 0; i < Centers.Length; i++) {
				var tmp = new CheckboxElement (Centers[i]);
				this.CentersCheck [i] = tmp;
			}

			this.FirstName = new EntryElement ("First Name", "Rocky", KeyStore.Get ("FirstName")) {
				TextAlignment = UITextAlignment.Right
			};

			this.LastName = new EntryElement ("Last Name", "D. Bull", KeyStore.Get ("LastName")) {
				TextAlignment = UITextAlignment.Right
			};

			this.Email = new EntryElement ("E-Mail", "*****@*****.**", KeyStore.Get ("Email")) {
				TextAlignment = UITextAlignment.Right,
				KeyboardType = UIKeyboardType.EmailAddress
			};

			OptionGroup = new RadioGroup ("type", 0);
			Callout = new RadioElement ("Call-Out", "type");
			Inlate = new RadioElement ("In Late", "type");

			StartDate = new DateElement ("Out On", DateTime.Today) {
				Alignment = UITextAlignment.Right
			};

			MultipleDays = new BooleanElement ("Out Multiple Days", false);
			EndDate = new DateElement ("Back On", DateTime.Today.AddDays (1)) { Alignment = UITextAlignment.Right };

			WhenInDate = new DateTimeElement ("Will Be In", DateTime.Today.AddHours (12)) { Alignment = UITextAlignment.Right };

			Explaination = new EntryElement ("Explaination", "reasons.", null) { TextAlignment = UITextAlignment.Right };

			Section Name = new Section () { FirstName, LastName, Email };
			Section Options = new Section () { Callout, Inlate };

			Section CalloutDates = new Section () { StartDate, MultipleDays };
			MultipleDays.ValueChanged += (sender, e) => {
				if (MultipleDays.Value) {
					CalloutDates.Add(EndDate);
				} else {
					CalloutDates.Remove(EndDate);
				}
			};

			Section LateDay = new Section () { WhenInDate };
			Callout.Tapped += delegate {
				this.Root.RemoveAt(2);
				this.Root.Insert(2, CalloutDates);
			};

			Inlate.Tapped += delegate {
				this.Root.RemoveAt(2);
				this.Root.Insert(2, LateDay);
			};

			this.Submit = new StringElement ("Submit") { Alignment = UITextAlignment.Center };
			this.Root = new RootElement ("Call-Out", OptionGroup) { 
				Name,
				Options,
				CalloutDates,
				new Section("Centers") {
					this.CentersCheck
				},
				new Section() { Explaination },
				new Section() { Submit }
			};


			this.Submit.Tapped += Submit_Tapped;

			this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel, delegate {
				this.NavigationController.PopViewController(true);	
			});
		}
示例#5
0
        private void Delete(Element element, Section section)
        {
            var fileEl = element as FileElement;
            if (fileEl == null)
                return;

            var key = fileEl.Key;
            if (_originalGist.Files.ContainsKey(key))
                _model.Files[key] = null;
            else
                _model.Files.Remove(key);

            section.Remove(element);
        }