protected override void OnRegisterMenu(Managers.MenuManager manager)
 {
     manager.Add(Managers.MenuContainer.FolderContext, open);
     manager.Add(Managers.MenuContainer.FolderContext, export);
     manager.Add(Managers.MenuContainer.FolderContext, sep1);
     manager.Add(Managers.MenuContainer.FolderContext, properties);
 }
Exemple #2
0
        private IEnumerator LoadDefaultsImpl()
        {
            yield return(new WaitUntil(() => Services.ResourceService.IsLoaded));

            yield return(new WaitUntil(() => Services.GameModeService.IsLoaded));

            Managers.Clear();
            foreach (var data in Services.ResourceService.Managers.ManagerCollections)
            {
                GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(data.Id);
                Managers.Add(data.Id, new ManagerInfo(data, generatorData));
            }
            if (Services.GameModeService.IsFirstTimeLaunch)
            {
                SetCashOnHand(0, kFirstManagerCashOnHand);
            }

            ManagerEfficiencyRollbackLevels.Clear();

            IsLoaded = true;
        }
Exemple #3
0
        public T GetManager <T>() where T : class, IDrawingObjectManager
        {
            T foundManager = null;

            foreach (var manager in Managers)
            {
                if (manager is T objectManager)
                {
                    foundManager = objectManager;
                }
            }

            if (foundManager != null)
            {
                return(foundManager);
            }

            foundManager = (T)Activator.CreateInstance(typeof(T), AcDoc, _log);
            Managers.Add(foundManager);
            PopulateLayers();

            return(foundManager);
        }
Exemple #4
0
        public IObservable <TEvent> GetEvent <TEvent>()
        {
            IEventManager eventManager;
            Type          eventType = typeof(TEvent);

            if (!Managers.TryGetValue(eventType, out eventManager))
            {
                eventManager = new EventManager <TEvent>();
                Managers.Add(eventType, eventManager);
                var eventId = eventManager.EventId;
                if (eventId > 0)
                {
                    ManagersById.Add(eventId, eventManager);
                }
                else
                {
                    // create warning here that eventid attribute is not set
                }
            }
            EventManager <TEvent> em = (EventManager <TEvent>)eventManager;

            return(em.EventSubject);
        }
Exemple #5
0
        public override void LoadSave(object obj)
        {
            ManagerServiceSave save = obj as ManagerServiceSave;

            if (save != null)
            {
                if (save.managers != null)
                {
                    Managers.Clear();
                    foreach (var kvp in save.managers)
                    {
                        var           managerData   = Services.ResourceService.Managers.GetManagerData(kvp.Key);
                        GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(kvp.Key);
                        ManagerInfo   manager       = new ManagerInfo(managerData, generatorData, kvp.Value);
                        Managers.Add(manager.Id, manager);
                    }

                    save.Validate();
                    ManagerEfficiencyRollbackLevels.Clear();
                    foreach (var me in save.efficiencyRollbackImproveLevels)
                    {
                        ManagerEfficiencyRollbackLevels.Add(me.Key, new ManagerEfficiencyRollbackLevel(me.Value));
                    }

                    IsLoaded = true;
                }
                else
                {
                    LoadDefaults();
                }
            }
            else
            {
                LoadDefaults();
            }
        }
Exemple #6
0
        private void BaseReset()
        {
            Dictionary <int, ManagerInfo> newManagers = new Dictionary <int, ManagerInfo>();

            foreach (var kvp in Managers)
            {
                ManagerData   managerData   = Services.ResourceService.Managers.GetManagerData(kvp.Key);
                GeneratorData generatorData = Services.ResourceService.Generators.GetGeneratorData(kvp.Key);

                ManagerInfo newValue = new ManagerInfo(managerData, generatorData);
                newValue.SetHasKickBacks(kvp.Value.HasKickBacks);
                newManagers.Add(newValue.Id, newValue);
            }
            Managers.Clear();
            foreach (var kvp in newManagers)
            {
                Managers.Add(kvp.Key, kvp.Value);
            }

            if (Services.GameModeService.IsFirstTimeLaunch)
            {
                SetCashOnHand(0, kFirstManagerCashOnHand);
            }
        }
 protected override void OnRegisterMenu(Managers.MenuManager manager)
 {
     manager.Add(Managers.MenuContainer.Analyzer, show);
 }
Exemple #8
0
        public void CreateEmployee()
        {
            Console.Clear();
            Console.WriteLine("Enter Name");
            var firstName = Console.ReadLine();

            Console.WriteLine("Enter LastName");
            var lastName = Console.ReadLine();

            Console.WriteLine("Enter Middle");
            var middle = Console.ReadLine();

            Console.WriteLine("Enter experience");
            double experience = 0;

            try
            {
                experience = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception)
            {
                Console.WriteLine("Wrong experience");
            }

            Console.WriteLine("Enter Task");
            var task = Console.ReadLine();


            var position = GetSelectedPosition();

            if (position == Position.Worker)
            {
                Worker worker = new Worker(firstName, lastName, middle, experience, Position.Worker, task);

                if (ContainEmployee(worker.Name, worker.Position))
                {
                    Console.WriteLine("This employee exist. Try again");
                    CreateEmployee();
                }
                Workers.Add(worker);
            }

            if (position == Position.Taskmaster)
            {
                var taskmaster = new Taskmaster(firstName, lastName, middle, experience, Position.Worker, task);

                if (ContainEmployee(taskmaster.Name, taskmaster.Position))
                {
                    Console.WriteLine("This employee exist. Try again");
                    CreateEmployee();
                }

                Taskmasters.Add(taskmaster);
            }

            if (position == Position.Manager)
            {
                var manager = new Manager(firstName, lastName, middle, experience, Position.Worker, task);

                if (ContainEmployee(manager.Name, manager.Position))
                {
                    Console.WriteLine("This employee exist. Try again");
                    CreateEmployee();
                }

                Managers.Add(manager);
            }
        }
Exemple #9
0
 public void AddShopManager(ShopOwner manager)
 {
     Managers.Add(manager);
 }
 public void Add(IManager manager)
 {
     Validate(manager);
     Managers.Add(manager);
 }
Exemple #11
0
 public void AddManager(Manager M)
 {
     Managers.Add(M);
     SaveChanges();
 }
Exemple #12
0
 public void On(ResourceManagerAdded e)
 {
     Managers.Add(e.ManagerId);
 }
 public void RegisterManager(IManager manager)
 {
     Managers.Add(manager);
 }
 protected override void OnRegisterMenu(Managers.MenuManager manager)
 {
     manager.Add(Managers.MenuContainer.Analyzer, hashes);
     manager.Add(Managers.MenuContainer.FileContext, showHash);
     manager.Add(Managers.MenuContainer.FileContext, sep);
 }
 protected override void OnRegisterMenu(Managers.MenuManager manager)
 {
     manager.Add(Managers.MenuContainer.FileContext, openWith);
 }
        protected bool ConfigureService()
        {
            Logger.Info <SactaProxy>("Configurando Servicio");
            cfgManager.Get((cfg =>
            {
                // Se utiliza 'siempre' version 0 para CD30 y version 1 para ULISES.
                cfg.ProtocolVersion = Properties.Settings.Default.ScvType;
                History.Configure(cfg.General.HistoryMaxDays, cfg.General.HistoryMaxItems);
                Managers.Clear();
                cfg.Psi.Sectorization.Positions = "";
                cfg.Psi.Sectorization.Sectors = "";
                cfg.Psi.Sectorization.Virtuals = "";

                var manager = new PsiManager(cfg.ProtocolVersion, cfg.Psi, () => History);
                manager.EventActivity += OnPsiEventActivity;
                manager.EventSectRequest += OnPsiEventSectorizationAsk;
                Managers.Add(new DependencyControl(cfg.Psi.Id)
                {
                    IsMain = true,
                    Cfg = cfg.Psi,
                    Manager = manager
                });
                cfg.Dependencies.ForEach(dep =>
                {
                    var dependency = new ScvManager(cfg.ProtocolVersion, dep, () => History);
                    dependency.EventActivity += OnScvEventActivity;
                    dependency.EventSectorization += OnScvEventSectorization;

                    /** Construyendo la configuracion de Sectorizacion general */
                    var sectorsMap = dep.Sectorization.SectorsMap.Split(',')
                                     .Where(i => Configuration.MapOfSectorsEntryValid(i))
                                     .ToDictionary(k => int.Parse(k.Split(':')[0]), v => int.Parse(v.Split(':')[1]));
                    var positionsMap = dep.Sectorization.PositionsMap.Split(',')
                                       .Where(i => Configuration.MapOfSectorsEntryValid(i))
                                       .ToDictionary(k => int.Parse(k.Split(':')[0]), v => int.Parse(v.Split(':')[1]));
                    var virtuals = Configuration.ListString2String(
                        dep.Sectorization.VirtualsList()
                        .Select(v => sectorsMap.Keys.Contains(v) ? sectorsMap[v].ToString() : v.ToString())
                        .ToList());
                    var reals = String.Join(",", dep.Sectorization.SectorsList()
                                            .Select(r => sectorsMap.Keys.Contains(r) ? sectorsMap[r].ToString() : r.ToString())
                                            .ToList());
                    //.Aggregate((i, j) => i + "," + j.ToString());
                    var positions = String.Join(",", dep.Sectorization.PositionsList()
                                                .Select(p => positionsMap.Keys.Contains(p) ? positionsMap[p].ToString() : p.ToString())
                                                .ToList());
                    //.Aggregate((i, j) => i + "," + j.ToString());

                    cfg.Psi.Sectorization.Positions = Configuration.AgreggateString(cfg.Psi.Sectorization.Positions, positions);
                    cfg.Psi.Sectorization.Virtuals = Configuration.AgreggateString(cfg.Psi.Sectorization.Virtuals, virtuals);
                    cfg.Psi.Sectorization.Sectors = Configuration.AgreggateString(cfg.Psi.Sectorization.Sectors, reals);

                    Managers.Add(new DependencyControl(dep.Id)
                    {
                        IsMain = false,
                        Cfg = dep,
                        Manager = dependency,
                        SectorsMap = sectorsMap,
                        PositionsMap = positionsMap
                    });
                });
                /** Test de la configuracion que maneja la PSI, que debe coincidir con la configurada en BD */
                SectorizationHelper.CompareWithDb(cfg.Psi.Sectorization.Positions,
                                                  cfg.Psi.Sectorization.Sectors, cfg.Psi.Sectorization.Virtuals, (error) =>
                {
                    // Marcar el Warning...
                    PS.SignalWarning <SactaProxy>($"Incoherencia de Configuración con Base de Datos: {error}", History);
                });
                /** */
                var ids = cfg.Dependencies.Select(d => d.Id).ToList();
                ids.Add(cfg.Psi.Id);
                SectorizationPersistence.Sanitize(ids);
                Cfg = cfg;
                cfgManager.Write(Cfg);
                Logger.Info <SactaProxy>("Servicio Configurado...");
            }));
            return(true);
        }
Exemple #17
0
 public static void RegisterManager(Manager manager)
 {
     Managers.Add(manager);
 }