예제 #1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                if (_formsCell != null)
                {
                    _formsCell.PropertyChanged -= CellPropertyChanged;
                }

                CustomCell = null;

                _heightConstraint?.Dispose();
                _heightConstraint = null;

                IVisualElementRenderer renderer = null;
                if (_rendererRef != null && _rendererRef.TryGetTarget(out renderer) && renderer.Element != null)
                {
                    FormsInternals.DisposeModelAndChildrenRenderers(renderer.Element);
                    _rendererRef = null;
                }

                renderer?.Dispose();

                _formsCell = null;
            }

            _disposed = true;

            base.Dispose(disposing);
        }
예제 #2
0
        private void InitializeResultExplorer()
        {
            var openCell = new CustomCell
            {
                CreateCell = e => new LinkButton
                {
                    Text    = "Open",
                    Command = new Command((_, __) => HandleOpenItem(e.Item))
                }
            };

            var columns = new[]
            {
                new GridColumn {
                    HeaderText = "Select", DataCell = new CheckBoxCell(0), Editable = true
                },
                new GridColumn {
                    HeaderText = "Open", DataCell = openCell
                },
                new GridColumn {
                    HeaderText = "Matches", DataCell = new TextBoxCell(2)
                },
                new GridColumn {
                    HeaderText = "Path", DataCell = new TextBoxCell(3)
                },
            };

            Array.ForEach(columns, tvwResultExplorer.Columns.Add);
            tvwResultExplorer.AllowMultipleSelection = false;
            tvwResultExplorer.DataStore = _itemCollection;
        }
예제 #3
0
        public void CustomCellOnSeparateTabLoadIssue()
        {
            TabControl tabs = null;

            Shown(form =>
            {
                var grid1 = new GridView {
                    ShowHeader = false
                };
                grid1.Columns.Add(new GridColumn {
                    DataCell = CustomCell.Create <MyCustomCell>()
                });
                grid1.DataStore = new List <MyModel>
                {
                    new MyModel {
                        Text = "Item 1"
                    },
                    new MyModel {
                        Text = "Item 2"
                    },
                    new MyModel {
                        Text = "Item 3"
                    },
                };

                var grid2 = new GridView {
                    ShowHeader = false
                };
                grid2.Columns.Add(new GridColumn {
                    DataCell = CustomCell.Create <MyCustomCell>()
                });
                grid2.DataStore = new List <MyModel>
                {
                    new MyModel {
                        Text = "Item 1"
                    },
                    new MyModel {
                        Text = "Item 2"
                    },
                    new MyModel {
                        Text = "Item 3"
                    },
                };

                tabs = new TabControl();
                tabs.Pages.Add(new TabPage(grid1)
                {
                    Text = "Tab 1"
                });
                tabs.Pages.Add(new TabPage(grid2)
                {
                    Text = "Tab 2"
                });
                form.Content = tabs;
            }, () =>
            {
                tabs.SelectedIndex = 1;
            });
        }
        private CustomCell GetCell(Func <ArrDep, TimeSpan> time, Station sta, bool arrival, GridView view)
        {
            var cc = new CustomCell
            {
                CreateCell    = args => new TextBox(),
                ConfigureCell = (args, control) =>
                {
                    var tb   = (TextBox)control;
                    var data = (DataElement)args.Item;

                    if (data == null)
                    {
                        tb.Visible = false;
                        return;
                    }

                    new TimetableCellRenderProperties(time, sta, arrival, data).Apply(tb);

                    Action tbEnterEditMode = new Action(() =>
                    {
                        CellSelected(data, sta, arrival);
                        data.IsSelectedArrival = arrival;
                        data.SelectedStation   = sta;
                        data.SelectedTextBox   = tb;
                        focused = view;
                    });

                    if (mpmode)
                    {
                        tb.KeyDown += (s, e) => HandleKeystroke(e, focused);

                        // Wir gehen hier gleich in den vollen EditMode rein
                        tb.CaretIndex = 0;
                        tb.SelectAll();
                        tbEnterEditMode();
                    }

                    tb.GotFocus  += (s, e) => tbEnterEditMode();
                    tb.LostFocus += (s, e) => { FormatCell(data, sta, arrival, tb); new TimetableCellRenderProperties(time, sta, arrival, data).Apply(tb); };
                }
            };

            cc.Paint += (s, e) =>
            {
                if (!mpmode)
                {
                    return;
                }

                var data = (DataElement)e.Item;
                if (data == null)
                {
                    return;
                }

                new TimetableCellRenderProperties(time, sta, arrival, data).Render(e.Graphics, e.ClipRectangle);
            };
            return(cc);
        }
예제 #5
0
        public override void AccessoryButtonTapped(UITableView tableView, NSIndexPath indexPath)
        {
            // called when the accessory view (disclosure button) is touched
            CustomCell cell = (CustomCell)tableView.CellAt(indexPath);

            AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate;

            appDelegate.ShowDetail(cell);
        }
예제 #6
0
        public char[,] BacktrackVisitedPath(int endx, int endy, int size, char startgoal, char[,] maze, int[,] backtrackmap, int count)
        {
            Queue <CustomCell> myqueue = new Queue <CustomCell>();
            //start of the maze
            CustomCell cell = new CustomCell(endx, endy, count);

            myqueue.Enqueue(cell);
            int        counter = 0;
            CustomCell parent  = null;

            while (myqueue.Count != 0)
            {
                parent  = myqueue.Dequeue();
                counter = parent.Count;

                //Now we need to find the children for this parent and add to the queue
                counter = counter - 1;
                //The robot can move in any direction..
                //Find out all the direction it can move

                //Move north  (y-1,x) and other direction
                Point[] directions = new Point[4];
                Point   north      = new Point(parent.XAxis - 1, parent.YAxis);
                Point   south      = new Point(parent.XAxis + 1, parent.YAxis);
                Point   east       = new Point(parent.XAxis, parent.YAxis + 1);
                Point   west       = new Point(parent.XAxis, parent.YAxis - 1);
                directions[0] = north;
                directions[1] = south;
                directions[2] = east;
                directions[3] = west;

                for (int i = 0; i < directions.Length; i++)
                {
                    int x = directions[i].xAxis;
                    int y = directions[i].yAxis;
                    if (CanMoveForBacktrack(x, y, size, backtrackmap, counter))
                    {
                        if (maze[y, x] == startgoal)
                        {
                            return(maze);
                        }
                        //possible move
                        myqueue.Enqueue(new CustomCell(x, y, counter));

                        //mark visited
                        maze[y, x] = '@';
                    }
                }
            }


            //The code will come here after finding the goal
            //use the backtrack map to find the path
            //if no goal is found
            return(maze);
        }
 void OnItemSelected(object sender, System.EventArgs e)
 {
     if (SelectionGroup.SelectedItem != null)
     {
         CustomCell temp = (CustomCell)SelectionGroup.SelectedItem;
         //DisplayAlert("OnItemSelected", temp.Title, "OK");
         viewModel.SelectedClass = temp;
         // save the Class option
     }
 }
 private async Task LoadRestoransAsync() {
     restorans = (await DataSource.GetRestoransAsync()).ToList();
     listView = new ListView(ListViewCachingStrategy.RecycleElement) {
         ItemsSource = restorans,
         ItemTemplate = new DataTemplate(() => {
             var nativeCell = new CustomCell();
             return nativeCell;
         })
     };
 }
예제 #9
0
        public override bool RowLongPressed(UITableView tableView, NSIndexPath indexPath)
        {
            if (CustomCell.LongCommand == null)
            {
                return(false);
            }

            CustomCell.SendLongCommand();

            return(true);
        }
예제 #10
0
 void OnItemSelectSelected(object sender, System.EventArgs e)
 {
     if (SelectedLanguages.SelectedItem != null)
     {
         PossibleLanguages.SelectedItem = null;
         CustomCell temp = (CustomCell)SelectedLanguages.SelectedItem;
         //DisplayAlert("OnItemSelected", temp.Title, "OK");
         viewModel.SelectedLanguage = temp;
         // save the Class option
     }
 }
예제 #11
0
 void OnItemPossibleSelected(object sender, System.EventArgs e)
 {
     if (PossibleFeats.SelectedItem != null)
     {
         SelectedFeats.SelectedItem = null;
         CustomCell temp = (CustomCell)PossibleFeats.SelectedItem;
         //DisplayAlert("OnItemSelected", temp.Title, "OK");
         viewModel.PossibleFeatSelected = temp;
         // save the Class option
     }
 }
예제 #12
0
                #pragma warning disable CS0414

        public CustomSearchTextField(ITextEntryEventSink eventSink, ApplicationContext context)
        {
            this.context   = context;
            this.eventSink = eventSink;
            this.Cell      = cell = new CustomCell
            {
                Bezeled   = true,
                Editable  = true,
                EventSink = eventSink,
                Context   = context,
            };
        }
 public MenuPage(string masa)
 {
     this.restorans = LoadRestorans().GetAwaiter().GetResult().ToList();
     listView       = new ListView(ListViewCachingStrategy.RecycleElement)
     {
         ItemsSource  = this.restorans,
         ItemTemplate = new DataTemplate(() => {
             var nativeCell = new CustomCell();
             return(nativeCell);
         })
     };
 }
예제 #14
0
 public void MoveToPossible(CustomCell cell)
 {
     for (int i = 0; i < SelectedFeats.Count; i++)
     {
         if (cell.Equals(SelectedFeats[i]))
         {
             PossibleFeats.Add(cell);
             SelectedFeats.Remove(cell);
             FeatsLeft += 1;
         }
     }
 }
예제 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            //http://stackoverflow.com/questions/10099221/breadth-first-search-on-an-8x8-grid-in-java

            char[,] maze = new char[, ] {
                { 'S', '#', '#', '#', '#', '#' },
                { '.', '.', '.', '.', '.', '#' },
                { '#', '.', '#', '#', '#', '#' },
                { '#', '.', '#', '#', '#', '#' },
                { '.', '.', '.', '#', '.', 'G' },
                { '#', '#', '.', '.', '.', '#' }
            };


            //Updated
            int[,] backtrackmap = new int[maze.GetLength(0), maze.GetLength(1)];

            CustomCell goalposition = BreadthFirstSearchIn2DArray(0, 0, maze.GetLength(0), 'G', maze, backtrackmap);

            //backtrack will have counter in the position..

            //track from the goal position to the starting and mark the path visited
            char[,] result = BacktrackVisitedPath(goalposition.XAxis, goalposition.YAxis, maze.GetLength(0), 'S', maze, backtrackmap, goalposition.Count);


            //Here is the logic
            //1) Build a graph with only the possible routes by ignoring the obstacle
            //2) Breath-First-Search of the graph and find the shorest route..while finding the route..mark the shortest node path
            //3) Loop through the shortest path (marked on the graph) and update the 2d martix for the found path with the help of co-ordinates on the graph node


            //build a graph
            //KarthicGraph<Char> mazegraph = new KarthicGraph<char>();
            //GraphNode<char> root = new GraphNode<char>('&');
            //mazegraph.AddNode(root);

            //mazegraph.Root = new GraphNode<char>(maze[0, 0]);
            //BuildGraph(0, 0, maze.GetLength(0), 'G', maze, root, mazegraph);

            //The Graph is build with all the possible '.'
            //find the shortest route from the graph

            //GraphNode<char> startpoint = mazegraph.FindNodeByValue('S');
            //GraphNode<char> endpoint = mazegraph.FindNodeByValue('G');

            //StringBuilder sb = new StringBuilder();

            //The shortest distance will be found here and the correspoding co-ordinates will have marked set
            //string route = BreadthFirstSearchFindRoute(startpoint, endpoint, sb);

            //loop throught the graph and get the marked path and set the correspinding two d matrix path with a special character
        }
        public bool CheckInStarting(CustomCell cell)
        {
            bool check = true;

            for (int j = 0; j < StartingLanguages.Count; j++)
            {
                if (cell.Title == StartingLanguages[j].Title)
                {
                    check = false;
                }
            }
            return(check);
        }
예제 #17
0
    protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
    {
        CustomCell cell = (CustomCell)item;

        if (cell.Testo.Length > 5)
        {
            return(ComplexTemplate);
        }
        else
        {
            return(SimpleTemplate);
        }
    }
예제 #18
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = (CustomCell)tableView.DequeueReusableCell(this.MovieListCellId);

            if (cell == null)
            {
                cell = new CustomCell((NSString)this.MovieListCellId);
            }
            int row = indexPath.Row;

            cell.UpdateCell(this._movielist[row]);

            return(cell);
        }
 public CustomTextField(ITextEntryEventSink eventSink, ApplicationContext context)
 {
     this.context   = context;
     this.eventSink = eventSink;
     this.Cell      = cell = new CustomCell {
         BezelStyle      = NSTextFieldBezelStyle.Square,
         Bezeled         = true,
         DrawsBackground = true,
         BackgroundColor = NSColor.White,
         Editable        = true,
         EventSink       = eventSink,
         Context         = context,
     };
 }
예제 #20
0
        public MainPage()
        {
            InitializeComponent();

            var listView = new MyListView();

            List <ListData> data = new List <ListData>
            {
                new ListData {
                    title = "Title 1", subtitle = "Subtitle 1"
                },
                new ListData {
                    title = "Title 2", subtitle = "Subtitle 2"
                },
                new ListData {
                    title = "Title 3", subtitle = "Subtitle 3"
                }
            };

            listView.ItemsSource = data;

            listView.ItemSelected += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
            };

            listView.ItemTapped += (sender, e) => {
                Cell itemCell = ((MyListView)sender).GetTemplatedItem(e.Item);

                if (itemCell is CustomCell)
                {
                    CustomCell cc = (CustomCell)itemCell;
                    if (cc.cb.Checked)
                    {
                        cc.cb.Checked = false;
                    }
                    else
                    {
                        cc.cb.Checked = true;
                    }
                }
            };

            listView.ItemTemplate = new DataTemplate(typeof(CustomCell));

            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { listView }
            };
        }
예제 #21
0
            protected override void SetupContent(Cell content, int index)
            {
                base.SetupContent(content, index);
                CustomCell currentViewCell = content as CustomCell;

                if (currentViewCell != null)
                {
                    currentViewCell.View.BackgroundColor = index % 2 == 0
                        ? Color.Aqua
                        : Color.White;
                    currentViewCell.SetupFriend(_repo.ReadAll()[index]);
                    currentViewCell.Tapped += (sender, args) => CurrentViewCellOnTapped(_repo.ReadAll()[index].Id);
                }
            }
예제 #22
0
 public void MoveToSelected(CustomCell cell)
 {
     if (FeatsLeft > 0)
     {
         for (int i = 0; i < PossibleFeats.Count; i++)
         {
             if (cell.Equals(PossibleFeats[i]))
             {
                 PossibleFeats.Remove(cell);
                 SelectedFeats.Add(cell);
             }
         }
         FeatsLeft -= 1;
     }
 }
예제 #23
0
    public void ShowDetail(CustomCell cell)
    {
        // make the image frame size the same as the image size
        UIImage checkedImage = UIImage.FromFile ("checked.png");

        RectangleF finalFrame = detailViewController.checkedImage.Frame;
        finalFrame.Width = checkedImage.Size.Width;
        finalFrame.Height = checkedImage.Size.Height;
        detailViewController.checkedImage.Frame = finalFrame;

        detailViewController.itemTitle.Text = cell.Title;
        detailViewController.checkedImage.Image = cell.Checked ? checkedImage : UIImage.FromFile ("unchecked.png");

        this.navController.PushViewController(detailViewController, true);
    }
예제 #24
0
    bool thisGridAdyacente(CustomCell cell, List <CustomCell> grid)
    {
        for (int i = 0; i < grid.Count; i++)
        {
            if (cell.p1 == grid[i].p1 | cell.p1 == grid[i].p2 | cell.p1 == grid[i].p3 | cell.p1 == grid[i].p4 |
                cell.p2 == grid[i].p1 | cell.p2 == grid[i].p2 | cell.p2 == grid[i].p3 | cell.p2 == grid[i].p4 |
                cell.p3 == grid[i].p1 | cell.p3 == grid[i].p2 | cell.p3 == grid[i].p3 | cell.p3 == grid[i].p4 |
                cell.p4 == grid[i].p1 | cell.p4 == grid[i].p2 | cell.p4 == grid[i].p3 | cell.p4 == grid[i].p4)
            {
                return(true);
            }
        }

        return(false);
    }
예제 #25
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = (CustomCell)tableView.DequeueReusableCell(this.NameListCellId);

            if (cell == null)
            {
                cell = new CustomCell((NSString)this.NameListCellId);
            }

            int row = indexPath.Row;

            cell.UpdateCell(this._personList[row].Name, this._personList[row].BirthYear.ToString(), this._personList[row].ImageName);

            return(cell);
        }
예제 #26
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            var cell = (CustomCell)tableView.DequeueReusableCell(MovieListCellId);
            if (cell == null)
            {
                cell = new CustomCell(this.MovieListCellId);
            }

            int row = indexPath.Row;

			string titleyear = this._movieList[row].Title + " (" + this._movieList[row].Year + ")";

			cell.UpdateCell(this._movieList[row].Poster, titleyear, this._movieList[row].Cast);
            return cell;
        }
 public void MoveToSelected(CustomCell cell)
 {
     if (LanguagesLeft > 0)
     {
         for (int i = 0; i < PossibleLanguages.Count; i++)
         {
             if (cell.Equals(PossibleLanguages[i]))
             {
                 PossibleLanguages.Remove(cell);
                 SelectedLanguages.Add(cell);
             }
         }
         LanguagesLeft -= 1;
     }
 }
 public void MoveToPossible(CustomCell cell)
 {
     for (int i = 0; i < SelectedLanguages.Count; i++)
     {
         if (cell.Equals(SelectedLanguages[i]))
         {
             if (CheckInStarting(cell))
             {
                 PossibleLanguages.Add(cell);
                 SelectedLanguages.Remove(cell);
                 LanguagesLeft += 1;
             }
         }
     }
 }
예제 #29
0
    public void ShowDetail(CustomCell cell)
    {
        // make the image frame size the same as the image size
        UIImage checkedImage = UIImage.FromFile("checked.png");

        RectangleF finalFrame = detailViewController.checkedImage.Frame;

        finalFrame.Width  = checkedImage.Size.Width;
        finalFrame.Height = checkedImage.Size.Height;
        detailViewController.checkedImage.Frame = finalFrame;

        detailViewController.itemTitle.Text     = cell.Title;
        detailViewController.checkedImage.Image = cell.Checked ? checkedImage : UIImage.FromFile("unchecked.png");

        this.navController.PushViewController(detailViewController, true);
    }
예제 #30
0
        protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
        {
            CustomCell cell = (CustomCell)item;

            switch (cell.TipoHoja)
            {
            case 1:
                return(AddJobTemplate);

            case 2:
                return(AddJobDetailTemplate);

            default:
                return(AddJobTemplate);
            }
        }
예제 #31
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            // find the cell being touched and update its checked/unchecked image
            CustomCell targetCustomCell = (CustomCell)tableView.CellAt(indexPath);

            targetCustomCell.CheckButtonTouchDown(null, null);

            // don't keep the table selection
            tableView.DeselectRow(indexPath, true);

            /*
             *              // update our data source array with the new checked state
             *              targetCustomCell.Checked = !targetCustomCell.Checked;
             *              UIImage checkImage = targetCustomCell.Checked ? UIImage.FromFile("checked.png") : UIImage.FromFile("unchecked.png");
             *              targetCustomCell.CheckButton.SetImage(checkImage, UIControlState.Normal);
             */
        }
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            const string kCustomCellID = "MyCellID";

            CustomCell cell = (CustomCell)tableView.DequeueReusableCell(kCustomCellID);

            if (cell == null)
            {
                System.Console.WriteLine(indexPath.Row);
                cell = new CustomCell(UITableViewCellStyle.Default, kCustomCellID);
            }

            Item item = this.ctvc.Data[indexPath.Row];
            cell.Title = item.Title;
            cell.TextLabel.Text = item.Title;
            cell.Checked = item.Checked;

            return cell;
        }