Exemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.RestrictRotation(UIInterfaceOrientationMask.Portrait);

            UINavigationBar.Appearance.TitleTextAttributes = new UIStringAttributes
            {
                ForegroundColor = UIColor.FromRGB(90, 89, 89)
            };

            TableView.RegisterClassForCellReuse(typeof(NotificationsTableViewCell), notificationCellId);
            TableView.SeparatorInset = new UIEdgeInsets(0, 10, 0, 10);

            notifications = new List <UserNotificationModel>();

            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += (sender, e) =>
            {
                refreshControl.BeginRefreshing();
                fetchNotifications();
            };

            TableView.Add(refreshControl);

            BTProgressHUD.Show(null, -1, ProgressHUD.MaskType.Clear);
            fetchNotifications();
        }
Exemplo n.º 2
0
 public void Add(ObjectVariants s, ObjectVariants p, ObjectVariants o)
 {
     if (s.Variant == ObjectVariantEnum.Iri)
     {
         s = _ng.GetUri(s.Content);
     }
     if (p.Variant == ObjectVariantEnum.Iri)
     {
         p = _ng.GetUri(p.Content);
     }
     if (o.Variant == ObjectVariantEnum.Iri)
     {
         o = _ng.GetUri(o.Content);
     }
     OnAddPortion(table.Add(new[] { new[] { s, p, o } }).ToArray());
 }
Exemplo n.º 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel = new ItemsViewModel();

            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ItemsDataSource(ViewModel);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged         += IsBusy_PropertyChanged;
            ViewModel.Items.CollectionChanged += Items_CollectionChanged;

            search = new UISearchController(searchResultsController: null)
            {
                DimsBackgroundDuringPresentation = false
            };

            search.SearchResultsUpdater = this;
            DefinesPresentationContext  = true;

            NavigationItem.SearchController = search;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            RefreshServerList();
            Title            = strings.selectServerTitle;
            TableView.Source = new TableSourceServerList(this);

            Globals.DefaultLightGray = TableView.BackgroundColor;

            // Fix the bottom position of the view, such that icons appear at same place when reloaded.
            bottomOfView = TableView.Bounds.Bottom;

            TableView.TableFooterView = GetTableViewFooter();
            // To be able to tap a row in editing mode for changing name
            TableView.AllowsSelectionDuringEditing = true;

            edit = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (s, e) =>
            {
                SetEditingState();
            });

            done = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) =>
            {
                CancelEditingState();
            });

            //Pull to refresh
            RefreshControl = new UIRefreshControl();
            RefreshControl.ValueChanged += RefreshTable;
            TableView.Add(RefreshControl);

            // Set right button initially to edit
            NavigationItem.RightBarButtonItem = edit;
        }
Exemplo n.º 5
0
        /// <summary>
        /// This method is called when the Devices main screen first appears and loads the header with the
        /// Speech Recognition icon, refreshes the devices list and sets the edit/done and settings buttons
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SpeechRecognition.RequestAuthorization();

            // Fix the bottom position of the view, such that icons appear at same place when reloaded.
            bottomOfView = TableView.Bounds.Bottom;

            DevicesTable.TableFooterView = GetTableViewFooter();
            RefreshDeviceList();
            // Set the light gray color in Globals, it is used in the Edit device (change name) screen
            Globals.DefaultLightGray = TableView.BackgroundColor;
            // To be able to tap a row in editing mode for changing name
            DevicesTable.AllowsSelectionDuringEditing = true;

            done = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => {
                CancelEditingState();
            });

            edit = new UIBarButtonItem(UIBarButtonSystemItem.Edit, (s, e) => {
                SetEditingState();
            });

            //Pull to refresh
            RefreshControl = new UIRefreshControl();
            RefreshControl.ValueChanged += RefreshTable;
            TableView.Add(RefreshControl);

            // Set right button initially to edit
            NavigationItem.LeftBarButtonItem  = edit;
            NavigationItem.RightBarButtonItem = SettingsButton;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel = new UsersViewModel();

            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ItemsDataSource(ViewModel);

            bbtnAddUser.TouchUpInside += (s, e) =>
            {
                NSObject sender = s as NSObject;
                this.PerformSegue("NavigateToNewItemSegue", s as NSObject);
            };

            Title = ViewModel.Title;

            ViewModel.PropertyChanged         += IsBusy_PropertyChanged;
            ViewModel.Users.CollectionChanged += Items_CollectionChanged;

            bbtnLogout.Clicked += (s, e) =>
            {
                NSObject sender = s as NSObject;
                this.PerformSegue("UsersToLogin", s as NSObject);
            };
        }
Exemplo n.º 7
0
        private void Initialize()
        {
            Window window = Window.Instance;

            window.BackgroundColor = Color.White;

            TableView contentLayout = new TableView(14, 1);

            contentLayout.Name = "ContentLayout";
            //contentLayout.WidthResizePolicy = ResizePolicyType.FillToParent;
            //contentLayout.HeightResizePolicy = ResizePolicyType.FillToParent;
            contentLayout.PivotPoint   = PivotPoint.TopLeft;
            contentLayout.ParentOrigin = ParentOrigin.TopLeft;
            contentLayout.Size2D       = new Vector2(window.Size.Width, window.Size.Height);
            contentLayout.SetCellPadding(new Size2D(5, 5));
            contentLayout.BackgroundColor = new Color(0.949f, 0.949f, 0.949f, 1.0f);

            window.Add(contentLayout);

            TextLabel title = new TextLabel("Contacts List with Visuals");

            title.Name                = "Title";
            title.StyleName           = "Title";
            title.WidthResizePolicy   = ResizePolicyType.FillToParent;
            title.HeightResizePolicy  = ResizePolicyType.UseNaturalSize;
            title.HorizontalAlignment = HorizontalAlignment.Center;
            contentLayout.Add(title);
            contentLayout.SetFitHeight(0);

            // Create ContactView(s) from ContactItem(s) in ContactsList and add them to TableView
            ContactView contactView;

            foreach (ContactItem contact in ContactsList.s_contactData)
            {
                contactView = new ContactView();
                contactView.WidthResizePolicy  = ResizePolicyType.FillToParent;
                contactView.HeightResizePolicy = ResizePolicyType.FillToParent;

                // Configure visuals of ContactView via properties
                contactView.NameField = contact.Name;
                contactView.MaskURL   = contact.MaskURL;
                contactView.ImageURL  = contact.ImageURL;
                contactView.Color     = contact.Color;
                contactView.Shape     = contact.Shape;
                contentLayout.Add(contactView);
            }
        }
Exemplo n.º 8
0
        public void Build(IEnumerable <Tuple <int, string, string> > tripleFlow)
        {
            table.Clear();
            table.Fill(new object[0]);

            File.Delete(predicatemappingPath);
            int portionConter = 0;

            object[] buffer = new object[portion];
            ps_index.index_arr.FillInit();
            po_index.index_arr.FillInit();
            TableRow[] tableRows;
            foreach (var triple in tripleFlow)
            {
                if (portionConter == portion)
                {
                    tableRows = table.Add(buffer).ToArray();
                    ps_index.index_arr.FillPortion(tableRows);
                    po_index.index_arr.FillPortion(tableRows);
                    Array.Clear(buffer, 0, portion);
                    portionConter = 0;
                }
                int pCode;
                if (!predicatemapping.TryGetValue(triple.Item2, out pCode))
                {
                    predicatemapping.Add(triple.Item2, pCode = predicatemapping.Count);
                }
                buffer[portionConter] = new object[] { triple.Item1, pCode, triple.Item3 };
                portionConter++;
            }
            tableRows = table.Add(buffer).ToArray();
            ps_index.index_arr.FillPortion(tableRows);
            po_index.index_arr.FillPortion(tableRows);
            table.TableCell.Flush();
            ps_index.index_arr.FillFinish();
            po_index.index_arr.FillFinish();
            ps_index.Build();
            po_index.Build();
            using (StreamWriter file = new StreamWriter(predicatemappingPath))
                foreach (var i in predicatemapping)
                {
                    file.WriteLine(i.Key);
                }
            po_index.CreateDiscaleDictionary();
            ps_index.CreateDiscaleDictionary();
        }
Exemplo n.º 9
0
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            await RefreshVehiclesListAsync();

            AddRefreshControl();
            if (useRefreshControl)
            {
                TableView.Add(RefreshControl);
            }
            isInitializing = false;
        }
Exemplo n.º 10
0
        private void BindUI()
        {
            ViewModel = new ReminderListsViewModel();

            Title = ViewModel.Title;

            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ReminderListTableDataSource(ViewModel);

            ViewModel.PropertyChanged += IsBusy_PropertyChanged;
            ViewModel.ReminderLists.CollectionChanged += Items_CollectionChanged;
        }
Exemplo n.º 11
0
        private DataRow GetDataRow([NotNull] TableIndexRow tableIndexRow,
                                   [NotNull] out string group)
        {
            TableView helper = _helpers[tableIndexRow.TableIndex];

            var result = Assert.NotNull(helper.Add(tableIndexRow.Row), "no dataRow");

            object value = result[_groupByColumn];

            group = value == null || value is DBNull
                                        ? string.Empty
                                        : value.ToString();

            return(result);
        }
Exemplo n.º 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ItemsDataSource(ViewModel);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged         += IsBusy_PropertyChanged;
            ViewModel.Items.CollectionChanged += Items_CollectionChanged;
        }
Exemplo n.º 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel = new ContactsViewModel();

            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ContactsListTableSource(ViewModel);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged += IsBusy_PropertyChanged;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            ViewModel = new GenreListViewModel();
            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new GenreDataSource(ViewModel);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged          += IsBusy_PropertyChanged;
            ViewModel.Genres.CollectionChanged += Items_CollectionChanged;
        }
Exemplo n.º 15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel = new ConfigViewModel();

            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.RegisterNibForCellReuse(UpdatedCell.Nib, UpdatedCell.Key);
            TableView.Source = new ConfigDataSource(ViewModel, this);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged += IsBusy_PropertyChanged;
        }
Exemplo n.º 16
0
        private static TableView CreateTableView([NotNull] string expression,
                                                 params IFeature[] features)
        {
            Assert.ArgumentCondition(features.Length > 0, "no feature");

            var table = (ITable)features[0].Class;

            const bool useAsConstraint = true;
            TableView  view            = TableViewFactory.Create(table, expression, useAsConstraint);

            foreach (IFeature feature in features)
            {
                view.Add(feature);
            }

            return(view);
        }
Exemplo n.º 17
0
        private object GetFieldExpressionValue([NotNull] NetElement netElement,
                                               int tableIndex)
        {
            IRow      row       = netElement.Row.Row;
            TableView tableView = _tableViews[tableIndex];

            DataRow helperRow = tableView.Add(row);

            Assert.NotNull(helperRow, "no row returned");

            var directedRow = netElement as DirectedRow;

            if (directedRow != null)
            {
                helperRow[QaConnections.StartsIn] = !directedRow.IsBackward;
            }

            return(helperRow[_expressionFieldName]);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            BtnCart.Hidden = true;
            var apiService     = ServiceLocator.Instance.Get <IApiService>();
            var productService = ServiceLocator.Instance.Get <IProductService>();
            var cartService    = ServiceLocator.Instance.Get <ICartService>();

            ViewModel = new MainViewModel(apiService, productService, cartService);
            Title     = ViewModel.Title;

            _refreshControl = new UIRefreshControl();
            _refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(_refreshControl);
            _itemsDataSource = new ItemsDataSource(ViewModel, TableView);
            TableView.Source = _itemsDataSource;

            ViewModel.Items.CollectionChanged += Items_CollectionChanged;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (ViewModel == null)
            {
                ViewModel = new ReminderListViewModel();
            }

            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new ReminderTableDataSource(ViewModel);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged             += IsBusy_PropertyChanged;
            ViewModel.Reminders.CollectionChanged += Items_CollectionChanged;
        }
Exemplo n.º 20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel = new ItemsViewModel();

            // Setup UITableView.
            refreshControl = new UIRefreshControl();
            refreshControl.ValueChanged += RefreshControl_ValueChanged;
            TableView.Add(refreshControl);
            TableView.Source = new BrowseDataSource(ViewModel, this);

            Title = ViewModel.Title;

            ViewModel.PropertyChanged         += IsBusy_PropertyChanged;
            ViewModel.Items.CollectionChanged += Items_CollectionChanged;


            var uibarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add, HandleEventHandler);

            NavigationItem.SetRightBarButtonItem(uibarButtonItem, true);
        }
Exemplo n.º 21
0
        private bool IsAllowedDangleCount(int tableIndex,
                                          [NotNull] FeatureDangleCount featureDangleCount,
                                          out string constraintValues)
        {
            if (_dangleCountExpressions == null)
            {
                _dangleCountExpressions = GetDangleCountExpressions(_polylineClasses,
                                                                    _dangleCountExpressionsSql);
            }

            TableView tableView = _dangleCountExpressions[tableIndex];

            tableView.ClearRows();
            DataRow dataRow = Assert.NotNull(tableView.Add(featureDangleCount.Feature));

            dataRow[_dangleCountPlaceHolder] = featureDangleCount.DanglingPointCount;

            bool       matchesConstraint = tableView.FilteredRowCount == 1;
            const bool constraintOnly    = true;

            if (matchesConstraint)
            {
                constraintValues = string.Empty;
            }
            else
            {
                var addedColumnNames = new SimpleSet <string>(
                    new[] { _dangleCountPlaceHolder },
                    StringComparer.InvariantCultureIgnoreCase);

                constraintValues = tableView.ToString(featureDangleCount.Feature,
                                                      constraintOnly,
                                                      addedColumnNames);
            }

            return(matchesConstraint);
        }
Exemplo n.º 22
0
        private bool HasPointsAndAllAreAllowed(
            [NotNull] IEnumerable <NetElement> connectedElements,
            [NotNull] out IList <NetElement> elementsToCheck,
            [NotNull] IList <TableView> allowedPointsTableViews)
        {
            var hasPoints        = false;
            var allPointsAllowed = true;

            elementsToCheck = new List <NetElement>();
            foreach (NetElement connectedElement in connectedElements)
            {
                TableIndexRow row        = connectedElement.Row;
                int           tableIndex = row.TableIndex;

                if (tableIndex < _pointClassesMinIndex)
                {
                    elementsToCheck.Add(connectedElement);
                    continue;
                }

                hasPoints = true;                 // found a point
                int       pointClassIndex        = row.TableIndex - _pointClassesMinIndex;
                TableView allowedPointsTableView = allowedPointsTableViews[pointClassIndex];
                allowedPointsTableView.ClearRows();
                allowedPointsTableView.Add(row.Row);

                if (!allowedPointsTableView.MatchesConstraint(row.Row))
                {
                    elementsToCheck.Add(connectedElement);
                    allPointsAllowed = false;                     // found an unallowed point
                }
            }

            // if there are any points, then they are all allowed by here.
            return(hasPoints && allPointsAllowed);
        }
Exemplo n.º 23
0
            private bool HandleAsFlat(NeighboredSegmentsSubpart segmentPart,
                                      double fullFraction,
                                      ContinuationFinder continuationFinder)
            {
                var p = new FeaturePoint(segmentPart.BaseFeature, segmentPart.TableIndex,
                                         segmentPart.PartIndex, fullFraction);

                List <NeighboredSegmentsSubpart> continuations =
                    continuationFinder.GetContinuations(p, new List <SegmentsSubpart>(), false);

                if (continuations == null)
                {
                    return(AdaptUnconnected);
                }

                var junctionSegments = new List <NeighboredSegmentsSubpart>();

                foreach (NeighboredSegmentsSubpart continuation in continuations)
                {
                    if (p.Feature == continuation.BaseFeature &&
                        p.TableIndex == continuation.TableIndex &&
                        p.Part == continuation.PartIndex &&
                        Math.Abs(p.FullFraction - continuation.FullStartFraction) < 0.01)
                    {
                        junctionSegments.Add(continuation);
                        continue;
                    }

                    if (NotReportedCondition != null &&
                        NotReportedCondition.IsFulfilled(segmentPart.BaseFeature,
                                                         segmentPart.TableIndex,
                                                         continuation.BaseFeature,
                                                         continuation.TableIndex))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(JunctionIsEndExpression))
                    {
                        return(false);
                    }

                    junctionSegments.Add(continuation);
                }

                if (junctionSegments.Count > 0)
                {
                    var rule = new QaConnectionRule(new[] { junctionSegments[0].BaseFeature.Table },
                                                    new List <string> {
                        JunctionIsEndExpression
                    });
                    TableView[] tableFilterHelpers;
                    IList <QaConnectionRuleHelper> helpers = QaConnectionRuleHelper.CreateList(
                        new[] { rule },
                        out
                        tableFilterHelpers);

                    foreach (NeighboredSegmentsSubpart junctionSegment in junctionSegments)
                    {
                        int tableIndex = junctionSegment.TableIndex;

                        TableView baseHelper = tableFilterHelpers[tableIndex];

                        DataRow helperRow = baseHelper.Add(junctionSegment.BaseFeature);
                        Assert.NotNull(helperRow, "no row returned");

                        {
                            helperRow[QaConnections.StartsIn] = segmentPart.FullStartFraction <
                                                                segmentPart.FullEndFraction;
                        }
                    }

                    foreach (QaConnectionRuleHelper ruleHelper in helpers)
                    {
                        // check if all rows comply to the current rule
                        int connectedElementsCount = junctionSegments.Count;
                        var matchingRowsCount      = 0;
                        for (var tableIndex = 0; tableIndex < 1; tableIndex++)
                        {
                            matchingRowsCount += ruleHelper
                                                 .MainRuleFilterHelpers[tableIndex]
                                                 .FilteredRowCount;
                        }

                        Assert.True(matchingRowsCount <= connectedElementsCount,
                                    "Unexpected matching rows count: {0}; total connected rows: {1}",
                                    matchingRowsCount, connectedElementsCount);

                        if (matchingRowsCount == connectedElementsCount &&
                            ruleHelper.VerifyCountRules())
                        {
                            // all rows comply to the current rule,
                            // so one rule if fulfilled and no further checking needed
                            return(true);
                        }
                    }
                }

                return(AdaptUnconnected);
            }
Exemplo n.º 24
0
        public void TestExpression()
        {
            const string intField    = "Int";
            const string doubleField = "Dbl";
            IFieldsEdit  fields      = new FieldsClass();

            fields.AddField(FieldUtils.CreateOIDField());
            fields.AddField(FieldUtils.CreateIntegerField(intField));
            fields.AddField(FieldUtils.CreateDoubleField(doubleField, doubleField));

            ITable tbl = DatasetUtils.CreateTable(_testWs, "TestExpression", null, fields);

            const int n = 10;

            for (var i = 0; i < n; i++)
            {
                IRow row = tbl.CreateRow();
                row.set_Value(1, i);
                row.set_Value(2, i);
                row.Store();
            }

            const double x               = 2;
            string       expression      = string.Format("{0}, {1}, {2}", x, intField, doubleField);
            const bool   useAsConstraint = false;
            TableView    view            = TableViewFactory.Create(tbl, expression, useAsConstraint);

            DataColumn constColumn = view.AddColumn("constValue", typeof(double));

            constColumn.Expression = x.ToString(CultureInfo.InvariantCulture);

            DataColumn intColumn = view.AddColumn("intValue", typeof(double));

            intColumn.Expression = intField;

            DataColumn exprColumn = view.AddColumn("exprValue", typeof(double));

            exprColumn.Expression = string.Format("2.3 * {0} + 1.2 * {1}", doubleField,
                                                  intField);

            DataColumn doubleColumn = view.AddColumn("doubleValue", typeof(double));

            doubleColumn.Expression = doubleField;

            foreach (IRow row in new EnumCursor(tbl, null, false))
            {
                view.ClearRows();
                var i = (int)row.Value[1];
                var d = (double)row.Value[2];

                DataRow expressionRow = Assert.NotNull(view.Add(row));

                var constVal = (double)expressionRow[constColumn.ColumnName];
                NUnit.Framework.Assert.AreEqual(x, constVal);

                var intVal = (double)expressionRow[intColumn.ColumnName];
                NUnit.Framework.Assert.AreEqual(i, intVal);

                var doubleVal = (double)expressionRow[doubleColumn.ColumnName];
                NUnit.Framework.Assert.AreEqual(d, doubleVal);

                var exprVal = (double)expressionRow[exprColumn.ColumnName];
                NUnit.Framework.Assert.AreEqual(2.3 * d + 1.2 * i, exprVal);
            }
        }
Exemplo n.º 25
0
        private int CheckRows([NotNull] IList <NetElement> connectedElements)
        {
            int tableCount = _tableFilterHelpers.Length;

            for (int i = 0; i < tableCount; i++)
            {
                _tableFilterHelpers[i].ClearRows();
            }

            int connectedElementsCount = connectedElements.Count;

            var connectedRows            = new List <IRow>(connectedElementsCount);
            var connectedRowTableIndices = new List <int>(connectedElementsCount);

            foreach (NetElement netElement in connectedElements)
            {
                TableIndexRow row = netElement.Row;

                connectedRows.Add(row.Row);

                int tableIndex = row.TableIndex;
                connectedRowTableIndices.Add(tableIndex);

                TableView baseHelper = _tableFilterHelpers[tableIndex];

                DataRow helperRow = baseHelper.Add(row.Row);
                Assert.NotNull(helperRow, "no row returned");

                if (netElement is DirectedRow)
                {
                    helperRow[StartsIn] = !((DirectedRow)netElement).IsBackward;
                }
            }

            bool fulfilledRuleFound = false;

            foreach (QaConnectionRuleHelper ruleHelper in _ruleHelpers)
            {
                // check if all rows comply to the current rule
                int matchingRowsCount = 0;
                for (int tableIndex = 0; tableIndex < tableCount; tableIndex++)
                {
                    matchingRowsCount += GetMatchingRowsCount(tableIndex, ruleHelper);
                }

                Assert.True(matchingRowsCount <= connectedElementsCount,
                            "Unexpected matching rows count: {0}; total connected rows: {1}",
                            matchingRowsCount, connectedElementsCount);

                if (matchingRowsCount == connectedElementsCount && ruleHelper.VerifyCountRules())
                {
                    // all rows comply to the current rule,
                    // so one rule if fulfilled and no further checking needed
                    fulfilledRuleFound = true;
                    break;
                }
            }

            if (fulfilledRuleFound)
            {
                // TODO apply further checks?
                return(NoError);
            }

            // no rule fulfills all the rows
            const string description = "Rows do not fulfill rules";

            return(ReportError(description, connectedElements[0].NetPoint,
                               Codes[Code.RulesNotFulfilled], null,
                               GetInvolvedRows(connectedRows)));
        }
Exemplo n.º 26
0
        public void Initialize()
        {
            Window window = Window.Instance;

            window.BackgroundColor = Color.White;

            TableView contentLayout = new TableView(4, 1);

            contentLayout.Name = ("ContentLayout");
            contentLayout.WidthResizePolicy  = ResizePolicyType.FillToParent;
            contentLayout.HeightResizePolicy = ResizePolicyType.FillToParent;

            contentLayout.SetCellPadding(new Size2D(0, 5));
            contentLayout.BackgroundColor = Color.Red;//new Color(0.949f, 0.949f, 0.949f, 1.0f);

            window.Add(contentLayout);

            _title                     = new TextLabel("Visuals Example");
            _title.Name                = "Title";
            _title.StyleName           = "Title";
            _title.WidthResizePolicy   = ResizePolicyType.FillToParent;
            _title.HeightResizePolicy  = ResizePolicyType.UseNaturalSize;
            _title.HorizontalAlignment = HorizontalAlignment.Center;
            _title.BackgroundColor     = Color.Yellow;
            contentLayout.Add(_title);
            contentLayout.SetFitHeight(0);

            // Color Visual example
            ImageView colorView = new ImageView();

            //colorView.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent;
            //colorView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
            // PropertyMap colorVisual = new PropertyMap();
            // colorVisual.Add( Visual.Property.Type, new PropertyValue( (int)Visual.Type.Color ))
            //            .Add( ColorVisualProperty.MixColor, new PropertyValue( Color.Green ));
            //colorView.Background = colorVisual;
            colorView.Size2D      = new Size2D(500, 200);
            colorView.ResourceUrl = resources + "/images/00_popup_bg.9.png";
            colorView.Border      = new Rectangle(100, 100, 100, 100);
            // colorView.
            // PropertyMap _map = new PropertyMap();
            // _map.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch));
            // _map.Add(NpatchImageVisualProperty.URL, new PropertyValue(resources+"/images/00_popup_bg.9.png"));
            // _map.Add(NpatchImageVisualProperty.Border, new PropertyValue(new Rectangle(100, 100, 100, 100)));
            //_map.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue(true));
            //colorView.Background = _map;
            contentLayout.Add(colorView);

            // Image Visual example
            View imageView = new View();

            imageView.WidthResizePolicy  = ResizePolicyType.UseNaturalSize;
            imageView.HeightResizePolicy = ResizePolicyType.UseNaturalSize;
            PropertyMap imageVisual = new PropertyMap();

            imageVisual.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
            imageVisual.Add(ImageVisualProperty.URL, new PropertyValue(resources + "/images/gallery-0.jpg"));
            imageView.Background = imageVisual;
            contentLayout.SetCellAlignment(new TableView.CellPosition(2, 0), HorizontalAlignmentType.Center, VerticalAlignmentType.Center);
            contentLayout.Add(imageView);
            for (int i = 1; i <= 5; i++)
            {
                PropertyMap imageVisual1 = new PropertyMap();
                imageVisual1.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image));
                imageVisual1.Add(ImageVisualProperty.URL, new PropertyValue(resources + "/images/gallery-" + i + ".jpg"));
                imageView.Background = imageVisual1;
            }

            // Primitive Visual example
            View primitiveView = new View();

            primitiveView.WidthResizePolicy  = ResizePolicyType.SizeRelativeToParent;
            primitiveView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
            PropertyMap primitiveVisual = new PropertyMap();

            primitiveVisual.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive))
            .Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)PrimitiveVisualShapeType.BevelledCube))
            .Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue(0.3f))
            .Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue(0.0f))
            .Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(new Vector3(1.0f, 1.0f, 0.3f)))
            .Add(PrimitiveVisualProperty.MixColor, new PropertyValue(new Vector4(0.7f, 0.5f, 0.05f, 1.0f)));
            primitiveView.Background = primitiveVisual;
            Radian rad = new Radian(new Degree(45.0f));

            primitiveView.Orientation = new Rotation(rad, Vector3.YAxis);
            contentLayout.Add(primitiveView);

            // Text Visual example
            View textView = new View();

            textView.WidthResizePolicy  = ResizePolicyType.SizeRelativeToParent;
            textView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent;
            PropertyMap textVisual = new PropertyMap();

            textVisual.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text))
            .Add(TextVisualProperty.Text, new PropertyValue("I am text visual"))
            .Add(TextVisualProperty.TextColor, new PropertyValue(Color.Blue))
            .Add(TextVisualProperty.PointSize, new PropertyValue(20));
            textView.Background = textVisual;
            contentLayout.Add(textView);
        }