本文整理汇总了C#中MonoTouch.Dialog.Section.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# Section.Insert方法的具体用法?C# Section.Insert怎么用?C# Section.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoTouch.Dialog.Section
的用法示例。
在下文中一共展示了Section.Insert方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DemoLoadMore
public void DemoLoadMore ()
{
Section loadMore = new Section();
loadMore.Add(new StringElement("Element 1"));
loadMore.Add(new StringElement("Element 2"));
loadMore.Add(new StringElement("Element 3"));
loadMore.Add (new LoadMoreElement("Load More Elements...", "Loading Elements...", lme => {
// Launch a thread to do some work
ThreadPool.QueueUserWorkItem (delegate {
// We just wait for 2 seconds.
System.Threading.Thread.Sleep(2000);
// Now make sure we invoke on the main thread the updates
navigation.BeginInvokeOnMainThread(delegate {
lme.Animating = false;
loadMore.Insert(loadMore.Count - 1, new StringElement("Element " + (loadMore.Count + 1)),
new StringElement("Element " + (loadMore.Count + 2)),
new StringElement("Element " + (loadMore.Count + 3)));
});
});
}, UIFont.BoldSystemFontOfSize(14.0f), UIColor.Blue));
var root = new RootElement("Load More") {
loadMore
};
var dvc = new DialogViewController (root, true);
navigation.PushViewController (dvc, true);
}
示例2: SearchMoreKeywords
private void SearchMoreKeywords(Section entries, CustomLoadMoreElement lme)
{
try
{
var images = SearchImages ();
_foundImages.AddRange(images);
int rowCount = 4;
var newElements = new List<Images2Element>();
for (int i = 0; i < images.Count; i += rowCount)
{
var imagesInfos = new List<ImageInfo>();
for (int j = 0; j < rowCount; j++)
{
var imgInfo = new ImageInfo()
{
Img = (i + j < images.Count) ? images[i + j] : null,
};
imagesInfos.Add(imgInfo);
}
newElements.Add(new Images2Element(imagesInfos, i));
}
InvokeOnMainThread(()=>
{
lme.Animating = false;
entries.Insert(entries.Count - 1, UITableViewRowAnimation.None, newElements.ToArray());
});
}
catch (Exception ex)
{
Util.LogException("SearchMoreKeywords", ex);
}
}
示例3: CreateRootElement
private RootElement CreateRootElement()
{
var captionLabel = UIHelper.CreateLabel (
"cross copy",
true,
32,
32,
UITextAlignment.Center,
UIColor.Black
);
UILabel subcaptionLabel = UIHelper.CreateLabel (
WELCOME_LABEL_TEXT,
false,
14,
85,
UITextAlignment.Center,
lightTextColor
);
subcaptionLabel.Tag = 3;
captionLabel.Frame = new Rectangle (0, 10, 320, 40);
subcaptionLabel.Frame = new Rectangle (20, 55, 280, 100);
UIView header = new UIView (new Rectangle (0, 0, 300, 145));
header.AddSubviews (captionLabel, subcaptionLabel);
var root = new RootElement ("Secrets")
{
new Section (header),
(secretsSection = new Section ("Secrets")),
new Section ()
{
(secretEntry = new AdvancedEntryElement ("Secret", "enter new phrase", "", null))
}
};
secretsSection.AddAll (from s in AppDelegate.HistoryData.Secrets select (Element)CreateImageButtonStringElement (s));
secretEntry.AutocapitalizationType = UITextAutocapitalizationType.None;
secretEntry.ShouldReturn += delegate {
if (String.IsNullOrEmpty (secretEntry.Value))
return false;
var newSecret = new Secret (secretEntry.Value);
AppDelegate.HistoryData.Secrets.Add (newSecret);
if (root.Count == 2)
root.Insert (1, secretsSection);
secretsSection.Insert (
secretsSection.Elements.Count,
UITableViewRowAnimation.Fade,
CreateImageButtonStringElement (newSecret)
);
secretEntry.Value = "";
secretEntry.ResignFirstResponder (false);
DisplaySecretDetail (newSecret);
return true;
};
secretEntry.ReturnKeyType = UIReturnKeyType.Go;
if (secretsSection.Count == 0) {
secretEntry.BecomeFirstResponder (true);
root.RemoveAt (1);
}
return root;
}
示例4: PopulateElements
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);
};
}
示例5: GetViewController
public UIViewController GetViewController ()
{
var menu = new RootElement ("Test Runner");
var runMode = new Section("Run Mode");
var interactiveCheckBox = new CheckboxElement("Enable Interactive Mode");
interactiveCheckBox.Tapped += () => GraphicsTestBase.ForceInteractiveMode = interactiveCheckBox.Value;
runMode.Add(interactiveCheckBox);
menu.Add(runMode);
Section main = new Section ("Loading test suites...");
menu.Add (main);
Section options = new Section () {
new StyledStringElement ("Options", Options) { Accessory = UITableViewCellAccessory.DisclosureIndicator },
new StyledStringElement ("Credits", Credits) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
};
menu.Add (options);
// large unit tests applications can take more time to initialize
// than what the iOS watchdog will allow them on devices
ThreadPool.QueueUserWorkItem (delegate {
foreach (Assembly assembly in assemblies)
Load (assembly, null);
window.InvokeOnMainThread (delegate {
while (suite.Tests.Count == 1 && (suite.Tests[0] is TestSuite))
suite = (TestSuite)suite.Tests[0];
foreach (TestSuite ts in suite.Tests) {
main.Add (Setup (ts));
}
mre.Set ();
main.Caption = null;
menu.Reload (main, UITableViewRowAnimation.Fade);
options.Insert (0, new StringElement ("Run Everything", Run));
menu.Reload (options, UITableViewRowAnimation.Fade);
});
assemblies.Clear ();
});
var dv = new DialogViewController (menu) { Autorotate = true };
// AutoStart running the tests (with either the supplied 'writer' or the options)
if (AutoStart) {
ThreadPool.QueueUserWorkItem (delegate {
mre.WaitOne ();
window.BeginInvokeOnMainThread (delegate {
Run ();
// optionally end the process, e.g. click "Touch.Unit" -> log tests results, return to springboard...
// http://stackoverflow.com/questions/1978695/uiapplication-sharedapplication-terminatewithsuccess-is-not-there
if (TerminateAfterExecution)
TerminateWithSuccess ();
});
});
}
return dv;
}
示例6: GetViewController
public UIViewController GetViewController ()
{
var menu = new RootElement ("Test Runner");
Section main = new Section ("Loading test suites...");
menu.Add (main);
Section options = new Section () {
new StyledStringElement ("Options", Options) { Accessory = UITableViewCellAccessory.DisclosureIndicator },
new StyledStringElement ("Credits", Credits) { Accessory = UITableViewCellAccessory.DisclosureIndicator }
};
menu.Add (options);
// large unit tests applications can take more time to initialize
// than what the iOS watchdog will allow them on devices, so loading
// must be done async.
ThreadPool.QueueUserWorkItem ((v) => {
LoadSync ();
ExecuteOnMainThread (() =>
{
foreach (TestSuite ts in Suite.Tests) {
main.Add (Setup (ts));
}
main.Caption = null;
menu.Reload (main, UITableViewRowAnimation.Fade);
options.Insert (0, new StringElement ("Run Everything", Run));
menu.Reload (options, UITableViewRowAnimation.Fade);
AutoRun ();
});
});
return new DialogViewController (menu) { Autorotate = true };
}
示例7: SetCaptionAndValue
void SetCaptionAndValue(Section section, int index, ref bool reload, string caption, string value)
{
if (index >= section.Count) {
section.Insert (index, UITableViewRowAnimation.None, new StringElement (caption, value));
reload = false;
} else {
StringElement element = section[index] as StringElement;
element.Caption = caption;
element.Value = value;
Root.Reload (element, UITableViewRowAnimation.None);
}
}
示例8: CreateLoadMore
private Element CreateLoadMore(Section section)
{
var loadMore2 = new AddLoadMoreWithImageElement("Add keyword", ImageStore.DefaultImage, lme => {
lme.FetchValue();
if (!string.IsNullOrWhiteSpace(lme.Value))
{
// Launch a thread to do some work
ThreadPool.QueueUserWorkItem (delegate {
try
{
var keyword = new Keyword()
{
Name = lme.Value,
ParentId = _ImageID,
//UserId = AppDelegateIPhone.AIphone.MainUser.Id,
//Time = DateTime.UtcNow,
};
// TODO : get the keyword id from the server. We need it
// TODO : for the deletion process
AppDelegateIPhone.AIphone.KeywServ.PutNewKeyword(keyword);
// Now make sure we invoke on the main thread the updates
this.BeginInvokeOnMainThread(delegate {
lme.Animating = false;
var act = new KeywordElement(keyword.Name, keyword);
section.Insert(1, act);
lme.Value = null;
});
}
catch (Exception ex)
{
Util.LogException("Add keyword", ex);
this.BeginInvokeOnMainThread(delegate {
lme.Animating = false;
});
}
});
}
else
lme.Animating = false;
});
return loadMore2;
}
示例9: CreateLoadMore
private AddLoadMoreElement CreateLoadMore(Section section)
{
var loadMore2 = new AddLoadMoreElement("New keyword", lme => {
lme.FetchValue();
if (!string.IsNullOrWhiteSpace(lme.Value))
{
ThreadPool.QueueUserWorkItem (delegate {
System.Threading.Thread.Sleep(200);
this.BeginInvokeOnMainThread(delegate {
lme.Animating = false;
section.Insert(1, new StringElement(lme.Value));
lme.Value = null;
});
});
}
else
lme.Animating = false;
});
return loadMore2;
}
示例10: AddNewCommentAsync
/// <summary>
/// Called only on user authentification
/// </summary>
private void AddNewCommentAsync(AddLoadMoreWithImageElement lme, Section section)
{
try
{
var comment = new Comment()
{
Name = lme.Value,
ParentId = _ImageID,
UserId = AppDelegateIPhone.AIphone.MainUser.Id,
Time = DateTime.UtcNow,
};
AppDelegateIPhone.AIphone.CommentServ.PutNewComment(comment);
// Now make sure we invoke on the main thread the updates
this.BeginInvokeOnMainThread(delegate {
lme.Animating = false;
var uicomment = new UIComment()
{
Comment = comment,
PhotoOwner = _photoOwner,
};
var act = new CommentElement(uicomment);
section.Insert(1, act);
lme.Value = null;
});
}
catch (Exception ex)
{
Util.LogException("Add comment", ex);
}
}