コード例 #1
0
 private static void MakeState()
 {
     if (MyHistorySates == null)
     {
         MyHistorySates            = new Action[0];
         Window.window.OnPopState += (c1, c2) => OnPopState();
     }
     OnPopState = () => Pop(ref MyHistorySates)();
 }
コード例 #2
0
ファイル: ImGuiRaii.cs プロジェクト: Ottermandias/RezPls
        public void End(int n = 1)
        {
            var actualN = Math.Min(n, _onDispose?.Count ?? 0);

            while (actualN-- > 0)
            {
                _onDispose !.Pop()();
            }
        }
コード例 #3
0
 protected override JsonToken ReadTokenImpl()
 {
     if (_stack == null)
     {
         return(JsonToken.EOF());
     }
     if (_stack.Count == 0)
     {
         _stack  = null;
         _reader = null;
         return(JsonToken.EOF());
     }
     return(Pop()());
 }
コード例 #4
0
        public bool Optimize(ref List <Instruction> src)
        {
            int pushidx;

            if (CurrentIndex == -1)
            {
                return(false);
            }

            Push OldPush = (Push)src[CurrentIndex];

            pushidx = -1;
            Pop OldPop = OptimizeUtils.GetLastPop(src, CurrentIndex - 1, ref pushidx);

            if (OldPop == null)
            {
                return(false);
            }

            // check for same operands
            if (OptimizeUtils.SameOperands(OldPop, OldPush))
            {
                src[CurrentIndex].Emit = false;
                src[pushidx].Emit      = false;
                SamePushPop++;
                Optimizer.OptimizationsSize += 3;
                Optimizer.Optimizations++;
                return(true);
            }



            return(true);
        }
コード例 #5
0
 public void Dispose()
 {
     BreakParent();
     Content.Dispose();
     Pop.Dispose();
     List.Dispose();
 }
コード例 #6
0
        public static void Draw(this SpriteBatch sb, Pop p)
        {
			var popSize = 0.75f*GAME_SCALE;

			sb.Draw(_pixel, p.Position.ToVector2()*GAME_SCALE, null,
                GetColor(p), 0f, new Vector2(-0.125f), popSize, SpriteEffects.None, 0f);

            sb.Draw(_pixel, p.Position.ToVector2()*GAME_SCALE, null,
                Color.White, 0f, new Vector2(-0.125f), 
                new Vector2(popSize*p.FullnessFraction, 3f), SpriteEffects.None, 0f);

            if(p.DesiresBreed) {
                sb.Draw(_heart, (p.Position.ToVector2() + new Vector2(0.5f, 0.5f))*GAME_SCALE, 
					null, Color.White, 0f, new Vector2(0f, _heart.Bounds.Height), popSize/2f/_heart.Bounds.Width, SpriteEffects.None, 0f);
            }

            if(DebugDraw) {
                if (p.LastTargetBush != null) {
                    sb.DrawLine(p.Position.ToVector2()*GAME_SCALE + Vector2.One*GAME_SCALE*0.5f, 
                        p.LastTargetBush.Position.ToVector2()*GAME_SCALE + Vector2.One*GAME_SCALE*0.5f, Color.White);
                }
                if(p.IsWandering) {
                    var center = p.Position.ToVector2()*GAME_SCALE + Vector2.One*GAME_SCALE*0.5f;
                    sb.DrawLine(center, center + p.WanderDirection.ToVector2()*GAME_SCALE*0.5f, Color.White);
                }

                if(p.DesiresForage) sb.DrawString(_font, "F", p.Position.ToVector2()*GAME_SCALE, Color.White);
                sb.DrawString(_font, p.GetFood(FoodTypes.Berry).ToString(), (p.Position.ToVector2() + new Vector2(0.6f))*GAME_SCALE, Color.White);
            }
        }
コード例 #7
0
ファイル: RegisterViewModel.cs プロジェクト: IdoAv/TriviaApp
        private async void Register()
        {
            TriviaWebAPIProxy proxy = TriviaWebAPIProxy.CreateProxy();
            User user = new User()
            {
                Email    = Email,
                NickName = Nickname,
                Password = Password
            };
            Task <bool> registerTask = Task.Run(() => proxy.RegisterUser(user));
            await       registerTask;

            if (registerTask.Result)
            {
                ((App)App.Current).User = user;
                if (!popOrPush)
                {
                    PushModal?.Invoke(new QuestioningPage());
                }
                else
                {
                    Pop?.Invoke();
                }
            }
            else
            {
                Error = "Email or NickName Exists";
            }
        }
コード例 #8
0
 // Start is called before the first frame update
 void OnEnable()
 {
     SavePop      = Save.GetComponent <Pop>();
     CancelPop    = Cancel.GetComponent <Pop>();
     SaveButton   = Save.transform.GetChild(0).GetComponent <MenuButton>();
     CancelButton = Cancel.transform.GetChild(0).GetComponent <MenuButton>();
 }
コード例 #9
0
    public Pop[] DesengagerGuerrier(bool detruir, int nbr)
    {
        print(nbr);

        Pop[] popsRetour = new Pop[nbr];
        for (int i = 0; i < nbr; i++)
        {
            Pop popRetiree = listePopsGuerrier[listePopsGuerrier.Count - 1];
            listePopsGuerrier.RemoveAt(listePopsGuerrier.Count - 1);

            if (detruir)
            {
                Destroy(popRetiree.gameObject);
                popRetiree = null;
                tribu.stockRessources.RetirerCapacitePop();
            }
            else
            {
                listePopsCampement.Add(popRetiree);
                popRetiree.gameObject.SetActive(true);
            }

            tribu.stockRessources.CalculerGain();
            tribu.guerrier.nbrGuerrier--;
            popsRetour[i] = popRetiree;
        }
        AjusterRouePopulation();

        print(tribu.guerrier.nbrGuerrier);

        return(popsRetour);
    }
コード例 #10
0
ファイル: UIController.cs プロジェクト: TashaSkyUp/Open-VTT
    void Start()
    {
        mydoc = gameObject.GetComponent <UIDocument>();

        HistoryClearButton          = mydoc.rootVisualElement.Q <Button>("HistoryClear");
        HistoryClearButton.clicked += new System.Action(() => History.text = "");
        History = mydoc.rootVisualElement.Q <Label>("History");

        var OpenImageMapButton = mydoc.rootVisualElement.Q <Button>("LoadMapImage");

        OpenImageMapButton.clicked += new System.Action(() => PickImage());

        var AddTokenButton = mydoc.rootVisualElement.Q <Button>("AddToken");

        AddTokenButton.clicked += new System.Action(() => AddToken());

        PopUp = mydoc.rootVisualElement.Q <Pop>("Pop"); PopUp.Init();
        Right = mydoc.rootVisualElement.Q <VisualElement>("right");

        TokenMenu = mydoc.rootVisualElement.Q <VisualElement>("TokenMenu");
        TokenMenu.style.display = DisplayStyle.None;

        mydoc.rootVisualElement.Q <Button>("SaveScene").clicked += new Action(() => SaveScene());
        mydoc.rootVisualElement.Q <Label>("MapNameLabel").RegisterCallback <ClickEvent>((e) => EditMapName(e));


        setupdie();
        setupScene();
    }
コード例 #11
0
    public void                             PushPosition(Vector4 WorldPosition)
    {
        Pop.AllocIfNull(ref Positions);

        //	only add if significant
        if (Positions.Count > 1)
        {
            var DistanceToLastPos = Vector3.Distance(WorldPosition, Positions [1]);
            if (DistanceToLastPos < MinDistanceToPushPosition)
            {
                return;
            }
        }

        Positions.Insert(0, WorldPosition);
        if (Positions.Count > MAX_SPLINE_POINTS)
        {
            Positions.RemoveRange(MAX_SPLINE_POINTS, Positions.Count - MAX_SPLINE_POINTS);
        }

        var Positions4 = new Vector3[Positions.Count];

        for (int i = 0; i < Positions.Count; i++)
        {
            Positions4 [i] = Positions [i];
        }

        OnPositionsChanged.Invoke(Positions4);
    }
コード例 #12
0
        public Instruction handleInstruction(Token token)
        {
            Instruction    insn   = null;
            List <Operand> opList = getOperands();

            switch (token.strval)
            {
            case "ADD":
                insn = new Add(opList[0], opList[1], false);
                break;

            case "SUB":
                insn = new Subtract(opList[0], opList[1], false);
                break;

            case "MOV":
                insn = new Move(opList[0], opList[1]);
                break;

            case "POP":
                insn = new Pop(opList[0]);
                break;

            case "PUSH":
                insn = new Push(opList[0]);
                break;

            case "RET":
                insn = new Return(false);
                break;
            }

            return(insn);
        }
コード例 #13
0
        public void PopDeletesReturnAddressAndForNextLoops()
        {
            var runEnvironment = new RunEnvironment();
            var sut            = new Pop(runEnvironment);
            var line10         = new ProgramLine(10, new List <IToken> {
                new Token("1000")
            });
            var line1000 = new ProgramLine(1000, new List <IToken> {
            });

            line10.NextToken();
            runEnvironment.CurrentLine = line1000;
            runEnvironment.ProgramStack.Push(new StackEntry {
                Line = line10, LineToken = line10.CurrentToken
            });
            runEnvironment.ProgramStack.Push(new StackEntry {
                Line = line10, LineToken = line10.CurrentToken
            });
            runEnvironment.ProgramStack.Push(new StackEntry {
                VariableName = "A", Line = line10, LineToken = line10.CurrentToken
            });
            runEnvironment.ProgramStack.Push(new StackEntry {
                VariableName = "B", Line = line10, LineToken = line10.CurrentToken
            });
            sut.Execute();
            Assert.AreEqual(1, runEnvironment.ProgramStack.Count);
            Assert.AreEqual(line1000, runEnvironment.CurrentLine);
        }
コード例 #14
0
ファイル: Slot.cs プロジェクト: leodar163/KWER
 protected virtual void retirerPop()
 {
     demo.RetournerPop(pop);
     pop.gameObject.SetActive(true);
     pop = null;
     iconePop.gameObject.SetActive(false);
 }
コード例 #15
0
        public void Dispose()
        {
            Log.Info("MailClient->Dispose()");

            try
            {
                if (Imap != null)
                {
                    lock (Imap.SyncRoot)
                    {
                        if (Imap.IsConnected)
                        {
                            Log.Debug("Imap->Disconnect()");
                            Imap.Disconnect(true, CancelToken);
                        }

                        Imap.Dispose();
                    }
                }

                if (Pop != null)
                {
                    lock (Pop.SyncRoot)
                    {
                        if (Pop.IsConnected)
                        {
                            Log.Debug("Pop->Disconnect()");
                            Pop.Disconnect(true, CancelToken);
                        }

                        Pop.Dispose();
                    }
                }

                if (Smtp != null)
                {
                    lock (Smtp.SyncRoot)
                    {
                        if (Smtp.IsConnected)
                        {
                            Log.Debug("Smtp->Disconnect()");
                            Smtp.Disconnect(true, CancelToken);
                        }

                        Smtp.Dispose();
                    }
                }

                Authenticated = null;
                SendMessage   = null;
                GetMessage    = null;

                StopTokenSource.Dispose();
            }
            catch (Exception ex)
            {
                Log.Error("MailClient->Dispose(Mb_Id={0} Mb_Addres: '{1}') Exception: {2}", Account.MailBoxId,
                          Account.EMail.Address, ex.Message);
            }
        }
コード例 #16
0
    int?FindClosestViewDirectionPoint(Vector3 MatchViewDirection, float MinScore)
    {
        Pop.AllocIfNull(ref ViewDirections);

        //	closest to 1 is closest to vector
        int?  ClosestDotIndex = null;
        float ClosestDot      = 0;
        float MinDot          = 1 - MinScore;

        for (int i = 0; i < ViewDirections.Count; i++)
        {
            var ViewDir = ViewDirections[i];
            var Dot     = Vector3.Dot(ViewDir, MatchViewDirection);

            if (Dot < MinDot)
            {
                continue;
            }

            if (ClosestDotIndex.HasValue)
            {
                if (ClosestDot > Dot)
                {
                    continue;
                }
            }

            ClosestDotIndex = i;
            ClosestDot      = Dot;
        }
        return(ClosestDotIndex);
    }
コード例 #17
0
        //[ValidateAntiForgeryToken]
        public ActionResult UpdatePop(Pop PopInfoForUpdate)
        {
            try
            {
                Pop Pop_Check = db.Pop.Where(s => s.PopID != PopInfoForUpdate.PopID && s.PopName == PopInfoForUpdate.PopName.Trim()).FirstOrDefault();

                if (Pop_Check != null)
                {
                    //TempData["AlreadyInsert"] = "Pop Already Added. Choose different Pop. ";

                    return(Json(new { UpdateSuccess = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet));
                }

                var Pop_db = db.Pop.Where(s => s.PopID == PopInfoForUpdate.PopID);
                PopInfoForUpdate.CreatedBy   = Pop_db.FirstOrDefault().CreatedBy;
                PopInfoForUpdate.CreatedDate = Pop_db.FirstOrDefault().CreatedDate;
                PopInfoForUpdate.UpdateBy    = AppUtils.GetLoginEmployeeName();
                PopInfoForUpdate.UpdateDate  = AppUtils.GetDateTimeNow();

                db.Entry(Pop_db.SingleOrDefault()).CurrentValues.SetValues(PopInfoForUpdate);
                db.SaveChanges();

                TempData["UpdateSucessOrFail"] = "Update Successfully.";
                var Pop_Return = Pop_db.Select(s => new { PopID = s.PopID, PackageName = s.PopName, PopLocation = s.PopLocation });
                var JSON       = Json(new { UpdateSuccess = true, PopUpdateInformation = Pop_Return }, JsonRequestBehavior.AllowGet);
                JSON.MaxJsonLength = int.MaxValue;
                return(JSON);
            }
            catch
            {
                TempData["UpdateSucessOrFail"] = "Update Fail.";
                return(Json(new { UpdateSuccess = false, PopUpdateInformation = "" }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #18
0
        public Alg_JobOnly(int pop_cnt, int tar_cnt, int rel_per_pop, int max_iter)
        {
            _max_iter = max_iter;
            for (int i = 0; i < tar_cnt; ++i)
            {
                allTar.Add(new Tar {
                    id = i
                });                           //add tar
            }
            for (int i = 0; i < pop_cnt; ++i)
            {
                var new_pop = new Pop();
                allPop.Add(new_pop);        // add pop

                new_pop.relations.AddRange( // add relations
                    Enumerable.Range(0, rel_per_pop).Select(_ => new Rel {
                    a        = allTar[Random.Range(0, allTar.Count)],
                    b        = allTar[Random.Range(0, allTar.Count)],
                    strength = Random.Range(-0.2f, 0.2f),
                    tab      = 0,
                    tba      = 0,
                })
                    );
            }

            // add events
            for (int i = 0; i < CORE; ++i)
            {
                _allEvents[i] = new AutoResetEvent(false);
            }

            Profiler.BeginSample("Prepare");
            allPop.ForEach(x => x.RandomReset(allTar));   // reset every frame, as the amount of computation drops after first time
            Profiler.EndSample();
        }
コード例 #19
0
ファイル: pop.aspx.cs プロジェクト: Piaofumai/TestProj
 protected void btnCommit_ServerClick(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         string sex = "1";
         if (this.rbtnNv.Checked)
         {
             sex = "2";
         }
         string pcontent = this.txtPcontent.Text;
         if (pcontent.Length > 500)
         {
             pcontent = pcontent.Substring(0, 500);
         }
         PopOperate po = new PopOperate();
         Pop        op = new Pop(Server.HtmlEncode(this.txtPname.Text), Server.HtmlEncode(pcontent), sex);
         if (po.insert(op))
         {
             Response.Redirect("pop.aspx");
         }
         else
         {
             this.lblErrorComment.Text = "发表失败";
         }
     }
 }
コード例 #20
0
        public static bool SameOperands(Pop a, Push b)
        {
            bool m = false;

            if (a.DestinationDisplacement == b.DestinationDisplacement)
            {
                if (a.DestinationIsIndirect == b.DestinationIsIndirect)
                {
                    if (a.DestinationRef == b.DestinationRef)
                    {
                        if (a.DestinationReg == b.DestinationReg)
                        {
                            if (a.DestinationValue == b.DestinationValue)
                            {
                                m = true;
                            }
                        }
                    }
                }
            }
            if (a.Size == b.Size)
            {
                m &= true;
            }
            return(m);
        }
コード例 #21
0
        public async Task <IActionResult> Edit(int id, [Bind("PopId,PopName,FruitFlavor,Diet,PackageType,PreferTemp,Sugar,NumDrinkPerDay")] Pop pop)
        {
            if (id != pop.PopId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pop);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PopExists(pop.PopId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pop));
        }
コード例 #22
0
    public Pop DesengagerGuerrier(bool detruir)
    {
        Pop popRetiree = listePopsGuerrier[listePopsGuerrier.Count - 1];

        listePopsGuerrier.RemoveAt(listePopsGuerrier.Count - 1);

        if (detruir)
        {
            Destroy(popRetiree.gameObject);
            popRetiree = null;
            tribu.stockRessources.RetirerCapacitePop();
        }
        else
        {
            listePopsCampement.Add(popRetiree);
            popRetiree.gameObject.SetActive(true);
        }

        tribu.stockRessources.CalculerGain();
        tribu.guerrier.nbrGuerrier--;



        AjusterRouePopulation();

        return(popRetiree);
    }
コード例 #23
0
    public void EverythingCanBeSet()
    {
        var reader = new BufferedReader(" = {" +
                                        "culture=\"paradoxian\"\n" +
                                        "religion=\"nicene\"\n" +
                                        "type=\"citizen\"\n" +
                                        "}");
        var thePop = Pop.Parse("42", reader);

        Assert.Equal((ulong)42, thePop.Id);
        Assert.Equal("paradoxian", thePop.Culture);
        Assert.Equal("nicene", thePop.Religion);
        Assert.Equal("citizen", thePop.Type);

        var reader2 = new BufferedReader(" = {" +
                                         "culture=\"paradoxus\"\n" +
                                         "religion=\"nicenus\"\n" +
                                         "type=\"citizenus\"\n" +
                                         "}");
        var thePop2 = Pop.Parse("43", reader2);

        Assert.Equal((ulong)43, thePop2.Id);
        Assert.Equal("paradoxus", thePop2.Culture);
        Assert.Equal("nicenus", thePop2.Religion);
        Assert.Equal("citizenus", thePop2.Type);
    }
コード例 #24
0
    public override void GetTimeRange(out PopTimeline.TimeUnit Min, out PopTimeline.TimeUnit Max)
    {
        int?MinTime = null;
        int?MaxTime = null;

        Pop.AllocIfNull(ref VideoStreams);


        foreach (var bs in VideoStreams)
        {
            var Blocks = bs.Blocks;
            if (Blocks == null || Blocks.Count == 0)
            {
                continue;
            }
            var bsmin = Blocks[0].GetStartTime().Time;
            var bsmax = Blocks[Blocks.Count - 1].GetEndTime().Time;

            MinTime = MinTime.HasValue ? Mathf.Min(MinTime.Value, bsmin) : bsmin;
            MaxTime = MaxTime.HasValue ? Mathf.Max(MaxTime.Value, bsmax) : bsmax;
        }

        if (!MinTime.HasValue)
        {
            throw new System.Exception("No time range (no data)");
        }

        Min = new PopTimeline.TimeUnit(MinTime.Value);
        Max = new PopTimeline.TimeUnit(MaxTime.Value);
    }
コード例 #25
0
        void ParseTag_Group(Dictionary <string, string> Attribs, string TagContents, bool EndTag, bool LoneTag)
        {
            Pop.AllocIfNull(ref CurrentGroupStack);
            if (!EndTag)
            {
                var NewGroup = new Svg.Group();

                //	add to tree
                if (CurrentGroupStack.Count == 0)
                {
                    this.Svg.Groups.Add(NewGroup);
                }
                else
                {
                    var CurrentGroup = GetCurrentGroup();
                    CurrentGroup.Children.Add(NewGroup);
                }

                //	add to stack
                CurrentGroupStack.Add(NewGroup);
            }

            if (LoneTag || EndTag)
            {
                CurrentGroupStack.RemoveAt(CurrentGroupStack.Count - 1);
                return;
            }
        }
コード例 #26
0
 public void AddViewDirectionPoint(Vector3 ViewDirection)
 {
     //	transform direction by camera rotation
     Pop.AllocIfNull(ref ViewDirections);
     ViewDirections.Add(ViewDirection);
     OnChanged();
     Debug.Log("Added view dir");
 }
コード例 #27
0
 void OnEnable()
 {
     MyRectTransform = GetComponent <RectTransform>();
     Pop             = GetComponent <Pop>();
     HandRenderer    = Hand.GetComponent <CanvasRenderer>();
     HandTransform   = Hand.GetComponent <RectTransform>();
     HandRenderer.SetAlpha(0f);
 }
コード例 #28
0
        private Dictionary <int, string> FixPop3UidsOrder(Dictionary <int, string> newMessages)
        {
            try
            {
                if (newMessages.Count < 2)
                {
                    return(newMessages);
                }

                newMessages = newMessages
                              .OrderBy(item => item.Key)
                              .ToDictionary(id => id.Key, id => id.Value);

                var fstIndex = newMessages.First().Key;
                var lstIndex = newMessages.Last().Key;

                var fstMailHeaders = Pop.GetMessageHeaders(fstIndex, CancelToken).ToList();
                var lstMailHeaders = Pop.GetMessageHeaders(lstIndex, CancelToken).ToList();

                var fstDateHeader =
                    fstMailHeaders.FirstOrDefault(
                        h => h.Field.Equals("Date", StringComparison.InvariantCultureIgnoreCase));

                var lstDateHeader =
                    lstMailHeaders.FirstOrDefault(
                        h => h.Field.Equals("Date", StringComparison.InvariantCultureIgnoreCase));

                DateTime fstDate;
                DateTime lstDate;

                if (fstDateHeader != null && DateTime.TryParse(fstDateHeader.Value, out fstDate) &&
                    lstDateHeader != null &&
                    DateTime.TryParse(lstDateHeader.Value, out lstDate))
                {
                    if (fstDate < lstDate)
                    {
                        Log.Debug("Account '{0}' uids order is DESC", Account.EMail.Address);
                        newMessages = newMessages
                                      .OrderByDescending(item => item.Key)
                                      .ToDictionary(id => id.Key, id => id.Value);
                        return(newMessages);
                    }
                }


                Log.Debug("Account '{0}' uids order is ASC", Account.EMail.Address);
            }
            catch (Exception)
            {
                newMessages = newMessages
                              .OrderByDescending(item => item.Key)
                              .ToDictionary(id => id.Key, id => id.Value);

                Log.Warn("Calculating order skipped! Account '{0}' uids order is DESC", Account.EMail.Address);
            }

            return(newMessages);
        }
コード例 #29
0
ファイル: MainWindow.xaml.cs プロジェクト: LeeGray1/wk1-OOD
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Rock band1 = new Rock()
            {
                BandName        = "AC/DC",
                yearofFormation = 1973,
                membersofBand   = " Angus Young, Brian Johnson, Bon Scott"
            };

            Pop band2 = new Pop()
            {
                BandName        = "Fall out boy",
                yearofFormation = 2001,
                membersofBand   = "Patrick Stump, bassist Pete Wentz,Joe Trohman, Andy Hurley"
            };

            Indie band3 = new Indie()
            {
                BandName        = "Sabaton",
                yearofFormation = 2000,
                membersofBand   = "Johan Hegg, Par Sundstrom, Chris Rorland, Hannes dan Vahl, Tommy Johansson"
            };

            Rock band4 = new Rock()
            {
                BandName        = "Queen",
                yearofFormation = 1970,
                membersofBand   = "Freddie Mercury, Brian May, John Deacon, and Roger Taylor"
            };

            Indie band5 = new Indie()
            {
                BandName        = "Powerwolf",
                yearofFormation = 2003,
                membersofBand   = "	Matthew Greywolf, Charles Greywolf, Falk Maria Schlegel, Attila Dorn, Roel van Helden"
            };

            Pop band6 = new Pop()
            {
                BandName        = "Maroon 5",
                yearofFormation = 2001,
                membersofBand   = " Adam Levine, James Valentine, PJ Morton, Mickey Madden, Jesse Carmichael, Matt Flynn, Sam Farrar, Ryan Dusick"
            };

            musicBands.Add(band1);
            musicBands.Add(band2);
            musicBands.Add(band3);
            musicBands.Add(band4);
            musicBands.Add(band5);
            musicBands.Add(band6);

            Lbox.ItemsSource = musicBands;

            cbxGenre.Items.Add("All");
            cbxGenre.Items.Add("Pop");
            cbxGenre.Items.Add("Rock");
            cbxGenre.Items.Add("Indie");
        }
コード例 #30
0
 public void Push Pop Elements()
 {
     var nums = new ArrayStack<int>();
     Assert.AreEqual(0,nums.Count);
     nums.Push(15);
     Assert.AreEqual(1,nums.Count);
     Assert.AreEqual(15,nums.Pop());
     Assert.AreEqual(0,nums.Count);
 }
コード例 #31
0
        private Dictionary <int, string> GetPop3NewMessagesIDs(TasksConfig tasksConfig)
        {
            var newMessages = new Dictionary <int, string>();

            var j     = 0;
            var uidls =
                Pop.GetMessageUids(CancelToken)
                .Select(uidl => new KeyValuePair <int, string>(j++, uidl))
                .ToDictionary(t => t.Key, t => t.Value);

            if (!uidls.Any() || uidls.Count == Account.MessagesCount)
            {
                return(newMessages);
            }

            var i     = 0;
            var chunk = tasksConfig.ChunkOfPop3Uidl;

            var chunkUidls = uidls.Skip(i).Take(chunk).ToList();

            var manager = new MailBoxManager();

            do
            {
                var checkList = chunkUidls.Select(u => u.Value).Distinct().ToList();

                var existingUidls = manager.CheckUidlExistance(Account.MailBoxId, checkList);

                if (!existingUidls.Any())
                {
                    var messages = newMessages;
                    foreach (var item in
                             chunkUidls.Select(uidl => new KeyValuePair <int, string>(uidl.Key, uidl.Value))
                             .Where(item => !messages.Contains(item)))
                    {
                        newMessages.Add(item.Key, item.Value);
                    }
                }
                else if (existingUidls.Count != chunkUidls.Count)
                {
                    var messages = newMessages;
                    foreach (var item in (from uidl in chunkUidls
                                          where !existingUidls.Contains(uidl.Value)
                                          select new KeyValuePair <int, string>(uidl.Key, uidl.Value)).Where(
                                 item => !messages.Contains(item)))
                    {
                        newMessages.Add(item.Key, item.Value);
                    }
                }

                i += chunk;

                chunkUidls = uidls.Skip(i).Take(chunk).ToList();
            } while (chunkUidls.Any());

            return(newMessages);
        }
コード例 #32
0
        /// <summary>
        /// 获取弹窗对象
        /// </summary>
        /// <param name="pop">弹窗标识</param>
        /// <returns>返回弹窗对象</returns>
        public IPop GetPop(Pop pop)
        {
            bool hadPop = _popCreaters.Any(x => x.Key == pop);
            if (!hadPop)
            {
                throw new Exception("该弹窗没有被注册");
            }

            WindowCreater creater = _popCreaters.Where(x => x.Key == pop).Select(x => x.Value).Single();
            ChildWindow cw = creater();
            return cw as IPop;
        }
コード例 #33
0
                    public void Push Pop 1000 Elements()
                    {
                        var nums = new LinkedStackTest<int>();
                        Assert.AreEqual(0,nums.Count);

                        for (int i = 0; i < 1001; i++)
		                	{
			                    nums.Push(i);
                                Assert.AreEqual(i + 1, nums.Count);    
		                	}
                        for (int i = 0; i < 1001; i++)
		                	{
			                    Assert.AreEqual(1000 - i,nums.Pop());
                                Assert.AreEqual(1000 - i,nums.Count);
	                		}
                    }
    static void Main()
    {
        SWIGTYPE_p_int pInt = null;

          // Check the correct constructors are available
          Pop p = new Pop(pInt);

          p = new Pop(pInt, false);

          // Check overloaded in const only and pointers/references which target languages cannot disambiguate
          if (p.hip(false) != 701)
        throw new Exception("Test 1 failed");

          if (p.hip(pInt) != 702)
        throw new Exception("Test 2 failed");

          // Reverse the order for the above
          if (p.hop(pInt) != 805)
        throw new Exception("Test 3 failed");

          if (p.hop(false) != 801)
        throw new Exception("Test 4 failed");

          // Few more variations and order shuffled
          if (p.pop(false) != 901)
        throw new Exception("Test 5 failed");

          if (p.pop(pInt) != 902)
        throw new Exception("Test 6 failed");

          if (p.pop() != 905)
        throw new Exception("Test 7 failed");

          // Overload on const only
          if (p.bop(pInt) != 1001)
        throw new Exception("Test 8 failed");

          if (p.bip(pInt) != 2001)
        throw new Exception("Test 9 failed");

          // Globals
          if (overload_complicated.muzak(false) != 3001)
        throw new Exception("Test 10 failed");

          if (overload_complicated.muzak(pInt) != 3002)
        throw new Exception("Test 11 failed");
    }
コード例 #35
0
    private void Atomize()
    {
        AtomizerEffectGroup effectGroup = Atomizer.CreateEffectGroup();

        SwapColours swapColours = new SwapColours();
        int modeIndex = Random.Range(0, System.Enum.GetValues(typeof(ColourSwapMode)).Length);
        swapColours.ColourSwapMode = (ColourSwapMode) modeIndex;
        swapColours.Duration = 5f;
        effectGroup.Combine(swapColours);

        Pulse pulseEffect = new Pulse();
        pulseEffect.PulseLength = Random.Range(0.1f, 0.6f);
        pulseEffect.PulseStrength = Random.Range(0.2f, 0.8f);
        pulseEffect.Duration = 5f;
        effectGroup.Combine(pulseEffect);

        Pop popEffect = new Pop();
        popEffect.Duration = 5f;
        popEffect.Force = Random.Range(0.1f, 4.0f);
        effectGroup.Combine(popEffect);

        Percolate percolateEffect = new Percolate();
        percolateEffect.PercolationTime = Random.Range(1.0f, 4.0f);
        percolateEffect.PercolationSpeed = Random.Range(0.5f, 6.0f);
        percolateEffect.Duration = 5f;
        int directionIndex = Random.Range(0, System.Enum.GetValues(typeof(PercolationDirection)).Length);
        percolateEffect.Direction = (PercolationDirection) directionIndex;
        effectGroup.Combine(percolateEffect);

        Disintegrate disintegrateEffect = new Disintegrate();
        disintegrateEffect.Duration = 5f;
        disintegrateEffect.FadeColour = new Color(Random.value, Random.value, Random.value, Random.value);
        effectGroup.Combine(disintegrateEffect);

        Vacuum vacuumEffect = new Vacuum();
        vacuumEffect.VacuumPoint = new Vector3(
            transform.position.x,
            transform.position.y + 2f,
            transform.position.z);
        vacuumEffect.MoveSpeed = 5f;
        vacuumEffect.Duration = 5.0f;
        effectGroup.Chain(vacuumEffect);

        Atomizer.Atomize(gameObject, effectGroup, null);
    }
コード例 #36
0
 /// <summary>
 /// 标记控件对象为弹窗
 /// </summary>
 /// <param name="pop">弹窗标记</param>
 public WindowAttribute(Pop pop = framework.Pop.NormalPrompt)
 {
     this.Pop = pop;
 }
コード例 #37
0
        /// <summary>
        /// 注册弹窗
        /// </summary>
        /// <param name="pop">弹窗标识</param>
        /// <param name="creater">弹窗的创建者对象</param>
        public void RegisterPop(Pop pop, WindowCreater creater)
        {
            #region 检查弹窗池

            bool hadPop = _popCreaters.Any(x => x.Key == pop);
            if (hadPop)
            {
                throw new Exception("该弹窗已经被注册到弹窗池,请检查程序");
            }

            #endregion

            _popCreaters.Add(pop, creater);
        }