/// <summary>
 ///
 /// </summary>
 /// <param name="transactionIdentifier"></param>
 public void OnDeleteTransaction(Guid transactionIdentifier)
 {
     if (Transactions.RemoveAll(transactionInformation => transactionInformation.Id == transactionIdentifier) > 0)
     {
         OnRefresh?.Invoke();
     }
 }
示例#2
0
 /// <summary>
 /// The Finish
 /// </summary>
 public void Finish()
 {
     OnRefresh?.Invoke();
     Stats.Finish();
     State = new FinishedState();
     OnFinish?.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();
        }
示例#4
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 CenteredRefresher(
     List <Widget> children,
     IndicatorBuilder headerBuilder = null,
     IndicatorBuilder footerBuilder = null,
     Config headerConfig            = null,
     Config footerConfig            = null,
     bool enablePullUp             = DefaultConstants.default_enablePullUp,
     bool enablePullDown           = DefaultConstants.default_enablePullDown,
     bool enableOverScroll         = DefaultConstants.default_enableOverScroll,
     OnRefresh onRefresh           = null,
     OnOffsetChange onOffsetChange = null,
     RefreshController controller  = null,
     NotificationListenerCallback <ScrollNotification> onNotification = null,
     Key key         = null,
     int centerIndex = 0
     ) : base(key)
 {
     this.children      = children;
     this.headerBuilder =
         headerBuilder ?? ((context, mode) => new SmartRefreshHeader(mode, RefreshHeaderType.other));
     this.footerBuilder    = footerBuilder ?? ((context, mode) => new SmartRefreshFooter(mode));
     this.headerConfig     = headerConfig ?? new RefreshConfig();
     this.footerConfig     = footerConfig ?? new LoadConfig(triggerDistance: 0);
     this.enablePullUp     = enablePullUp;
     this.enablePullDown   = enablePullDown;
     this.enableOverScroll = enableOverScroll;
     this.onRefresh        = onRefresh;
     this.onOffsetChange   = onOffsetChange;
     this.controller       = controller ?? new RefreshController();
     this.onNotification   = onNotification;
     this.centerIndex      = centerIndex;
 }
示例#6
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();
        }
 public void ChangeConditionAtIndex(int index, string newCondition)
 {
     Conditions[index].Object.Condition = newCondition;
     Conditions.Refresh();
     OnDataChanged?.Invoke();
     OnRefresh?.Invoke();
 }
示例#8
0
 public SectionView(
     int sectionCount,
     RowCountInSectionCallBack numOfRowInSection,
     CellAtIndexPathCallBack cellAtIndexPath,
     SectionHeaderCallBack headerInSection = null,
     RefreshController controller          = null,
     bool enablePullDown  = DefaultConstants.default_enablePullDown,
     bool enablePullUp    = DefaultConstants.default_enablePullUp,
     OnRefresh onRefresh  = null,
     bool hasBottomMargin = false,
     Widget headerWidget  = null,
     Widget footerWidget  = null,
     bool hasScrollBar    = true,
     bool hasRefresh      = true,
     Key key = null
     ) : base(key: key)
 {
     this.sectionCount      = sectionCount;
     this.numOfRowInSection = numOfRowInSection;
     this.cellAtIndexPath   = cellAtIndexPath;
     this.headerInSection   = headerInSection;
     this.controller        = controller;
     this.enablePullDown    = enablePullDown;
     this.enablePullUp      = enablePullUp;
     this.onRefresh         = onRefresh;
     this.hasBottomMargin   = hasBottomMargin;
     this.headerWidget      = headerWidget;
     this.footerWidget      = footerWidget;
     this.hasScrollBar      = hasScrollBar;
     this.hasRefresh        = hasRefresh;
 }
示例#9
0
 public SmartRefresher(
     ScrollView child,
     float initialOffset            = 0f,
     IndicatorBuilder headerBuilder = null,
     IndicatorBuilder footerBuilder = null,
     Config headerConfig            = null,
     Config footerConfig            = null,
     bool enablePullUp             = DefaultConstants.default_enablePullUp,
     bool enablePullDown           = DefaultConstants.default_enablePullDown,
     bool enableOverScroll         = DefaultConstants.default_enableOverScroll,
     OnRefresh onRefresh           = null,
     OnOffsetChange onOffsetChange = null,
     RefreshController controller  = null,
     NotificationListenerCallback <ScrollNotification> onNotification = null,
     Key key = null
     ) : base(key)
 {
     this.child         = child;
     this.initialOffset = initialOffset;
     this.headerBuilder =
         headerBuilder ?? ((context, mode) => new SmartRefreshHeader(mode, RefreshHeaderType.other));
     this.footerBuilder    = footerBuilder ?? ((context, mode) => new SmartRefreshFooter(mode));
     this.headerConfig     = headerConfig ?? new RefreshConfig();
     this.footerConfig     = footerConfig ?? new LoadConfig(triggerDistance: 0);
     this.enablePullUp     = enablePullUp;
     this.enablePullDown   = enablePullDown;
     this.enableOverScroll = enableOverScroll;
     this.onRefresh        = onRefresh;
     this.onOffsetChange   = onOffsetChange;
     this.controller       = controller ?? new RefreshController();
     this.onNotification   = onNotification;
 }
示例#10
0
        protected override async void OnItemDeletedAsync(object obj)
        {
            Shop shop = obj as Shop;

            if (shop.Status == ShopStatus.Approved)
            {
                await Page.DisplayAlert($"کێشەیەک ڕوویدا", $"ناتوانیت ئەم تۆمارە بسڕیتەوە لەبەرئەوەی پەسەندکراوە.", "باشە");

                return;
            }
            bool shouldDelete = await Page.DisplayAlert($"Delete {shop.KurdishName}", $"Are you sure you want to delete {shop.KurdishName}?", "Yes", "No");

            if (shouldDelete)
            {
                await DataManager.Default.ShopTable.DeleteAsync(shop);

                foreach (var album in await DataManager.Default.AlbumTable.Where(a => a.ShopID == shop.ID).ToEnumerableAsync())
                {
                    foreach (var image in await DataManager.Default.AlbumImageTable.Where(a => a.AlbumID == album.ID).ToEnumerableAsync())
                    {
                        await DataManager.Default.AlbumImageTable.DeleteAsync(image);
                    }

                    await DataManager.Default.AlbumTable.DeleteAsync(album);
                }
                foreach (var subCat in await DataManager.Default.ShopSubcategoryTable.Where(s => s.ShopID == shop.ID).ToEnumerableAsync())
                {
                    await DataManager.Default.ShopSubcategoryTable.DeleteAsync(subCat);
                }
                OnRefresh.Execute(null);
            }
        }
示例#11
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);
        }
 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);
     }
 }
示例#13
0
 public WaitForm()
 {
     InitializeComponent();
     this.TopMost = true;
     OutRefresh += new OnRefresh(WaitForm_OutRefresh);
     //onEndLoad += new EndLoadDelegate(WaitForm_onEndLoad);
 }
示例#14
0
 public CustomListView(
     RefreshController controller = null,
     bool enablePullUp            = DefaultConstants.default_enablePullUp,
     bool enablePullDown          = DefaultConstants.default_enablePullDown,
     OnRefresh onRefresh          = null,
     bool hasBottomMargin         = false,
     int?itemCount = null,
     IndexedWidgetBuilder itemBuilder = null,
     Widget headerWidget = null,
     Widget footerWidget = null,
     bool hasScrollBar   = true,
     bool hasRefresh     = true,
     Key key             = null
     ) : base(key: key)
 {
     D.assert(() => {
         if (this.hasRefresh)
         {
             return(this.onRefresh != null);
         }
         return(true);
     });
     this.controller      = controller;
     this.enablePullUp    = enablePullUp;
     this.enablePullDown  = enablePullDown;
     this.onRefresh       = onRefresh;
     this.hasBottomMargin = hasBottomMargin;
     this.itemCount       = itemCount;
     this.itemBuilder     = itemBuilder;
     this.headerWidget    = headerWidget;
     this.footerWidget    = footerWidget;
     this.hasScrollBar    = hasScrollBar;
     this.hasRefresh      = hasRefresh;
 }
示例#15
0
 /// <summary>
 /// Easy way to post a refresh event.
 /// </summary>
 public static void Refresh()
 {
     // Invoke event
     if (null != OnRefresh)
     {
         OnRefresh.Invoke();
     }
 }
示例#16
0
 protected CurvyCGEventArgs OnRefreshEvent(CurvyCGEventArgs e)
 {
     if (OnRefresh != null)
     {
         OnRefresh.Invoke(e);
     }
     return(e);
 }
示例#17
0
 /// <summary>
 /// The TrocarPecaAtual
 /// </summary>
 private void TrocarPecaAtual()
 {
     GuardarBlocos();
     CurrentPiece = NextPiece.Clone();
     NextPiece    = CreateRandomBlock();
     Stats.IncludeBlock();
     OnRefresh?.Invoke();
 }
示例#18
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();
        }
示例#19
0
 private void ClearPossibles()
 {
     while (possibleCells.Count > 0)
     {
         Cell removedCell = possibleCells[0];
         possibleCells.RemoveAt(0);
         OnRefresh?.Invoke(removedCell.x, removedCell.y);
     }
 }
示例#20
0
 public void WaitForm_OutRefresh()
 {
     if (this.InvokeRequired)
     {
         OnRefresh del = new OnRefresh(WaitForm_OutRefresh);
         this.Invoke(del);
     }
     else
         this.Refresh();
 }
        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();
        }
示例#23
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);
                }
            }
        }
示例#24
0
        public async Task <bool> Refresh()
        {
            if (PagingStyle == PagingStyle.LoadMore)
            {
                Data = new List <DisplayableItem <TItem> >();
            }

            await UpdateCurrentData();

            await OnRefresh.InvokeAsync();

            return(string.IsNullOrEmpty(ErrorText));
        }
示例#25
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();
        }
示例#29
0
 // notify about new received telegram
 public virtual void NotifyRcv(Telegram tel)
 {
     try
     {
         foreach (DispatchNode prop in DispatchRcv)
         {
             if (prop.DispatchTerm(tel))
             {
                 prop.DispatchTo(tel);
             }
         }
         OnRefresh.ForEach(prop => prop?.Invoke());
     }
     catch (Exception e)
     {
         Log.AddLog(Log.Severity.EXCEPTION, Name, "Communication.NotifyRvc", e.Message);
     }
 }
示例#30
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();
        }
        private void Refresh()
        {
            EditorApplication.playModeStateChanged -= EditorApplication_playModeStateChanged;
            EditorApplication.playModeStateChanged += EditorApplication_playModeStateChanged;

            Undo.undoRedoPerformed -= OnUndoRedo;
            Undo.undoRedoPerformed += OnUndoRedo;

            EditorSceneManager.sceneOpened -= EditorSceneManager_sceneOpened;
            EditorSceneManager.sceneOpened += EditorSceneManager_sceneOpened;

            if (sceneManager == null)
            {
                return;
            }

            if (sceneManager.Transitioner != null)
            {
                sceneManager.Transitioner.OnTransitionCompleted.RemoveListener(OnTransitioned);
                sceneManager.Transitioner.OnTransitionCompleted.AddListener(OnTransitioned);

                sceneManager.Transitioner.OnTransitionStarted.RemoveListener(OnTransitionStarted);
                sceneManager.Transitioner.OnTransitionStarted.AddListener(OnTransitionStarted);
            }

            sceneManager.SceneVariables.OnVariableChanged -= SceneVariables_OnVariableChanged;
            sceneManager.SceneVariables.OnVariableChanged += SceneVariables_OnVariableChanged;

            SerializedSceneManager = new SerializedSceneManager(sceneManager);
            serializedSceneManager.SetActiveScene();

            isInitialized = false;

            if (!EditorApplication.isPlaying)
            {
                sceneManager.SceneVariables.ResetVariables();
            }

            needsRefresh = false;

            OnRefresh.SafeInvoke(this, System.EventArgs.Empty);

            Repaint();
        }