Example #1
0
 private static void OrderIssues(ListHolder <IssueBase> appIssues)
 {
     //PLEASE DO NOT CHANGE THIS WITHOUT DISCUSSIONss
     appIssues.List = appIssues.List
                      .OrderByDescending(i => i.LastRuleAdjustmentUtc ?? DateTime.MinValue)
                      .ToList();
 }
Example #2
0
        protected virtual ListHolder CreateHolder()
        {
            ListHolder lh = new ListHolder("h1");

            lh.SetList(new ArrayList());
            return(lh);
        }
Example #3
0
        public void Mesh1()
        {
            var a = new ListHolder <double> {
                List = Lists.Create(1.0, 2, 4, 5, 6, 7, 8, 9)
            };
            var b = new ListHolder <double> {
                List = Lists.Create(1.1, 2.1, 3.1)
            };
            var c = new ListHolder <double> {
                List = Lists.Create(3.2, 4.2, 5.2, 6.2)
            };
            var d = new ListHolder <double> {
                List = Lists.Create(4.3, 5.3)
            };
            var e = new ListHolder <double> {
                List = Lists.Create(8.4, 9.4)
            };
            //var a = Lists.Create(1.0, 2, 3, 4, 5, 6, 7, 8, 9);
            //var b = Lists.Create(1.1, 2.1, 3.1);
            //var c = Lists.Create(3.2, 4.2, 5.2, 6.2);
            //var d = Lists.Create(4.3, 5.3);
            //var e = Lists.Create(8.4, 9.4);

            var m  = Lists.Mesh(Lists.Create(a, b, c, d, e), x => x.List, n => (int)n, i => i + 1, (dummy, xs) => new List <double>(xs)).ToList();
            var m2 = Lists.Mesh(Lists.Create(b, e), x => x.List, n => (int)n, i => i + 1, (dummy, xs) => new List <double>(xs)).ToList();
        }
    // Use this for initialization
    void Start()
    {
        outputText = GameObject.Find("output").GetComponent <Text>();
        indexField = GameObject.Find("IndexField").GetComponent <InputField>();
        valueField = GameObject.Find("ValueField").GetComponent <InputField>();


        listHolder = new ListHolder(null, unitSize);
    }
Example #5
0
 /// <exception cref="System.Exception"></exception>
 protected override void Store()
 {
     var holder = new ListHolder();
     holder._list = new ArrayList();
     var parent = new Parent();
     holder._list.Add(parent);
     parent._child = new Child();
     parent._child._name = "child";
     Store(holder);
 }
Example #6
0
        public void SerializeAndDeserializeNormal()
        {
            var test = new ListHolder()
            {
                new ListItem()
            };
            var xml = XmlSerializer <ListHolder> .New().SerializeToString(test);

            var obj = XmlSerializer <ListHolder> .New().Deserialize(xml);

            Assert.IsTrue(obj.Count == 1, "List should contain one element");
        }
Example #7
0
        // Are lists referenced or duplicated? The answer: they are referenced
        public void TestListReferencing()
        {
            List <string> list = new List <string>()
            {
                "hello"
            };
            ListHolder holder = new ListHolder(list);

            Assert.AreEqual(1, holder.List.Count);
            list.Add("World");
            Assert.AreEqual(2, holder.List.Count);
        }
Example #8
0
    private void SavePlayedLevels()
    {
        ListHolder listHolder = new ListHolder();

        listHolder.list = _finishedLevels;

        string json = JsonUtility.ToJson(listHolder);

        PlayerPrefs.SetString("finished_levels", json);

        Debug.Log("save levels " + json);
    }
Example #9
0
        private void StoreListToProviderA()
        {
            ListHolder  lh  = CreateHolder();
            ListContent lc1 = new ListContent("c1");
            ListContent lc2 = new ListContent("c2");

            lh.Add(lc1);
            lh.Add(lc2);
            A().Provider().StoreNew(lh);
            A().Provider().Commit();
            EnsureContent(A(), new string[] { "h1" }, new string[] { "c1", "c2" });
        }
Example #10
0
        /// <exception cref="System.Exception"></exception>
        protected override void Store()
        {
            var holder = new ListHolder();

            holder._list = new ArrayList();
            var parent = new Parent();

            holder._list.Add(parent);
            parent._child       = new Child();
            parent._child._name = "child";
            Store(holder);
        }
Example #11
0
        private void CreateNotification()
        {
            ListHolder <int> notificationIdCollection = new ListHolder <int>();

            foreach (var dateNotification in _notificationCollection)
            {
                notificationIdCollection.Values.Add(CreateNotification(dateNotification));
            }

            PlayerPrefs.SetString(_keyNotification, JsonUtility.ToJson(notificationIdCollection));
            PlayerPrefs.Save();
        }
Example #12
0
        private void RemoveSavedNotification()
        {
            if (PlayerPrefs.HasKey(_keyNotification) == false)
            {
                return;
            }

            ListHolder <int> notificationIdCollection = JsonUtility.FromJson <ListHolder <int> >(PlayerPrefs.GetString(_keyNotification));

            foreach (var id in notificationIdCollection.Values)
            {
                AndroidNotificationCenter.CancelNotification(id);
            }
        }
Example #13
0
    // Use this for initialization
    void Start()
    {
        screenText = GameObject.Find("text1").GetComponent <Text>();

        Fns1Obj.transform.position = new Vector3(center.x - unitSize, center.y, center.z);
        FnObj.transform.position   = new Vector3(center.x + unitSize, center.y, center.z);

        LiList Fns1List = new LiList(Fns1Obj, null, null);
        LiList FnList   = new LiList(FnObj, null, null);

        Fns1Holder       = new ListHolder(Fns1List, unitSize);
        FnHolder         = new ListHolder(FnList, unitSize);
        FtemporaryHolder = new ListHolder(null, unitSize);
    }
Example #14
0
        private void AddElementInProviderA()
        {
            ListHolder lh = (ListHolder)GetOneInstance
                                (A(), typeof(ListHolder));

            lh.SetName("h3");
            ListContent lc3 = new ListContent("co3");

            A().Provider().StoreNew(lc3);
            lh.GetList().Add(lc3);
            A().Provider().Update(lh.GetList());
            A().Provider().Update(lh);
            A().Provider().Commit();
            EnsureContent(A(), new string[] { "h3" }, new string[] { "co1", "co2", "co3" });
        }
Example #15
0
    private void RestorePlayedLevels()
    {
        string json = PlayerPrefs.GetString("finished_levels");

        Debug.Log("restore levels " + json);

        if (json.IsEmpty())
        {
            return;
        }

        ListHolder listHolder = JsonUtility.FromJson <ListHolder>(json);

        _finishedLevels = listHolder.list;
    }
Example #16
0
    private void SaveHighscore()
    {
        Highscores = Highscores.DistinctBy(o => o.Level).OrderByDescending(o => o.Level).ThenBy(o => o.Time).ToList();

        ListHolder listHolder = new ListHolder();

        listHolder.list    = Highscores;
        listHolder.Version = Version;

        string json = JsonUtility.ToJson(listHolder);

        PlayerPrefs.SetString("highscore", json);

        Debug.Log("save highscore " + json);
    }
Example #17
0
    private void RestoreHighscore()
    {
        string json = PlayerPrefs.GetString("highscore");

        Debug.Log("restore highscore " + json);

        if (json.IsEmpty())
        {
            return;
        }

        ListHolder listModel = JsonUtility.FromJson <ListHolder>(json);

        Highscores = Migrate(listModel.list, listModel.Version);

        Highscores = Highscores.DistinctBy(o => o.Level).OrderByDescending(o => o.Level).ThenBy(o => o.Time).ToList();
    }
Example #18
0
        private ListHolder <IssueBase> GetCachedIssues(string applicationId, string organisationId)
        {
            applicationId  = Application.GetId(applicationId);
            organisationId = Organisation.GetId(organisationId);

            ObjectCache <ListHolder <IssueBase> > orgCache;

            if (!_cache.TryGetValue(organisationId, out orgCache))
            {
                lock (_cacheSyncLock)
                {
                    if (!_cache.TryGetValue(organisationId, out orgCache))
                    {
                        orgCache = new ObjectCache <ListHolder <IssueBase> >();
                        _cache.Add(organisationId, orgCache);
                    }
                }
            }

            var issues = orgCache.Get(applicationId);

            if (issues == null)
            {
                Trace("Attempting to load issues for application:={0}", applicationId);

                lock (_cacheSyncLock)
                {
                    issues = new ListHolder <IssueBase>()
                    {
                        List = _getIssues.Invoke(new GetAllApplicationIssuesRequest
                        {
                            ApplicationId = applicationId
                        }).Issues ?? new List <IssueBase>()
                    };

                    orgCache.Add(applicationId, issues, DateTimeOffset.UtcNow.AddMinutes(_configuration.IssueCacheTimeoutMinutes));

                    Trace("Successfully loaded {0} issues", issues.List.Count);
                }
            }

            return(issues);
        }
Example #19
0
        private void EnsureContent(IDrsProviderFixture fixture, string[] holderNames, string[] contentNames)
        {
            int holderCount = holderNames.Length;

            EnsureInstanceCount(fixture, typeof(ListHolder), holderCount);
            int         i         = 0;
            IEnumerator objectSet = fixture.Provider().GetStoredObjects(typeof(ListHolder)).GetEnumerator();

            while (objectSet.MoveNext())
            {
                ListHolder lh = (ListHolder)objectSet.Current;
                Assert.AreEqual(holderNames[i], lh.GetName());
                IEnumerator itor = lh.GetList().GetEnumerator();
                int         idx  = 0;
                while (itor.MoveNext())
                {
                    Assert.AreEqual(contentNames[idx], ((ListContent)itor.Current).GetName());
                    idx++;
                }
            }
        }
Example #20
0
        private void ModifyInProviderB()
        {
            ListHolder lh = (ListHolder)GetOneInstance
                                (B(), typeof(ListHolder));

            lh.SetName("h2");
            IEnumerator itor = lh.GetList().GetEnumerator();

            itor.MoveNext();
            ListContent lc1 = (ListContent)itor.Current;

            itor.MoveNext();
            ListContent lc2 = (ListContent)itor.Current;

            lc1.SetName("co1");
            lc2.SetName("co2");
            B().Provider().Update(lc1);
            B().Provider().Update(lc2);
            B().Provider().Update(lh.GetList());
            B().Provider().Update(lh);
            B().Provider().Commit();
            EnsureContent(B(), new string[] { "h2" }, new string[] { "co1", "co2" });
        }
Example #21
0
 public bool Equals(ListHolder <T> other)
 {
     return(this == other);
 }
Example #22
0
    void Update()
    {
        this.Buff++;

        if (this.Buff > this.SpeedMove / 2)
        {
            this.Buff = 0;

            if (this.Direction.x != 0 || this.Direction.y != 0)
            {
                var rBody = GetComponent <Rigidbody> ();

                rBody.velocity = new Vector3(this.Direction.x * this.SpeedMove, Direction.y * this.SpeedMove, 0);

                if (this.Body.Count > 0)
                {
                    this.Body [0].transform.position = this.transform.position;
                    for (int i = this.Body.Count - 1; i > 0; i--)
                    {
                        this.Body [i].transform.position = this.Body [i - 1].transform.position;
                    }
                }
            }
        }

        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (!this.Paused)
            {
                Time.timeScale = 0;
                d = new Vector2(this.Direction.x, this.Direction.y);
                this.Direction = new Vector2(0, 0);
                this.Paused    = true;
            }
            else
            {
                Time.timeScale = 1;
                this.Direction = d;
                this.Paused    = false;
            }
        }

        if (TargetController.targetsCollected == 10 && !this.gameIsFinished)
        {
            this.gameIsFinished = true;
            this.Direction      = new Vector2(0, 0);

            var currData = new DataModel()
            {
                IsLevelCompleted = true,
                LevelNumber      = LevelSelector.SelectedLevel,
                TopScore         = this.Score
            };

            if (gameData.Count > 0)
            {
                for (int i = 0; i < gameData.Count; i++)
                {
                    if (gameData [i].LevelNumber == currData.LevelNumber)
                    {
                        gameData [i] = currData;
                    }
                    else
                    {
                        gameData.Add(new DataModel()
                        {
                            IsLevelCompleted = true,
                            LevelNumber      = LevelSelector.SelectedLevel,
                            TopScore         = this.Score
                        });
                    }
                }
            }
            else
            {
                gameData.Add(currData);
            }

            var lh = new ListHolder();
            lh.dataModel = gameData.ToArray();
            string json = JsonHelper.ToJson(lh.dataModel);
            Main.WriteDataToFile(json);
        }
    }
        private void ShowDialog(int holderId, GravityFlags gravity, bool showHeader, bool showFooter, bool expanded)
        {
            bool isGrid;

            Com.Orhanobut.Dialogplus.IHolder holder;
            switch (holderId)
            {
            case Resource.Id.basic_holder_radio_button:
                holder = new ViewHolder(Resource.Layout.content);
                isGrid = false;
                break;

            case Resource.Id.list_holder_radio_button:
                holder = new ListHolder();
                isGrid = false;
                break;

            default:
                holder = new GridHolder(3);
                isGrid = true;
                break;
            }

            OnClickListener clickListener = new OnClickListener()
            {
                ClickAction = (s, v) =>
                {
                }
            };

            OnItemClickListener itemClickListener = new OnItemClickListener()
            {
                ItemClick = (d, i, v, p) =>
                {
                    TextView textView       = v.FindViewById <TextView>(Resource.Id.text_view);
                    string   clickedAppName = textView.Text;
                    Toast.MakeText(this, clickedAppName + "Clicked", ToastLength.Short).Show();
                }
            };

            OnDismissListener dismissListener = new OnDismissListener()
            {
                Dimissed = (d) =>
                {
                    Toast.MakeText(this, "dismiss listener invoked!", ToastLength.Short).Show();
                }
            };

            OnCancelListener cancelListener = new OnCancelListener()
            {
                Canceled = (d) =>
                {
                    Toast.MakeText(this, "cancel listener invoked!", ToastLength.Short).Show();
                }
            };

            DialogPlusQs.Views.SimpleAdapter adapter = new DialogPlusQs.Views.SimpleAdapter(this, isGrid);

            if (showHeader && showFooter)
            {
                ShowCompleteDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener,
                                   expanded);
                return;
            }

            if (showHeader && !showFooter)
            {
                ShowNoFooterDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener,
                                   expanded);
                return;
            }

            if (!showHeader && showFooter)
            {
                ShowNoHeaderDialog(holder, gravity, adapter, clickListener, itemClickListener, dismissListener, cancelListener,
                                   expanded);
                return;
            }

            ShowOnlyContentDialog(holder, gravity, adapter, itemClickListener, dismissListener, cancelListener, expanded);
        }