Exemplo n.º 1
0
 public virtual void RaiseChangedEvent(ListWithChangedEventArgs e)
 {
     if (Changed != null)
     {
         Changed.Invoke(this, e);
     }
 }
Exemplo n.º 2
0
        /// <summary>User has changed the selection.</summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void OnSelectionChanged(object sender, EventArgs e)
        {
            if (Changed != null)
            {
                Changed.Invoke(this, e);
            }
        }
Exemplo n.º 3
0
 private void OnPropertyChanged()
 {
     if (Changed != null)
     {
         Changed.Invoke();
     }
 }
Exemplo n.º 4
0
 private void Raise()
 {
     if (Changed != null)
     {
         Changed.Invoke(new TimeSpan((long)(frames * 166666.6666666667)).ToString("mm':'ss'.'fff"));
     }
 }
Exemplo n.º 5
0
 void OnChanged(TKey key, TValue value)
 {
     if (null != Changed)
     {
         Changed.Invoke(this, new DictionaryChangedEventArgs <TKey, TValue>(key, value));
     }
 }
Exemplo n.º 6
0
        public static void Create(string backupName, int terrainGroupId, List <GTerrainResourceFlag> flags)
        {
            List <GStylizedTerrain> terrains = new List <GStylizedTerrain>(GStylizedTerrain.ActiveTerrains);

            for (int i = 0; i < terrains.Count; ++i)
            {
                GStylizedTerrain t = terrains[i];
                if (t.TerrainData == null)
                {
                    continue;
                }
                if (terrainGroupId >= 0 && terrainGroupId != t.GroupId)
                {
                    continue;
                }
                try
                {
                    BackupTerrain(t, backupName, flags);
                }
                catch (System.Exception e)
                {
                    Debug.LogError(string.Format("Error on creating backup for {0}: {1}", t.name, e.ToString()));
                }
            }

            GBackupFile.SetBackupCreationTime(backupName, System.DateTime.Now);
            GUndoCompatibleBuffer.Instance.CurrentBackupName = backupName;
            if (Changed != null)
            {
                Changed.Invoke();
            }
        }
Exemplo n.º 7
0
    /// <summary>
    /// HitTile hits a tile at a row/col, and whatever tile has been hit, a
    /// result will be displayed.
    /// </summary>
    /// <param name="row">the row at which is being shot</param>
    /// <param name="col">the cloumn at which is being shot</param>
    /// <returns>An attackresult (hit, miss, sunk, shotalready)</returns>
    public AttackResult HitTile(int row, int col)
    {
        try
        {
            // tile is already hit
            if (_GameTiles[row, col].Shot)
            {
                return(new AttackResult(ResultOfAttack.ShotAlready, "have already attacked [" + col.ToString() + "," + row.ToString() + "]!", row, col));
            }

            _GameTiles[row, col].Shoot();

            // there is no ship on the tile
            if (_GameTiles[row, col].Ship == null)
            {
                return(new AttackResult(ResultOfAttack.Miss, "missed", row, col));
            }

            // all ship's tiles have been destroyed
            if (_GameTiles[row, col].Ship.IsDestroyed)
            {
                _GameTiles[row, col].Shot = true;
                _ShipsKilled += 1;
                return(new AttackResult(ResultOfAttack.Destroyed, _GameTiles[row, col].Ship, "destroyed the enemy's", row, col));
            }

            // else hit but not destroyed
            return(new AttackResult(ResultOfAttack.Hit, "hit something!", row, col));
        }
        finally
        {
            Changed.Invoke(this, EventArgs.Empty);
        }
    }
Exemplo n.º 8
0
 private void Notify()
 {
     if (Changed != null)
     {
         Changed.Invoke();
     }
 }
Exemplo n.º 9
0
 internal void RaiseChanged()
 {
     if (Changed != null)
     {
         Changed.Invoke(this);
     }
 }
Exemplo n.º 10
0
 private void Raise()
 {
     if (Changed != null)
     {
         Changed.Invoke(total);
     }
 }
Exemplo n.º 11
0
 private void PropertyChangedOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
 {
     if (propertyChangedEventArgs.PropertyName == _memberName)
     {
         Changed.Invoke(this, new PropertyValueChangedEventArgs(_memberName));
     }
 }
Exemplo n.º 12
0
        private void ProcessImage(string imagePath)
        {
            if (imagePath.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase) &&
                !_repository.AssetExists(imagePath))
            {
                Thumbnail thumbnail;
                using (Image <Rgba32> image = Image.Load(imagePath))
                {
                    image.Mutate(x => x
                                 .Resize(image.Width / 16, image.Height / 16)
                                 .Grayscale());

                    using (var ms = new MemoryStream())
                    {
                        image.Save(ms, JpegFormat.Instance);
                        thumbnail = new Thumbnail {
                            Raw = ms.ToArray()
                        };
                    }
                }

                var asset = new Asset {
                    Path = imagePath
                };
                thumbnail.AssetGuid = asset.Guid;

                _repository.AddAsset(asset, thumbnail);
                if (Changed != null)
                {
                    Changed.Invoke(asset, new EventArgs());
                }
            }
        }
        //int captureCount = 0;

        #region Timer

        void refreshTimer_Elapsed(object sender, ElapsedEventArgs e)
        {
            _runs++;

            if (Changed != null && (_runs % (tickMod) == 0))
            {
                if (_runs >= tickMod)
                {
                    _runs = 0;
                }
                using (Image sc = capture())
                {
                    if (sc != null)
                    {
                        try
                        {
                            Changed.Invoke(this, new CaptureChangedEventArgs(sc));
                        }
                        catch { }
                    }
                    else
                    {
                        //TODO: what happens if the Image is null?
                    }
                }
            }
        }
Exemplo n.º 14
0
        public void Set(string path, object val)
        {
            string[] data = path.Split('.');
            int      i    = 0;
            object   obj  = Data;

            while (i < data.Length - 1)
            {
                dynamic nobj = ((Dictionary <object, object>)obj).ContainsKey(data[i]) ? ((Dictionary <object, object>)obj)[data[i]] : null;
                if (nobj == null || !(nobj is Dictionary <object, object>))
                {
                    nobj = new Dictionary <dynamic, dynamic>();
                    ((Dictionary <object, object>)obj)[data[i]] = nobj;
                }
                obj = nobj;
                i++;
            }
            if (val == null)
            {
                ((Dictionary <object, object>)obj).Remove(data[i]);
            }
            else
            {
                ((Dictionary <object, object>)obj)[data[i]] = val;
            }
            if (Changed != null)
            {
                Changed.Invoke(this, new EventArgs());
            }
        }
Exemplo n.º 15
0
 public void Refresh()
 {
     if (Changed != null)
     {
         Changed.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 16
0
 private void RaiseChanged()
 {
     if (Changed != null)
     {
         Changed.Invoke();
     }
 }
Exemplo n.º 17
0
 private void Raise()
 {
     if (Changed != null)
     {
         Changed.Invoke(keyStates);
     }
 }
Exemplo n.º 18
0
 void timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     if (Changed != null)
     {
         Changed.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 19
0
        private void RescanInternal()
        {
            if (!rescanning)
            {
                Debug("Rescanning disabled");
                return;
            }

            Task.Factory.StartNew(() =>
            {
                if (Changing != null)
                {
                    Changing.Invoke(this, EventArgs.Empty);
                }

                try {
                    NoticeFormat("Rescanning {0}...", FriendlyName);
                    DoRoot();
                    NoticeFormat("Done rescanning {0}...", FriendlyName);
                }
                catch (Exception ex) {
                    Error(ex);
                }


                if (Changed != null)
                {
                    Changed.Invoke(this, EventArgs.Empty);
                }
            },
                                  TaskCreationOptions.AttachedToParent | TaskCreationOptions.LongRunning);
        }
Exemplo n.º 20
0
        private void Rescan()
        {
            Task.Factory.StartNew(() =>
            {
                if (Changing != null)
                {
                    Changing.Invoke(this, EventArgs.Empty);
                }

                try {
                    InfoFormat("Rescanning...");
                    DoRoot();
                    InfoFormat("Done rescanning...");
                }
                catch (Exception ex) {
                    Error(ex);
                }


                if (Changed != null)
                {
                    Changed.Invoke(this, EventArgs.Empty);
                }
            }, TaskCreationOptions.AttachedToParent | TaskCreationOptions.LongRunning);
        }
Exemplo n.º 21
0
 private void change_EventHandler()
 {
     if (Changed != null)
     {
         Changed.Invoke();
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// The OnChanged-Event was catched if the FileSystemWatcher has noticed
 /// some changed to the specified deltaDB
 /// </summary>
 /// <param name="source"></param>
 /// <param name="args"></param>
 public void OnChanged(object source, FileSystemEventArgs args)
 {
     if (Changed != null)
     {
         Changed.Invoke(source, this);
     }
 }
Exemplo n.º 23
0
 void OnChanged()
 {
     if (null != Changed)
     {
         Changed.Invoke(this, null);
     }
 }
Exemplo n.º 24
0
 protected void fireChanged()
 {
     if (Changed != null)
     {
         Changed.Invoke(this);
     }
 }
Exemplo n.º 25
0
        /// <summary>
        ///     Unloads a Assambly From the Mef Container.
        ///     It does NOT unload it from the Domain
        /// </summary>
        /// <param name="assambly">Your Target assambly</param>
        public void FreeAssambly(Assembly assambly)
        {
            var assemblyName = assambly.Location;
            var all          = _aggregateCatalog.Catalogs.Where(s =>
            {
                var assemblyCatalog = s as AssemblyCatalog;
                if (assemblyCatalog != null)
                {
                    var assamblName = assemblyCatalog.Assembly;
                    var fn          = assamblName.Location;
                    return(assemblyName == fn);
                }
                return(false);
            }).Cast <AssemblyCatalog>();

            var assemblyCatalogs = all as AssemblyCatalog[] ?? all.ToArray();

            if (!assemblyCatalogs.Any())
            {
                ImportPool.AddImportFailMessage(assambly);
                return;
            }

            AssemblyCatalog first;

            if (assemblyCatalogs.Count() != 1)
            {
                var version = assemblyCatalogs.Max(s => AssemblyName.GetAssemblyName(s.Assembly.FullName).Version);
                first =
                    assemblyCatalogs.FirstOrDefault(
                        s => AssemblyName.GetAssemblyName(s.Assembly.FullName).Version == version);
            }
            else
            {
                first = assemblyCatalogs.FirstOrDefault();
            }

            if (first != null)
            {
                var parts = first.Parts;

                if (Changing != null)
                {
                    Changing.Invoke(this,
                                    new ComposablePartCatalogChangeEventArgs(new List <ComposablePartDefinition>(), parts,
                                                                             null));
                }

                _aggregateCatalog.Catalogs.Remove(first);

                ImportPool.AddSuccessExcludedMessage(assambly);

                if (Changed != null)
                {
                    Changed.Invoke(this,
                                   new ComposablePartCatalogChangeEventArgs(new List <ComposablePartDefinition>(), parts,
                                                                            null));
                }
            }
        }
Exemplo n.º 26
0
 void OnChanged()
 {
     if (Changed != null)
     {
         Changed.Invoke(this, new EventArgs());
     }
 }
Exemplo n.º 27
0
        // ===========================================================================
        // = Private Methods
        // ===========================================================================

        private void RaiseChanged()
        {
            if (Changed != null)
            {
                Changed.Invoke(this, EventArgs.Empty);
            }
        }
Exemplo n.º 28
0
 /// <summary>
 /// Method called to invoke changes on the list.
 /// </summary>
 /// <param name="args">ListChangedEventArgs object with generic type T.</param>
 protected virtual void DoWhenChanged(ListChangedEventArgs <T> args)
 {
     if (null != Changed)
     {
         Changed.Invoke(this, args);
     }
 }
Exemplo n.º 29
0
 /// <summary>
 /// MyGrid_Changed causes the grid to be redrawn by raising a changed event
 /// </summary>
 /// <param name="sender">the object that caused the change</param>
 /// <param name="e">what needs to be redrawn</param>
 private void MyGrid_Changed(object sender, EventArgs e)
 {
     if (Changed != null)
     {
         Changed.Invoke(this, e);
     }
 }
Exemplo n.º 30
0
        protected void OnChanged(ObjectCollectionChangeMode changeMode, int position, ObjectBuilder builder)
        {
            var args = new ObjectCollectionChangedEventArgs(changeMode, position, builder);

            //Must not hold the lock when this event is triggered
            Changed.Invoke(args);
        }