示例#1
0
 /// <summary>
 /// The Finish
 /// </summary>
 public void Finish()
 {
     OnRefresh?.Invoke();
     Stats.Finish();
     State = new FinishedState();
     OnFinish?.Invoke();
 }
 public void ChangeConditionAtIndex(int index, string newCondition)
 {
     Conditions[index].Object.Condition = newCondition;
     Conditions.Refresh();
     OnDataChanged?.Invoke();
     OnRefresh?.Invoke();
 }
示例#3
0
        /// <summary>
        /// Updates the current entries
        /// </summary>
        private void Refresh()
        {
            // First get the new flight info
            // We convert it to a dictionary to search in it faster
            var newFlights = FlightInfoResponses.ToDictionary(f => f.Icao);

            // Changes made to the database
            int changes;

            using (var context = new ApplicationDbContext())
            {
                // Loop through all existing planes and try to update them

                foreach (var info in context.FlightInfos)
                {
                    // Try to find it in the list of all flights
                    if (newFlights.ContainsKey(info.Id))
                    {
                        // Get the new value
                        var updated = newFlights[info.Id];

                        // For now at least, only update position
                        info.Latitude  = updated.Lat;
                        info.Longitude = updated.Long;
                    }
                }

                // Update database
                changes = context.SaveChanges();
            }

            // Trigger OnRefresh event
            OnRefresh?.Invoke(changes);
        }
示例#4
0
        /// <summary>
        /// The ResetMatrix
        /// </summary>
        private void ResetMatrix()
        {
            //limpar a matriz
            for (int y = 0; y < Dimension.Height; y++)
            {
                for (int x = 0; x < Dimension.Width; x++)
                {
                    Matrix[x, y] = new Block(x, y, PieceColor.None);
                }
            }

            //pintar os blocos que já saíram
            foreach (var i in _playedBlocks)
            {
                Matrix[i.X, i.Y] = i;
            }

            //pinta o bloco atual
            foreach (var i in CurrentPiece.Blocks)
            {
                Matrix[i.X, i.Y] = i;
            }

            OnRefresh?.Invoke();
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="transactionIdentifier"></param>
 public void OnDeleteTransaction(Guid transactionIdentifier)
 {
     if (Transactions.RemoveAll(transactionInformation => transactionInformation.Id == transactionIdentifier) > 0)
     {
         OnRefresh?.Invoke();
     }
 }
示例#6
0
        public void Refresh()
        {
            var buyable = Manager?.SingleEquipped ?? Buyable;

            if (buyable == Buyable)
            {
                return;
            }
            Debug.Log($"Equip Child: {buyable} (was {Buyable})");
            Buyable = buyable;
            transform.DestroyAllChildren();
            Equipped = Instantiate(Prefab, Vector3.zero, Quaternion.identity, transform);
            if (ShowRoomMode)
            {
                Equipped.GetComponent <StoreListable>()?.ConfigureForStore(buyable, true);
                Equipped.transform.localScale = Vector3.one;
            }
            else
            {
                Equipped.GetComponent <StoreListable>()?.ConfigureForPlay(buyable);
            }

            if (!string.IsNullOrEmpty(SpawnName))
            {
                Equipped.name = SpawnName;
            }
            OnRefresh?.Invoke();
        }
        public void SetData(ConditionSetDTO dto)
        {
            _loading = true;

            Conditions.DataSource = null;
            Quantifier            = LogicalQuantifier.Existential;
            HasData = dto != null;

            if (HasData)
            {
                if (dto.ConditionSet != null)
                {
                    Conditions.DataSource = dto.ConditionSet.Select(s => (ConditionHolder)s).ToList();
                }
                else
                {
                    Conditions.DataSource = new List <ConditionHolder>();
                }

                Quantifier = dto.Quantifier;
            }

            _loading = false;

            OnRefresh?.Invoke();
        }
 private void BtnGuardar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.Comprobaciones(out List <string> variables))
         {
             string rpta = NNotas.InsertarNota(variables, out int id_nota);
             if (rpta.Equals("OK"))
             {
                 Mensajes.MensajeOkForm("Se insertó la nota correctamente " + id_nota);
                 OnRefresh?.Invoke(sender, e);
                 this.Close();
             }
             else
             {
                 throw new Exception(rpta);
             }
         }
     }
     catch (Exception ex)
     {
         Mensajes.MensajeErrorCompleto(this.Name, "BtnGuardar_Click",
                                       "Hubo un error al guardar una nota", ex.Message);
     }
 }
示例#9
0
 /// <summary>
 /// Easy way to post a refresh event.
 /// </summary>
 public static void Refresh()
 {
     // Invoke event
     if (null != OnRefresh)
     {
         OnRefresh.Invoke();
     }
 }
示例#10
0
 protected CurvyCGEventArgs OnRefreshEvent(CurvyCGEventArgs e)
 {
     if (OnRefresh != null)
     {
         OnRefresh.Invoke(e);
     }
     return(e);
 }
示例#11
0
 /// <summary>
 /// The TrocarPecaAtual
 /// </summary>
 private void TrocarPecaAtual()
 {
     GuardarBlocos();
     CurrentPiece = NextPiece.Clone();
     NextPiece    = CreateRandomBlock();
     Stats.IncludeBlock();
     OnRefresh?.Invoke();
 }
示例#12
0
        private void BuildListView()
        {
            _items = new List(typeof(CellBase));

            CanFocus         = true;
            ShadowType       = ShadowType.None;
            BorderWidth      = 0;
            HscrollbarPolicy = PolicyType.Never;
            VscrollbarPolicy = PolicyType.Automatic;

            _root          = new VBox();
            _refreshHeader = new Table(1, 1, true);
            _refreshHeader.HeightRequest = RefreshHeight;

            // Refresh Loading
            _refreshLabel      = new Gtk.Label();
            _refreshLabel.Text = "Loading";

            // Refresh Button
            _refreshButton = new ImageButton();
            _refreshButton.LabelWidget.SetTextFromSpan(
                new Span()
            {
                Text = "Refresh"
            });
            _refreshButton.ImageWidget.Stock = Stock.Refresh;
            _refreshButton.SetImagePosition(PositionType.Left);
            _refreshButton.Clicked += (sender, args) =>
            {
                OnRefresh?.Invoke(this, new EventArgs());
            };

            _refreshHeader.Attach(_refreshButton, 0, 1, 0, 1);

            _root.PackStart(_refreshHeader, false, false, 0);

            // Header
            _headerContainer = new EventBox();
            _root.PackStart(_headerContainer, false, false, 0);

            // List
            _list       = new VBox();
            _separators = new List <ListViewSeparator>();
            _root.PackStart(_list, true, true, 0);

            // Footer
            _footerContainer = new EventBox();
            _root.PackStart(_footerContainer, false, false, 0);

            _viewPort             = new Viewport();
            _viewPort.ShadowType  = ShadowType.None;
            _viewPort.BorderWidth = 0;
            _viewPort.Add(_root);

            Add(_viewPort);

            ShowAll();
        }
示例#13
0
 private void ClearPossibles()
 {
     while (possibleCells.Count > 0)
     {
         Cell removedCell = possibleCells[0];
         possibleCells.RemoveAt(0);
         OnRefresh?.Invoke(removedCell.x, removedCell.y);
     }
 }
        public void AddNewDefaultCondition()
        {
            if (!HasData)
            {
                return;
            }

            ((IList <ConditionHolder>)Conditions.DataSource).Add((ConditionHolder)"Bel([x]) = True");
            Conditions.Refresh();
            OnDataChanged?.Invoke();
            OnRefresh?.Invoke();
        }
        public void RemoveConditionAt(int index)
        {
            if (!HasData)
            {
                return;
            }

            Conditions.DataSource.RemoveAt(index);
            Conditions.Refresh();
            OnDataChanged?.Invoke();
            OnRefresh?.Invoke();
        }
示例#16
0
        // Main thread for receiving telegrams
        public override async Task RcvThreading(CancellationToken ct)
        {
            while (!ct.IsCancellationRequested)
            {
                try
                {
                    using (WCF_RcvTelProxyClient rcvTel = new WCF_RcvTelProxyClient())
                    {
                        await rcvTel.InitAsync(Name, RcvIPEndPoint.Address.ToString(), RcvIPEndPoint.Port, RcvTimeOutSeconds, Version);

                        Task            delay = Task.Delay(RefreshTime);
                        Task <Telegram> read  = rcvTel.ReadAsync();
                        while (!ct.IsCancellationRequested)
                        {
                            Task task = await Task.WhenAny(read, delay).ConfigureAwait(false);

                            await task.ConfigureAwait(false);

                            if (task == read)
                            {
                                var tel = await read.ConfigureAwait(false);

                                LastReceiveTime = DateTime.Now;
                                NotifyRcv(tel);
                                Log.AddLog(Log.Severity.EVENT, Name, $"NotifyRcv({tel.ToString()}");
                                LastNotifyTime = DateTime.Now;
//                                try
//                                {
                                read = rcvTel.ReadAsync();
//                                }
//                                catch(Exception ex)
//                                {
//
//                                }
                            }
                            if (task == delay)
                            {
                                OnRefresh?.Invoke();
                                delay = Task.Delay(RefreshTime);
                                Log.AddLog(Log.Severity.EVENT, Name, $"OnRefresh called");
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    OnRefresh?.Invoke();
                    Log.AddLog(Log.Severity.EXCEPTION, Name, ex.Message);
                    await Task.Delay(1000).ConfigureAwait(false);
                }
            }
        }
示例#17
0
    public static void WriteData <T>(T _struct, string _directoryPath, string _filePath)
    {
        if (!Directory.Exists(_directoryPath))
        {
            Directory.CreateDirectory(_directoryPath);
        }

        string _Json = JsonUtility.ToJson(_struct);

        File.WriteAllText(_filePath, _Json);

        OnRefresh?.Invoke();
    }
        internal async void Refresh()
        {
            _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.DOWNLOADING, 0);


            try
            {
                cancel = new CancellationTokenSource();

                var info = await Bootlegger.BootleggerClient.GetEventInfo(Bootlegger.BootleggerClient.CurrentEvent.id, new System.Threading.CancellationToken());

                OnEventInfoUpdate?.Invoke(info);


                await Bootlegger.BootleggerClient.GetMyMedia(cancel.Token);

                //if I can edit everyones media:
                if (Bootlegger.BootleggerClient.CurrentEvent.publicedit)
                {
                    //load everyones media:
                    Bootlegger.BootleggerClient.GetEveryonesMedia(cancel.Token);
                }

                _adapter.UpdateData(Bootlegger.BootleggerClient.UploadQueueEditing, Bootlegger.BootleggerClient.MyMediaEditing);
                _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0);

                OnRefresh?.Invoke();
            }
            catch (TaskCanceledException)
            {
                //do nothing, moving screens
            }
            catch (Exception e)
            {
                try
                {
                    LoginFuncs.ShowError(Activity, e);
                    _adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK, 0);
                }
                catch
                {
                    //fails as the fragment is lost.
                }
            }
            finally
            {
                //if not waiting for everyones media to download:
                //_adapter.FireSyncStatusChanged(MyClipsAdapter.ViewHolder.SyncStatus.OK,0);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="transactionInformation"></param>
        public void OnRegisterTransaction(Transaction transactionInformation)
        {
            var transactionIndex = Transactions.FindIndex(previousTransaction => previousTransaction.Id == transactionInformation.Id);

            if (transactionIndex >= 0)
            {
                Transactions[transactionIndex] = transactionInformation;
            }
            else
            {
                Transactions.Add(transactionInformation);
            }

            OnRefresh?.Invoke();
        }
        /// <summary>
        /// Refreshes the list of all controllers recognized by this virtual controller.
        /// </summary>
        internal void Refresh()
        {
            var controllerMap = new Dictionary <string, IController>();

            foreach (var manager in Managers)
            {
                foreach (var controller in manager.GetControllers())
                {
                    controllerMap.Add(controller.GetId(), controller);
                }
            }

            Controllers = controllerMap;
            OnRefresh?.Invoke();
        }
示例#21
0
 /// <summary>
 /// Méthode appelée par les views lors d'un clic droit sur un bouton
 /// Sert à poser une mine
 /// </summary>
 /// <param name="x">Coordonnée X du button</param>
 /// <param name="y">Coordonnée Y du button</param>
 public void RightClick(int x, int y)
 {
     if (nbMines > 0 && grid.grid[x, y].boat == null)
     {
         ClearPossibles();
         Boat boat = new Boat()
         {
             touchedCell = -1
         };
         boat.startCell       = new int[] { x, y };
         grid.grid[x, y].boat = boat;
         boat.cells.Add(grid.grid[x, y]);
         boats.Add(boat);
         nbMines--;
         OnEnableBtnNext?.Invoke(boatsList.Count == 0 && nbMines == 0);
         OnRefresh?.Invoke(x, y);
     }
 }
        public void MoveCondition(int index, int moveAmount)
        {
            AssetBounds(index);

            var newIndex = index + moveAmount;

            AssetBounds(index);

            var l   = Conditions.DataSource;
            var obj = l[index];

            l.RemoveAt(index);
            l.Insert(newIndex, obj);

            Conditions.Refresh();
            OnDataChanged?.Invoke();
            OnRefresh?.Invoke();
        }
示例#23
0
        private GameController(int width, int height)
        {
            if (width < 10)
            {
                throw new ArgumentException(nameof(width));
            }

            if (height < 10)
            {
                throw new ArgumentException(nameof(height));
            }

            _board            = new Board(new StatsRepository(), width, height);
            _board.OnRefresh += () => { OnRefresh?.Invoke(); };
            _board.OnFinish  += () => { OnFinish?.Invoke(); };
            _board.OnClear   += () => { OnClear?.Invoke(); };
            _board.OnMove    += () => { OnMove?.Invoke(); };
            _board.OnSlide   += () => { OnSlide?.Invoke(); };
        }
        /// <summary>
        /// Updates the current entries
        /// </summary>
        private void Refresh()
        {
            // First get the new flight info
            // We convert it to a dictionary to search in it faster
            var newFlights = FlightInfoResponses.ToDictionary(f => f.Icao);

            // List with all updated values
            var updates = new List <FlightInfo>();

            using (var context = new ApplicationDbContext())
            {
                // Loop through all existing planes and try to update them
                foreach (var info in context.FlightInfos)
                {
                    // Try to find it in the list of all flights
                    if (newFlights.ContainsKey(info.Id))
                    {
                        // Get the new value
                        var updated = newFlights[info.Id];

                        if (Math.Abs(info.Latitude - updated.Lat) > 0.001f || Math.Abs(info.Longitude - updated.Long) > 0.001f)
                        {
                            // Update position
                            info.Latitude  = updated.Lat;
                            info.Longitude = updated.Long;

                            // Add to updates list
                            updates.Add(info);
                        }
                    }
                }

                // Update database
                context.SaveChanges();
            }

            // Trigger OnRefresh event
            OnRefresh?.Invoke(updates.ToArray());
        }
示例#25
0
        public static void Run()
        {
            try
            {
                Console.Clear();

                while (_running)
                {
                    ConsoleEx.WrapInOutputLock(() => {
                        Console.CursorVisible = false;
                        Console.SetCursorPosition(0, 0);
                        ConsoleEx.WriteLineEnh(SetTitle.Invoke().FixedWidthEnh(ConsoleEx.WindowWidth - 12) + "    " + DateTime.Now.ToStringHH24mmss());
                        ConsoleEx.WriteLineEnh(SetKeysHelp.Invoke().FixedWidthEnh(ConsoleEx.WindowWidth - 8 /*16*/) + "  " + "- *Q*U|T" /*$" * R*estart - *Q*U|T"*/);

                        OnRefresh?.Invoke();
                        Console.CursorVisible = true;
                    });

                    var keyInfo = ConsoleEx.ReadKeyWithTimeout(RefreshInterval);
                    if (keyInfo == null)
                    {
                        continue;
                    }

                    if (keyInfo.Value.KeyChar != 'Q' && keyInfo.Value.KeyChar != '|')
                    {
                        OnKey?.Invoke(keyInfo.Value.KeyChar.ToString());
                    }

                    HandleStandardKey(keyInfo);
                }
            }
            finally
            {
                _cts.Cancel();
            }
        }
示例#26
0
 /// <summary>
 /// Refreshes any open data editor windows
 /// Call this anytime the data changes to reflect those changes
 /// </summary>
 public static void Refresh()
 {
     OnRefresh?.Invoke();
 }
示例#27
0
 public void RefreshEncounter()
 {
     onRefreshEvent.Invoke();
 }
 protected DataBase(int refreshTime = 5000)
 {
     RefreshTime  = refreshTime;
     RefreshTimer = new Timer(obj => OnRefresh?.Invoke(), null, 0, RefreshTime);
 }
        private void scatter()
        {
            _helperAssignProperty.AssingnProperty("interface_scatter", "from_entity", _interfaceInstance, _entity);

            OnRefresh?.Invoke();
        }
        private void gather()
        {
            _helperAssignProperty.AssingnProperty("entity_gather", "from_interface", _entity, _interfaceInstance);

            OnRefresh?.Invoke();
        }