예제 #1
0
        private int add_lineBefore(int nr, int level, Boolean hasChildren, string name, string value, hmsspx.pageBase.knownPages nextPage, Type t, string url)
        {
            Boolean added    = false;
            entry   newEntry = new entry(level, hasChildren, name, value, nextPage, t, url);

            if (nr >= 0)
            {
                for (int e = 0; e < entryList.Count; e++)
                {
                    if (entryList[e].nr == nr)
                    {
                        entryList_Insert(e, newEntry);
                        added = true;
                        break;
                    }
                }
            }
            if (added == false)
            {
                entryList_Add(newEntry);
            }
            return(newEntry.nr);
        }
예제 #2
0
 private void entryList_Insert(int index, entry newEntry)
 {
     // Device.BeginInvokeOnMainThread(() => {
     entryList.Insert(index, newEntry);
     // });
 }
예제 #3
0
        private void Vc_Tapped(object sender, EventArgs e)
        {
            ViewCell    vcx      = (ViewCell)sender;
            StackLayout stackLoc = (StackLayout)vcx.View;

            stackLoc = (StackLayout)stackLoc.Children[0];

            Label nrLabel = (Label)stackLoc.Children[(int)line_part.nrLabel];

            int nr = -1;

            int.TryParse(nrLabel.Text, out nr);
            entry curEntry = this.getEntry(nr);

            footerText.Text = "";
            if (curEntry != null)
            {
                if (!string.IsNullOrEmpty(curEntry.url))
                {
                    footerText.Text = curEntry.url;
                }
                else if (!string.IsNullOrEmpty(curEntry.value))
                {
                    footerText.Text = curEntry.value;
                }
            }
#if false
            if (curEntry.nextPage != hmsspx.pageBase.knownPages.NONE)
            {
                Type t = Type.GetType("hmsspx." + curEntry.nextPage.ToString());
                if (t != null)
                {
                    this.cancelRunningTask();
                    object[] args  = { true, curEntry.url, lblTitle.Text };
                    var      myObj = (pageBase)Activator.CreateInstance(t, args);
                    Navigation.PushAsync(myObj);
                }
            }
            else if (curEntry.hasChildren == true && curEntry.isExpanded == false)
            {
                curEntry.isExpanded = true;

                if (curEntry.isDeferred == true)
                {
                    if (this.runningTask == false)
                    {
                        this.add_ObjAt(nr, curEntry.level + 1, curEntry.t, curEntry.url);
                    }
                    else
                    {
                        this.cancelRunningTask();
                    }
                }
                else
                {
                    this.cancelRunningTask();
                    this.add_lineAt(nr, curEntry.level + 1, false, "web", nrLabel.Text.ToString(), hmsspx.pageBase.knownPages.NONE, "");
                }
            }
            else
            {
            }
#endif
        }
예제 #4
0
 private void entryList_Add(entry newEntry)
 {
     // Device.BeginInvokeOnMainThread(() => {
     entryList.Add(newEntry);
     //});
 }
예제 #5
0
        private void Vc_IconTapped(object sender, EventArgs e)
        {
            Image icon = (Image)sender;

            StackLayout stackLoc = (StackLayout)icon.Parent;

            Label nrLabel = (Label)stackLoc.Children[(int)line_part.nrLabel];

            int nr = -1;

            int.TryParse(nrLabel.Text, out nr);
            entry curEntry = this.getEntry(nr);

            if (curEntry.nextPage != hmsspx.pageBase.knownPages.NONE)
            {
                Type t = Type.GetType("hmsspx." + curEntry.nextPage.ToString());
                if (t != null)
                {
                    this.cancelRunningTask();
                    object[] args  = { true, curEntry.url, lblTitle.Text };
                    var      myObj = (pageBase)Activator.CreateInstance(t, args);
                    Navigation.PushAsync(myObj);
                }
            }
            else if (curEntry.hasChildren == true)
            {
                if (curEntry.isExpanded == false)
                {
                    curEntry.isExpanded = true;
                    if (curEntry.children != null)
                    {
                        // add all children back to the list
                        int eIndex = this.getEntryIndex(curEntry.nr);
                        for (int i = curEntry.children.Count - 1; i >= 0; i--)
                        {
                            entryList_Insert(eIndex + 1, curEntry.children[i]);
                        }
                        curEntry.children = null;
                    }
                    else
                    {
                        if (curEntry.isDeferred == true)
                        {
                            if (this.runningTask == false)
                            {
                                this.add_ObjAt(nr, curEntry.level + 1, curEntry.t, curEntry.url);
                            }
                            else
                            {
                                this.cancelRunningTask();
                            }
                        }
                        else
                        {
                            this.cancelRunningTask();
                            this.add_lineAt(nr, curEntry.level + 1, false, "unset", nrLabel.Text.ToString(), hmsspx.pageBase.knownPages.NONE, "");
                        }
                    }
                }
                else
                {
                    // push all following entries into the children list
                    int level  = curEntry.level;
                    int eIndex = this.getEntryIndex(curEntry.nr);
                    int i      = eIndex + 1;
                    curEntry.children = new List <entry>();
                    while (i < entryList.Count)
                    {
                        if (entryList[i].level <= level)
                        {
                            break;
                        }
                        curEntry.children.Add(entryList[i]);
                        entryList.RemoveAt(i);
                    }
                    if (curEntry.children.Count == 0)
                    {
                        curEntry.children = null;
                    }


                    curEntry.isExpanded = false;
                }
            }
            else
            {
            }
        }