Ejemplo n.º 1
0
        private void RawIntelBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (RawIntelBox.SelectedItem == null)
            {
                return;
            }

            EVEData.IntelData intel = RawIntelBox.SelectedItem as EVEData.IntelData;

            foreach (string s in intel.IntelString.Split(' '))
            {
                if (s == "")
                {
                    continue;
                }

                foreach (EVEData.System sys in EVEManager.Systems)
                {
                    if (s.IndexOf(sys.Name, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        if (RegionRC.Region.Name != sys.Region)
                        {
                            RegionRC.SelectRegion(sys.Region);
                        }

                        RegionRC.SelectSystem(s);
                        return;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void RegionShape_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Shape obj = sender as Shape;

            EVEData.MapRegion mr = obj.DataContext as EVEData.MapRegion;
            if (mr == null)
            {
                return;
            }

            if (e.ClickCount == 2)
            {
                RegionRC.SelectRegion(mr.Name);
                if (RegionLayoutDoc != null)
                {
                    RegionLayoutDoc.IsSelected = true;
                }
            }
        }
Ejemplo n.º 3
0
        public MainWindow()
        {
            OutputLog.Info("Starting App..");
            AppWindow = this;

            InitializeComponent();


            string dockManagerLayoutName = AppDomain.CurrentDomain.BaseDirectory + @"\Layout.dat";

            if (File.Exists(dockManagerLayoutName))
            {
                try
                {
                    Xceed.Wpf.AvalonDock.Layout.Serialization.XmlLayoutSerializer ls = new Xceed.Wpf.AvalonDock.Layout.Serialization.XmlLayoutSerializer(dockManager);
                    using (var sr = new StreamReader(dockManagerLayoutName))
                    {
                        ls.Deserialize(sr);
                    }
                }
                catch
                {
                }
            }

            RegionLayoutDoc = FindDocWithContentID(dockManager.Layout, "MapRegionContentID");

/*            // now update the RegionLayoutDoc because the layout loading breaks the binding
 *          foreach (Xceed.Wpf.AvalonDock.Layout.ILayoutElement ile in dockManager.Layout.Children)
 *          {
 *              if(ile is Xceed.Wpf.AvalonDock.Layout.ILayoutContainer )
 *              {
 *                  Xceed.Wpf.AvalonDock.Layout.ILayoutContainer ilc = ile as Xceed.Wpf.AvalonDock.Layout.ILayoutContainer;
 *
 *                  foreach (Xceed.Wpf.AvalonDock.Layout.LayoutDocumentPane ldp in ilc.Children.OfType<Xceed.Wpf.AvalonDock.Layout.LayoutDocumentPane>())
 *                  {
 *                      foreach (Xceed.Wpf.AvalonDock.Layout.LayoutDocument ld in ldp.Children.OfType<Xceed.Wpf.AvalonDock.Layout.LayoutDocument>())
 *                      {
 *                          if (ld.ContentId == "MapRegionContentID")
 *                          {
 *                              RegionLayoutDoc = ld;
 *                          }
 *                      }
 *                  }
 *
 *              }
 *
 *          }
 */

            // load any custom map settings off disk
            string mapConfigFileName = AppDomain.CurrentDomain.BaseDirectory + @"\MapConfig.dat";

            OutputLog.Info("Loading Map config from {0}", mapConfigFileName);


            if (File.Exists(mapConfigFileName))
            {
                try
                {
                    XmlSerializer xms  = new XmlSerializer(typeof(MapConfig));
                    FileStream    fs   = new FileStream(mapConfigFileName, FileMode.Open);
                    XmlReader     xmlr = XmlReader.Create(fs);

                    MapConf = (MapConfig)xms.Deserialize(xmlr);
                    fs.Close();
                }
                catch
                {
                    MapConf            = new MapConfig();
                    MapConf.MapColours = new List <MapColours>();
                    MapConf.SetDefaultColours();
                }
            }
            else
            {
                MapConf            = new MapConfig();
                MapConf.MapColours = new List <MapColours>();
                MapConf.SetDefaultColours();
            }

            EVEManager = new EVEData.EveManager();
            EVEData.EveManager.Instance = EVEManager;

            // if we want to re-build the data as we've changed the format, recreate it all from scratch
            bool initFromScratch = false;

            if (initFromScratch)
            {
                EVEManager.CreateFromScratch();
            }
            else
            {
                EVEManager.LoadFromDisk();
            }

            EVEManager.SetupIntelWatcher();
            RawIntelBox.ItemsSource = EVEManager.IntelDataList;


            // load jump bridge data
            EVEManager.LoadJumpBridgeData();
            EVEManager.UpdateESIUniverseData();
            EVEManager.InitNavigation();


            ColourListDropdown.ItemsSource = MapConf.MapColours;
            CharactersList.ItemsSource     = EVEManager.LocalCharacters;

            TheraConnectionsList.ItemsSource = EVEManager.TheraConnections;

            MapColours selectedColours = MapConf.MapColours[0];

            // find the matching active colour scheme
            foreach (MapColours mc in MapConf.MapColours)
            {
                if (MapConf.DefaultColourSchemeName == mc.Name)
                {
                    selectedColours = mc;
                }
            }



            RegionRC.MapConf = MapConf;
            RegionRC.Init();
            RegionRC.SelectRegion(MapConf.DefaultRegion);


            RegionRC.RegionChanged             += RegionRC_RegionChanged;
            RegionRC.CharacterSelectionChanged += RegionRC_CharacterSelectionChanged;


            // load the anom data
            string anomDataFilename = AppDomain.CurrentDomain.BaseDirectory + @"\Anoms.dat";

            if (File.Exists(anomDataFilename))
            {
                try
                {
                    XmlSerializer xms = new XmlSerializer(typeof(EVEData.AnomManager));

                    FileStream fs   = new FileStream(anomDataFilename, FileMode.Open);
                    XmlReader  xmlr = XmlReader.Create(fs);

                    ANOMManager = (EVEData.AnomManager)xms.Deserialize(xmlr);
                    fs.Close();
                }
                catch
                {
                    ANOMManager = new EVEData.AnomManager();
                }
            }
            else
            {
                ANOMManager = new EVEData.AnomManager();
            }

            MainAnomGrid.DataContext = ANOMManager;
            RegionRC.ANOMManager     = ANOMManager;

            MainRouteGrid.DataContext = RegionRC;


            AppStatusBar.DataContext = EVEManager.ServerInfo;


            // ColourListDropdown.SelectedItem = selectedColours;
            ColoursPropertyGrid.SelectedObject       = selectedColours;
            MapConf.ActiveColourScheme               = selectedColours;
            ColoursPropertyGrid.PropertyChanged     += ColoursPropertyGrid_PropertyChanged;
            MapConf.PropertyChanged                 += MapConf_PropertyChanged;
            MapControlsPropertyGrid.PropertyChanged += ColoursPropertyGrid_PropertyChanged;


            Closed += MainWindow_Closed;

            EVEManager.IntelAddedEvent += OnIntelAdded;
            //MapConf.PropertyChanged += RegionRC.MapObjectChanged;

            AddRegionsToUniverse();


            uiRefreshTimer          = new System.Windows.Threading.DispatcherTimer();
            uiRefreshTimer.Tick    += UiRefreshTimer_Tick;
            uiRefreshTimer.Interval = new TimeSpan(0, 0, 4);
            uiRefreshTimer.Start();



            ZKBFeed.ItemsSource = EVEManager.ZKillFeed.KillStream;


            CollectionView zKBFeedview = (CollectionView)CollectionViewSource.GetDefaultView(ZKBFeed.ItemsSource);

            zKBFeedview.Filter = ZKBFeedFilter;



            MapControlsPropertyGrid.SelectedObject = MapConf;
        }