Пример #1
0
 public AgentDataDictionary(CfgSettings cfg)
 {
     //String tpath = Path.Combine(cfg.DammagePath, @"domains\visual.pl");
     String tpath = cfg.DammagePath;
     _agentDataList = KVPGrinder.GetAgentData(tpath);
     _itemDataList = KVPGrinder.GetItemData(tpath);
     KVPGrinder.GetSpecialData(tpath, out _specialList, out _specialGroupName);
     
     conf = cfg;
 }
Пример #2
0
        private void LoadAndSetup(CfgSettings Config)
        {
            var dsc = this.Dispatcher;
            _logProcessor.InitProcessor(Config, dsc, _runMode);
            
            try
            {
                Item.cfgSettings = Config;

            }
            catch
            {
                System.Windows.MessageBox.Show("Something wrong with configuration file content");
            }

        }
Пример #3
0
 private void Window_Initialized(object sender, RoutedEventArgs e)
 {
     try
     {
         
         config = new CfgSettings();
         config.LoadFromFile();
         if (config!=null)
         {
             TextBox1.Text = config.DammagePath;
             TextBox2.Text = config.ObservationHost;
             TextBox3.Text = config.ObservationPort.ToString();
         }
     }
     catch (Exception e1)
     {
         System.Windows.MessageBox.Show("Error parsing config.xml file: " + e1.Message);
         this.Close();
     }
 }
Пример #4
0
        public Item(String key, List<KVP> list, CfgSettings cfg, AgentDataDictionary ag, Dispatcher uiDispatcher): base(key, new List<KVP>())
        {
            cfgSettings = cfg;
            if (key.StartsWith("oblig"))
            {
               // InstanceOf = "obligation";
            }
            ImageDictionary = ag;
            UIDispatcher = uiDispatcher;
            Status = ElementStatus.Unchanged;
            
            foreach (var l in list)
            {
                if (l.Key.Equals("held_by"))
                {
                    StringAttributeList.Add("Held by", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    _held_by = l.Value;
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("owned_by"))
                {
                    StringAttributeList.Add("Owned by", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    _owned_by = l.Value;
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("instance_of"))
                {
                    StringAttributeList.Add("Instance of", l.Value);
                    InstanceOf = l.Value;
                }
                else if (l.Key.Equals("weight"))
                {
                    StringAttributeList.Add("Weight", l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("status"))
                {
                    StringAttributeList.Add("Status", l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("auctioneer"))
                {
                    StringAttributeList.Add("Auctioneer", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("highest_bidder"))
                {
                    StringAttributeList.Add("Highest bidder", ag.GetAgentNameByID(l.Value) + " (" + l.Value + ")");
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("last_bid_time"))
                {
                    StringAttributeList.Add("Last bid time", l.Value.Substring(0, 5));
                    ListOfItems.Remove(l);
                }
                else if (l.Key.IndexOf("_") > 0)
                {
                    String st = l.Key.Replace("_", " ");
                    st = st[0].ToString().ToUpper()[0] + st.Substring(1);
                    StringAttributeList.Add(st, l.Value);
                    ListOfItems.Remove(l);
                }
                else if (l.Key.Equals("item"))
                {
                    StringAttributeList.Add("Item", l.Value);
                    InstanceOf = l.Value;
                }
                
                else if (l.Type == ItemType.Attribute)
                {
                   // String st = l.Key[0].ToString().ToUpper()[0] + l.k.Substring(1);
                    StringAttributeList.Add(l.Key, l.Value);
                    ListOfItems.Remove(l);
                }
                else
                {
                    ListOfItems.Add(l);
                }
            }
            UIDispatcher.Invoke(() =>
            {
                BorderBrush = getBrush();
                BorderBrush2 = getHeldBrush();
            });
            

        }
Пример #5
0
 public void InitProcessor(CfgSettings config, Dispatcher dispatcher, RunMode runMode)
 {
     _agentDataDictionary = new AgentDataDictionary(config);
     _dispatcher = dispatcher;
     AllAgents = new ObservableCollection<Agent>();
     AllItems = new ObservableCollection<Item>();
     CurrentState = new EnvironmentState();
     CurrentState.Clock = new Clock();
     states = new StateDictionary();
     states.PropertyChanged += states_PropertyChanged;
     cfgInfo = config;
     CurrentAgent = "god";
     Index = 0;
     _runMode = runMode;
     
 }