示例#1
0
        /// <summary>
        /// Main Window
        /// </summary>
        public MainWindow()
        {
            AppWindow   = this;
            DataContext = this;

            mediaPlayer = new MediaPlayer();
            Uri woopUri = new Uri(AppDomain.CurrentDomain.BaseDirectory + @"\Sounds\woop.mp3");

            mediaPlayer.Open(woopUri);



            InitializeComponent();

            Title = "SMT (Crystal Vagooey : " + SMT_VERSION + ")";

            CheckGitHubVersion();

            // Load the Dock Manager Layout file
            string dockManagerLayoutName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\SMT\\" + SMT_VERSION + "\\Layout.dat";

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

            // Due to bugs in the Dock manager patch up the content id's for the 2 main views
            RegionLayoutDoc   = FindDocWithContentID(dockManager.Layout, "MapRegionContentID");
            UniverseLayoutDoc = FindDocWithContentID(dockManager.Layout, "FullUniverseViewID");

            // load any custom map settings off disk
            string mapConfigFileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\SMT\\" + SMT_VERSION + "\\MapConfig.dat";

            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.SetDefaultColours();
                }
            }
            else
            {
                MapConf = new MapConfig();
                MapConf.SetDefaultColours();
            }

            // Create the main EVE manager

            EVEManager = new EVEData.EveManager(SMT_VERSION);
            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();

            CharactersList.ItemsSource = EVEManager.LocalCharacters;
            CurrentActiveCharacterCombo.ItemsSource = EVEManager.LocalCharacters;

            TheraConnectionsList.ItemsSource = EVEManager.TheraConnections;
            JumpBridgeList.ItemsSource       = EVEManager.JumpBridges;

            SovCampaignList.ItemsSource = EVEManager.ActiveSovCampaigns;
            EVEManager.ActiveSovCampaigns.CollectionChanged += ActiveSovCampaigns_CollectionChanged;

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

            RegionUC.RegionChanged        += RegionUC_RegionChanged;
            RegionUC.UniverseSystemSelect += RegionUC_UniverseSystemSelect;

            UniverseUC.MapConf = MapConf;
            UniverseUC.Init();
            UniverseUC.RequestRegionSystem += UniverseUC_RequestRegionSystem;

            RegionsViewUC.MapConf = MapConf;
            RegionsViewUC.Init();
            RegionsViewUC.RequestRegion += RegionsViewUC_RequestRegion;

            AppStatusBar.DataContext = EVEManager.ServerInfo;

            // load the anom data
            string anomDataFilename = EVEManager.SaveDataVersionFolder + @"\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();
            }

            RegionUC.ANOMManager = ANOMManager;


            List <EVEData.System> globalSystemList = new List <EVEData.System>(EVEManager.Systems);

            globalSystemList.Sort((a, b) => string.Compare(a.Name, b.Name));
            RouteSystemDropDownAC.ItemsSource = globalSystemList;

            ColoursPropertyGrid.SelectedObject        = MapConf.ActiveColourScheme;
            ColoursPropertyGrid.PropertyValueChanged += ColoursPropertyGrid_PropertyValueChanged;;
            MapConf.PropertyChanged += MapConf_PropertyChanged;

            Closed += MainWindow_Closed;

            EVEManager.IntelAddedEvent += OnIntelAdded;



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

            ZKBFeed.ItemsSource = EVEManager.ZKillFeed.KillStream;

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

            zKBFeedview.Refresh();
            zKBFeedview.Filter = ZKBFeedFilter;

            foreach (EVEData.LocalCharacter lc in EVEManager.LocalCharacters)
            {
                lc.WarningSystemRange = MapConf.WarningRange;
                lc.Location           = "";
            }
        }
示例#2
0
        public MainWindow()
        {
            OutputLog.Info("Starting App..");

            InitializeComponent();

            DynamicMapElements = new List <UIElement>();



            // 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);
                }
                catch
                {
                    MapConf            = new MapConfig();
                    MapConf.MapColours = new List <MapColours>();
                    MapConf.SetDefaultColours();
                }
            }
            else
            {
                MapConf            = new MapConfig();
                MapConf.MapColours = new List <MapColours>();
                MapConf.SetDefaultColours();
            }


            SelectedSystem = string.Empty;

            EVEManager = new EVEData.EveManager();
            EVEData.EveManager.SetInstance(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();
            }


            RegionDropDown.ItemsSource = EVEManager.Regions;

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


            // load jump bridge data
            EVEManager.LoadJumpBridgeData();
            EVEManager.StartUpdateKillsFromESI();
            EVEManager.StartUpdateJumpsFromESI();
            EVEManager.StartUpdateSOVFromESI();

            foreach (EVEData.MapRegion rd in EVEManager.Regions)
            {
                if (rd.Name == MapConf.DefaultRegion)
                {
                    RegionDropDown.SelectedItem = rd;
                    List <EVEData.MapSystem> newList = rd.MapSystems.Values.ToList().OrderBy(o => o.Name).ToList();
                    SystemDropDownAC.ItemsSource = newList;
                }
            }


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

            CharacterDropDown.ItemsSource = EVEManager.LocalCharacters;

            MapControlsPropertyGrid.SelectedObject        = MapConf;
            MapControlsPropertyGrid.PropertyValueChanged += MapControlsPropertyGrid_PropertyValueChanged;

            ColourListDropdown.ItemsSource = MapConf.MapColours;

            CharacterList.ItemsSource = EVEManager.LocalCharacters;


            MapColours selectedColours = MapConf.MapColours[0];

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

            // load the dockmanager layout
            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
                {
                }
            }

            // 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);
                }
                catch
                {
                    ANOMManager = new EVEData.AnomManager();
                }
            }
            else
            {
                ANOMManager = new EVEData.AnomManager();
            }

            // ColourListDropdown.SelectedItem = selectedColours;
            ColoursPropertyGrid.SelectedObject   = selectedColours;
            MapConf.ActiveColourScheme           = selectedColours;
            ColoursPropertyGrid.PropertyChanged += ColoursPropertyGrid_PropertyChanged;
            ReDrawMap();

            Closed += MainWindow_Closed;

            EVEManager.IntelAddedEvent += OnIntelAdded;
        }
示例#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;
        }