Ejemplo n.º 1
0
 private void OnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     if (UnitsChanged != null)
     {
         UnitsChanged(action, affectedUnit);
     }
 }
Ejemplo n.º 2
0
 public static void UpdateList(ListAction action, RaidBotClient bot)
 {
     UpdateList(action, new List <RaidBotClient>()
     {
         bot
     });
 }
Ejemplo n.º 3
0
    public static ListAction Create(int max_)
    {
        ListAction l = new ListAction();

        l.Start(max_);
        return(l);
    }
Ejemplo n.º 4
0
 private void OnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     if (UnitsChanged != null)
     {
         UnitsChanged(action, affectedUnit);
     }
 }
Ejemplo n.º 5
0
 internal ActionEventArgs(ListAction acton, T oldVal, T newVal, bool cancl)
 {
     setOldValue = oldVal;
     item        = newVal;
     action      = acton;
     cancel      = cancl;
 }
Ejemplo n.º 6
0
        private static void ListRequest(ListRequest listRequest, ListAction action, bool blocking)
        {
            if (listRequest == null)
            {
                listRequest = UnityEditor.PackageManager.Client.List(true, true);
            }

            if (listRequest.IsCompleted)
            {
                if (listRequest.Status == StatusCode.Success)
                {
                    action(listRequest.Result, false);
                }
            }
            else
            {
                if (blocking)
                {
                    while (!listRequest.IsCompleted)
                    {
                        Thread.Sleep(10);
                    }
                    ListRequest(listRequest, action, true);
                }
                else
                {
                    EditorApplication.delayCall += () => ListRequest(listRequest, action, false);
                }
            }
        }
Ejemplo n.º 7
0
 internal ActionEventArgs(ListAction acton, int _startIndex, int _count, bool cancl)
 {
     index  = _startIndex;
     count  = _count;
     cancel = cancl;
     action = acton;
 }
Ejemplo n.º 8
0
        public override async Task <object> Fetch()
        {
            var u = new Uri(uri);

            using (var stream = await ListAction.Action(u, new BaseQuery(this)))
            {
                return(BaseResource.FromStream(u, stream));
            }
        }
Ejemplo n.º 9
0
        protected virtual void OnShellstarListChanged(ListAction action, IShellstarModel shellstar)
        {
            ShellstarListChangedDelegate handler = ShellstarListChanged;

            if (handler != null)
            {
                handler(action, shellstar);
            }
        }
Ejemplo n.º 10
0
        protected virtual void OnCounterfireUpdated(ListAction action, ShellstarInfo affectedShellstar)
        {
            var handler = CounterfireUpdated;

            if (handler != null)
            {
                handler(action, affectedShellstar);
            }
        }
Ejemplo n.º 11
0
        public void List(string path)
        {
            var action = new ListAction();
            var uri = new UriBuilder(_server)
            {
                Path = path
            };

            _client.Request(action,
                uri.Uri, null);
        }
Ejemplo n.º 12
0
 private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     switch (action)
     {
         case ListAction.Reset:
             ResetSelection();
             return;
         case ListAction.Removed:
             Deselect(affectedUnit);
             return;
     }
 }
Ejemplo n.º 13
0
        public ListRequest(ListAction action, List <RaidBotClient> bots) : base(ListOpcode.List)
        {
            List <BasicBotInfo> info = new List <BasicBotInfo>();

            foreach (var client in bots)
            {
                info.Add(BasicBotInfo.FromClient(client));
            }
            _bots = info;

            _action = action;
        }
Ejemplo n.º 14
0
        private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
        {
            switch (action)
            {
            case ListAction.Reset:
                ResetSelection();
                return;

            case ListAction.Removed:
                Deselect(affectedUnit);
                return;
            }
        }
Ejemplo n.º 15
0
        public static void ChangeListener(ListAction listAction)
        {
            switch (listAction)
            {
            case ListAction.Add:
                Console.WriteLine("Vehicle was added.");
                break;

            case ListAction.Remove:
                Console.WriteLine("Vehicle was removed.");
                break;
            }
        }
Ejemplo n.º 16
0
        internal static void UpdateCategories(ListAction action, int todoId, ArrayList categories, bool checkAccess)
        {
            if (checkAccess)
            {
                VerifyCanUpdate(todoId);
            }

            ArrayList oldCategories = new ArrayList();

            using (IDataReader reader = ToDo.GetListCategories(todoId))
            {
                Common.LoadCategories(reader, oldCategories);
            }
            Common.UpdateList(action, oldCategories, categories, OBJECT_TYPE, todoId, SystemEventTypes.Todo_Updated_GeneralCategories, new UpdateListDelegate(Common.ListUpdate), null);
        }
Ejemplo n.º 17
0
        public async Task <ActionResult <JObject> > ListActionAsync([FromBody] ListAction <int> data)
        {
            Expression <Func <MixPosition, bool> > predicate = model =>
                                                               data.Data.Contains(model.Id);
            var result = new RepositoryResponse <bool>();

            switch (data.Action)
            {
            case "Delete":
                return(Ok(JObject.FromObject(await base.DeleteListAsync <UpdateViewModel>(predicate, true))));

            default:
                return(JObject.FromObject(new RepositoryResponse <bool>()));
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// SOCKET集合同步操作
        /// </summary>
        /// <param name="item"></param>
        /// <param name="action"></param>
        private void ListOperator(SocketObject item, ListAction action)
        {
            lock (obj)
            {
                switch (action)
                {
                case ListAction.Add:
                    socketObjList.Add(item);
                    break;

                case ListAction.Delete:
                    socketObjList.Remove(item);
                    break;
                }
            }
        }
        public async Task<ActionResult<JObject>> ListActionAsync([FromBody]ListAction<int> data)
        {
            Expression<Func<MixAttributeSet, bool>> predicate = model =>
                       data.Data.Contains(model.Id);
            var result = new RepositoryResponse<bool>();
            switch (data.Action)
            {
                case "Delete":
                    return Ok(JObject.FromObject(await base.DeleteListAsync<DeleteViewModel>(predicate, true)));

                case "Export":
                    return Ok(JObject.FromObject(await base.ExportListAsync(predicate, MixEnums.MixStructureType.AttributeSet)));

                default:
                    return JObject.FromObject(new RepositoryResponse<bool>());
            }
        }
        private void UpdateGridMooving(ListAction action)
        {
            if (action == ListAction.AddToList)
            {
                for (int i = 0; i < moovingList.Count; i++)
                {
                    bool goodsIdAdded = comboGoods.SelectedItem.ToString().Equals(moovingList[i].GoodsName) ?
                                        true : false;
                    bool warehouseSourceIsAdded = comboWarehouseSource.SelectedItem.ToString().Equals(moovingList[i].WarehouseSourse) ?
                                                  true : false;

                    if (goodsIdAdded && warehouseSourceIsAdded)
                    {
                        string goodsName       = moovingList[i].GoodsName;
                        string warehouseSource = moovingList[i].WarehouseSourse;
                        MessageBox.Show(string.Format("Товар {0} от поставщика {1} уже есть в списке. " +
                                                      "Для изменения количества или цены дважды кликните в соответствующем поле",
                                                      goodsName, warehouseSource),
                                        "Найдено совпадение", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        return;
                    }
                }
                moovingList.Add(new MoovingGoodsToSale
                {
                    RowNumber       = moovingList.Count + 1,
                    GoodsName       = comboGoods.SelectedItem.ToString(),
                    GoodsQuantity   = numUpDown.Value.ToString(),
                    MeasureUnit     = lblMeasure.Content.ToString(),
                    GoodsPrice      = tbGoodsPrice.Text,
                    WarehouseSourse = comboWarehouseSource.SelectedItem.ToString()
                });
            }

            else if (action == ListAction.DeleteFromList)
            {
                moovingList.RemoveAt(gridMooving.SelectedIndex);
                for (int i = 0; i < moovingList.Count; i++)
                {
                    moovingList[i].RowNumber = i + 1;
                }
            }

            gridMooving.ItemsSource = null;
            gridMooving.ItemsSource = moovingList;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Lisää ja poistaa jonossa olevat elementit, mutta ei kutsu
        /// elementtien Update-metodia.
        /// </summary>
        /// <returns>Muutettiinko listaa</returns>
        public bool UpdateChanges()
        {
            if (actions.Count == 0)
            {
                return(false);
            }

            while (actions.Count > 0)
            {
                ListAction action = actions.Dequeue();
                switch (action.Operation)
                {
                case ListOperation.Add:
                    if (Contains(action.Item))
                    {
                        break;
                    }

                    items.Add(action.Item);
                    OnItemAdded(action.Item);
                    break;

                case ListOperation.Remove:
                    if (items.Remove(action.Item))
                    {
                        OnItemRemoved(action.Item);
                    }
                    break;

                case ListOperation.Clear:
                    foreach (var item in this)
                    {
                        OnItemRemoved(item);
                    }

                    items.Clear();
                    break;
                }
            }

            toBeAdded.Clear();
            AmountToBeAdded = 0;
            return(true);
        }
Ejemplo n.º 22
0
        public async Task <ActionResult <JObject> > ListActionAsync([FromBody] ListAction <int> data)
        {
            Expression <Func <MixPost, bool> > predicate = model =>
                                                           model.Specificulture == _lang &&
                                                           data.Data.Contains(model.Id);
            var result = new RepositoryResponse <bool>();

            switch (data.Action)
            {
            case "Delete":
                return(Ok(JObject.FromObject(await base.DeleteListAsync <RemoveViewModel>(predicate, true))));

            case "Export":
                return(Ok(JObject.FromObject(await base.ExportListAsync(predicate, MixStructureType.Module))));

            default:
                return(JObject.FromObject(new RepositoryResponse <bool>()));
            }
        }
Ejemplo n.º 23
0
 private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
 {
     switch (action)
     {
         case ListAction.Added:
             _units.Add(new UnitInfoPaneViewModel(affectedUnit, _unitSetupModel, _navigationService));
             return;
         case ListAction.Removed:
             var affectedVm = _units.SingleOrDefault(un => un.Model == affectedUnit);
             if (affectedUnit != null)
             {
                 _units.Remove(affectedVm);
             }
             return;
         case ListAction.Reset:
             _units.Clear();
             _unitListModel.Models.ForEach(um => _units.Add(new UnitInfoPaneViewModel(um, _unitSetupModel, _navigationService)));
             return;
     }
 }
Ejemplo n.º 24
0
        public async Task <ActionResult <JObject> > ListActionAsync([FromBody] ListAction <string> data)
        {
            Expression <Func <TModel, bool> > predicate = ReflectionHelper.GetExpression <TModel>(
                MixQueryColumnName.Specificulture,
                _lang,
                ExpressionMethod.Eq);
            Expression <Func <TModel, bool> > idPre = null;

            foreach (var id in data.Data)
            {
                var temp = ReflectionHelper.GetExpression <TModel>(MixQueryColumnName.Id, id, ExpressionMethod.Eq);

                idPre = idPre != null
                    ? idPre.AndAlso(temp)
                    : temp;
            }
            if (idPre != null)
            {
                predicate = predicate.AndAlso(idPre);

                switch (data.Action)
                {
                case "Delete":
                    return(Ok(JObject.FromObject(await DeleteListAsync(predicate, true))));

                case "Publish":
                    return(Ok(JObject.FromObject(await PublishListAsync(predicate))));

                case "Export":
                    return(Ok(JObject.FromObject(await ExportListAsync(predicate))));

                default:
                    return(JObject.FromObject(new RepositoryResponse <bool>()));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
        //Updates Controller and Action
        public ActionResult UpdateBusiness(string nameSpace, string returnUrl = "Index")
        {
            //LAy danh sach Contorller va Action
            ReflectionController rc = new ReflectionController();
            List <Type>          listControllerType = rc.GetControllers("TeduCoreApp.Areas.Admin.Controllers");
            List <string>        listControllerOld  = _context.ListControllers.Select(c => c.ControllerName).ToList();
            List <string>        listActionOld      = _context.ListActions.Select(p => p.ActionName).ToList();

            foreach (var c in listControllerType)
            {
                if (!listControllerOld.Contains(c.Name))
                {
                    ListController b = new ListController()
                    {
                        ControllerName = c.Name, DiscriptionAction = "Chưa có mô tả"
                    };
                    _context.ListControllers.Add(b);
                    _context.SaveChanges();
                }

                List <string> listAction = rc.GetActions(c);

                foreach (var p in listAction)
                {
                    if (!listActionOld.Contains(c.Name + "-" + p))
                    {
                        var        controllerOld = _context.ListControllers.SingleOrDefault(x => x.ControllerName == c.Name);
                        ListAction action        = new ListAction()
                        {
                            IdController = controllerOld.Id, ActionName = c.Name + "-" + p, Discription = "Chưa có mô tả"
                        };
                        _context.ListActions.Add(action);
                    }
                }
            }
            _context.SaveChanges();
            TempData["err"] = "<div class='alert alert-info' role='alert'><span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span><span class='sr-only'></span>Cập Nhật thành công</div>";
            return(RedirectToAction(returnUrl));
        }
Ejemplo n.º 26
0
        private void UnitListModelOnUnitsChanged(ListAction action, IUnitModel affectedUnit)
        {
            switch (action)
            {
            case ListAction.Added:
                _units.Add(new UnitInfoPaneViewModel(affectedUnit, _unitSetupModel, _navigationService));
                return;

            case ListAction.Removed:
                var affectedVm = _units.SingleOrDefault(un => un.Model == affectedUnit);
                if (affectedUnit != null)
                {
                    _units.Remove(affectedVm);
                }
                return;

            case ListAction.Reset:
                _units.Clear();
                _unitListModel.Models.ForEach(um => _units.Add(new UnitInfoPaneViewModel(um, _unitSetupModel, _navigationService)));
                return;
            }
        }
Ejemplo n.º 27
0
        public async override Task <FileSize> GetSize(Action <BaseResource, List <BaseResource> > lambda)
        {
            List <BaseResource> contents;

            await Request.GetLock();

            try
            {
                using (var stream = await ListAction.Action(GetUri(), new Queries.BaseQuery()))
                {
                    contents = BaseResource.FromStream(GetUri(), stream);
                }
            }
            finally
            {
                Request.ReleaseLock();
            }

            lambda(this, contents);

            var subfolder = new List <Task>();

            foreach (var c in contents)
            {
                subfolder.Add(Task.Run(async() =>
                {
                    var s        = await c.GetSize(lambda);
                    var sizeLock = new object();
                    lock (sizeLock)
                    {
                        Size += s;
                    }
                }));
            }
            await Task.WhenAll(subfolder);

            return(Size);
        }
        public async Task <ActionResult <JObject> > ListActionAsync([FromBody] ListAction <string> data)
        {
            Expression <Func <TModel, bool> > predicate = ReflectionHelper.GetExpression <TModel>("Specificulture", _lang, Heart.Enums.MixHeartEnums.ExpressionMethod.Eq);
            //ReflectionHelper.GetExpression<TModel>("Id", id, Heart.Enums.MixHeartEnums.ExpressionMethod.Eq);
            Expression <Func <TModel, bool> > idPre = null;

            foreach (var id in data.Data)
            {
                var temp = ReflectionHelper.GetExpression <TModel>("Id", id, Heart.Enums.MixHeartEnums.ExpressionMethod.Eq);
                idPre = idPre != null?ReflectionHelper.CombineExpression(idPre, temp, Heart.Enums.MixHeartEnums.ExpressionMethod.Or)
                            : temp;
            }
            if (idPre != null)
            {
                predicate = ReflectionHelper.CombineExpression(predicate, idPre, Heart.Enums.MixHeartEnums.ExpressionMethod.And);

                switch (data.Action)
                {
                case "Delete":
                    return(Ok(JObject.FromObject(await DeleteListAsync(predicate, true))));

                case "Publish":
                    return(Ok(JObject.FromObject(await PublishListAsync(predicate))));

                case "Export":
                    return(Ok(JObject.FromObject(await ExportListAsync(predicate))));

                default:
                    return(JObject.FromObject(new RepositoryResponse <bool>()));
                }
            }
            else
            {
                return(BadRequest());
            }
        }
Ejemplo n.º 29
0
 public static ListAction Create(int max_)
 {
     ListAction l = new ListAction();
     l.Start(max_);
     return l;
 }
Ejemplo n.º 30
0
    public Game()
    {
        one = 1;
        map = new Map();
        performanceinfo = new DictionaryStringString();
        AudioEnabled = true;
        AutoJumpEnabled = false;
        playerPositionSpawnX = 15 + one / 2;
        playerPositionSpawnY = 64;
        playerPositionSpawnZ = 15 + one / 2;

        TextureId = new int[MaxBlockTypes][];
        for (int i = 0; i < MaxBlockTypes; i++)
        {
            TextureId[i] = new int[6];
        }
        TextureIdForInventory = new int[MaxBlockTypes];
        language = new Language();
        lastplacedblockX = -1;
        lastplacedblockY = -1;
        lastplacedblockZ = -1;
        mLightLevels = new float[16];
        sunlight_ = 15;
        mvMatrix = new StackMatrix4();
        pMatrix = new StackMatrix4();
        mvMatrix.Push(Mat4.Create());
        pMatrix.Push(Mat4.Create());
        whitetexture = -1;
        cachedTextTexturesMax = 1024;
        cachedTextTextures = new CachedTextTexture[cachedTextTexturesMax];
        for (int i = 0; i < cachedTextTexturesMax; i++)
        {
            cachedTextTextures[i] = null;
        }
        packetLen = new IntRef();
        ENABLE_DRAW2D = true;
        AllowFreemove = true;
        enableCameraControl = true;
        textures = new DictionaryStringInt1024();
        ServerInfo = new ServerInformation();
        menustate = new MenuState();
        mouseleftclick = false;
        mouseleftdeclick = false;
        wasmouseleft = false;
        mouserightclick = false;
        mouserightdeclick = false;
        wasmouseright = false;
        ENABLE_LAG = 0;
        znear = one / 10;
        CameraMatrix = new GetCameraMatrix();
        ENABLE_ZFAR = true;
        TotalAmmo = new int[GlobalVar.MAX_BLOCKTYPES];
        LoadedAmmo = new int[GlobalVar.MAX_BLOCKTYPES];
        AllowedFontsCount = 1;
        AllowedFonts = new string[AllowedFontsCount];
        AllowedFonts[0] = "Verdana";
        fov = Game.GetPi() / 3;
        cameratype = CameraType.Fpp;
        ENABLE_TPP_VIEW = false;
        basemovespeed = 5;
        movespeed = 5;
        RadiusWhenMoving = one * 3 / 10;
        playervelocity = new Vector3Ref();
        LocalPlayerId = -1;
        dialogs = new VisibleDialog[512];
        dialogsCount = 512;
        blockHealth = new DictionaryVector3Float();
        playertexturedefault = -1;
        a = new AnimationState();
        constRotationSpeed = one * 180 / 20;
        modmanager = new ClientModManager1();
        particleEffectBlockBreak = new ModDrawParticleEffectBlockBreak();
        PICK_DISTANCE = 4.1f;
        selectedmodelid = -1;
        grenadetime = 3;
        rotationspeed = one * 15 / 100;
        entities = new Entity[entitiesMax];
        for (int i = 0; i < entitiesMax; i++)
        {
            entities[i] = null;
        }
        entitiesCount = 512;
        PlayerPushDistance = 2;
        const int KeysMax = 256;
        keyboardState = new bool[KeysMax];
        for (int i = 0; i < KeysMax; i++)
        {
            keyboardState[i] = false;
        }
        keyboardStateRaw = new bool[KeysMax];
        for (int i = 0; i < KeysMax; i++)
        {
            keyboardStateRaw[i] = false;
        }
        overheadcameradistance = 10;
        tppcameradistance = 3;
        TPP_CAMERA_DISTANCE_MIN = 1;
        TPP_CAMERA_DISTANCE_MAX = 10;
        options = new OptionsCi();
        overheadcameraK = new Kamera();
        fillAreaLimit = 200;
        speculativeCount = 0;
        speculative = new Speculative[speculativeMax];
        typinglog = new string[1024 * 16];
        typinglogCount = 0;
        NewBlockTypes = new Packet_BlockType[GlobalVar.MAX_BLOCKTYPES];
        localplayeranim = new AnimationState();
        localplayeranimationhint = new AnimationHint();
        enable_move = true;
        handTexture = -1;
        modelViewInverted = new float[16];
        GLScaleTempVec3 = Vec3.Create();
        GLRotateTempVec3 = Vec3.Create();
        GLTranslateTempVec3 = Vec3.Create();
        identityMatrix = Mat4.Identity_(Mat4.Create());
        Set3dProjectionTempMat4 = Mat4.Create();
        getAsset = new string[1024 * 2];
        PlayerStats = new Packet_ServerPlayerStats();
        mLightLevels = new float[16];
        for (int i = 0; i < 16; i++)
        {
            mLightLevels[i] = one * i / 15;
        }
        soundnow = new BoolRef();
        camera = Mat4.Create();
        packetHandlers = new ClientPacketHandler[256];
        player = new Entity();
        player.position = new EntityPosition_();
        currentlyAttackedEntity = -1;
        ChatLinesMax = 1;
        ChatLines = new Chatline[ChatLinesMax];
        ChatLineLength = 64;
        audio = new AudioControl();
        CameraEyeX = -1;
        CameraEyeY = -1;
        CameraEyeZ = -1;
        controls = new Controls();
        movedz = 0;
        taskScheduler = new TaskScheduler();
        commitActions = ListAction.Create(16 * 1024);
        constWallDistance = 0.3f;
        mouseSmoothing = true;
    }
Ejemplo n.º 31
0
 private void UnitOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     OnShellstarListChanged();
     Navigate(_navigationIndex);
 }
Ejemplo n.º 32
0
        internal static void UpdateCategories(ListAction action, int eventId, ArrayList categories, bool checkAccess)
        {
            if(checkAccess)
                VerifyCanUpdate(eventId);

            ArrayList oldCategories = new ArrayList();
            using(IDataReader reader = CalendarEntry.GetListCategories(eventId))
            {
                Common.LoadCategories(reader, oldCategories);
            }
            Common.UpdateList(action, oldCategories, categories, OBJECT_TYPE, eventId, SystemEventTypes.CalendarEntry_Updated_GeneralCategories, new UpdateListDelegate(Common.ListUpdate), null);
        }
Ejemplo n.º 33
0
 private void SelectedUnitOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     UpdateShellstarInfo();
 }
Ejemplo n.º 34
0
 internal ActionEventArgs(ListAction acton, int _startIndex, int _count)
 {
     index  = _startIndex;
     count  = _count;
     action = acton;
 }
Ejemplo n.º 35
0
 internal ActionEventArgs(ListAction acton, IEnumerable <T> coll, bool cancl)
 {
     addRangeCollection = coll;
     cancel             = cancl;
     action             = acton;
 }
Ejemplo n.º 36
0
 private void SelectedUnitOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     UpdateShellstarInfo();
 }
Ejemplo n.º 37
0
 public static void UpdateCategories(ListAction action, ListType type, int issueId, ArrayList categories)
 {
     UpdateCategories(action, type, issueId, categories, true);
 }
Ejemplo n.º 38
0
        internal static void UpdateCategories(ListAction action, ListType type, int issueId, ArrayList categories, bool checkAccess)
        {
            if(checkAccess && !Incident.CanUpdate(issueId))
                throw new AccessDeniedException();

            ArrayList oldItems;
            SystemEventTypes eventType;
            UpdateListDelegate fnUpdate;

            switch(type)
            {
                case ListType.GeneralCategories:
                    eventType = SystemEventTypes.Issue_Updated_GeneralCategories;
                    oldItems = LoadGeneralCategories(issueId);
                    fnUpdate = new UpdateListDelegate(Common.ListUpdate);
                    break;
                case ListType.IssueCategories:
                    eventType = SystemEventTypes.Issue_Updated_IssueCategories;
                    oldItems = LoadIssueCategories(issueId);
                    fnUpdate = new UpdateListDelegate(ListUpdate);
                    break;
                default:
                    throw new Exception("Unknown category type.");
            }
            Common.UpdateList(action, oldItems, categories, OBJECT_TYPE, issueId, eventType, fnUpdate, type);
        }
Ejemplo n.º 39
0
 protected virtual void OnShellstarListChanged(ListAction action, IShellstarModel shellstar)
 {
     ShellstarListChangedDelegate handler = ShellstarListChanged;
     if (handler != null)
     {
         handler(action, shellstar);
     }
 }
Ejemplo n.º 40
0
 // Categories
 #region UpdateCategories()
 public static void UpdateCategories(ListAction action, int todoId, ArrayList categories)
 {
     UpdateCategories(action, todoId, categories, true);
 }
Ejemplo n.º 41
0
        internal static void UpdateList(ListAction action, ArrayList oldItems, ArrayList newItems, ObjectTypes objectType, int objectId, SystemEventTypes eventType, UpdateListDelegate fnUpdate, object context)
        {
            ArrayList add = new ArrayList();
            ArrayList del = new ArrayList();
            foreach (int id in newItems)
            {
                switch (action)
                {
                    case ListAction.Add:
                        if (!oldItems.Contains(id))
                            add.Add(id);
                        break;
                    case ListAction.Remove:
                        if (oldItems.Contains(id))
                            del.Add(id);
                        break;
                    case ListAction.Set:
                        if (oldItems.Contains(id))
                            oldItems.Remove(id);
                        else
                            add.Add(id);
                        break;
                }
            }

            if (action == ListAction.Set)
                del.AddRange(oldItems);

            using (DbTransaction tran = DbTransaction.Begin())
            {
                bool updated = false;

                foreach (int id in add)
                {
                    fnUpdate(true, objectType, objectId, id, context);
                    updated = true;
                }

                foreach (int id in del)
                {
                    fnUpdate(false, objectType, objectId, id, context);
                    updated = true;
                }

                if (updated)
                    SystemEvents.AddSystemEvents(eventType, objectId);

                tran.Commit();
            }
        }
Ejemplo n.º 42
0
        private static void UpdateList(ListAction action, ListType type, int projectId, ArrayList items, bool checkAccess)
        {
            if(checkAccess)
                VerifyCanUpdate(projectId);

            ArrayList oldItems;
            SystemEventTypes eventType;
            UpdateListDelegate fnUpdate;

            switch(type)
            {
                case ListType.GeneralCategories:
                    eventType = SystemEventTypes.Project_Updated_GeneralCategories;
                    oldItems = LoadGeneralCategories(projectId);
                    fnUpdate = new UpdateListDelegate(Common.ListUpdate);
                    break;
                case ListType.ProjectCategories:
                    eventType = SystemEventTypes.Project_Updated_ProjectCategories;
                    oldItems = LoadProjectCategories(projectId);
                    fnUpdate = new UpdateListDelegate(ListUpdate);
                    break;
                case ListType.ProjectGroups:
                    eventType = SystemEventTypes.Project_Updated_ProjectGroups;
                    oldItems = LoadProjectGroups(projectId);
                    fnUpdate = new UpdateListDelegate(ListUpdate);
                    break;
                default:
                    throw new Exception("Unknown list type.");
            }
            Common.UpdateList(action, oldItems, items, OBJECT_TYPE, projectId, eventType, fnUpdate, type);
        }
Ejemplo n.º 43
0
 protected virtual void OnCounterfireUpdated(ListAction action, ShellstarInfo affectedShellstar)
 {
     var handler = CounterfireUpdated;
     if (handler != null)
     {
         handler(action, affectedShellstar);
     }
 }
Ejemplo n.º 44
0
 private static void UpdateList(ListAction action, ListType type, int projectId, ArrayList items)
 {
     UpdateList(action, type, projectId, items, true);
 }
Ejemplo n.º 45
0
 public static void UpdateCategories(ListAction action, int eventId, ArrayList categories)
 {
     UpdateCategories(action, eventId, categories, true);
 }
Ejemplo n.º 46
0
 private void UnitModelOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     OnPropertyChanged(Properties.CanViewShellstars);
 }
Ejemplo n.º 47
0
 private void UnitOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     OnShellstarListChanged();
     Navigate(_navigationIndex);
 }
Ejemplo n.º 48
0
 private void UnitModelOnShellstarListChanged(ListAction action, IShellstarModel affectedShellstar)
 {
     OnPropertyChanged(Properties.CanViewShellstars);
 }