/// <summary>
        /// Override to include the update of input coordinate history
        /// </summary>
        /// <param name="obj"></param>
        public override bool OnNewMapPoint(object obj)
        {
            if (!base.OnNewMapPoint(obj))
            {
                return(false);
            }

            var formattedInputCoordinate = proCoordGetter.GetInputDisplayString();

            UIHelpers.UpdateHistory(formattedInputCoordinate, InputCoordinateHistoryList);

            // deactivate map point tool
            // KG - Commented out so user can continously capture coordinates
            //IsToolActive = false;

            // KG - Added so output component will updated when user clicks on the map
            //      not when mouse move event is fired.
            Mediator.NotifyColleagues(CoordinateConversionLibrary.Constants.RequestOutputUpdate, null);

            return(true);
        }
Exemplo n.º 2
0
        static void Write(string message)
        {
            int  index = 0;
            char col   = 'S';

            message = UIHelpers.Format(message);

            while (index < message.Length)
            {
                char   curCol = col;
                string part   = UIHelpers.OutputPart(ref col, ref index, message);
                if (part.Length > 0)
                {
                    Console.ForegroundColor = GetConsoleCol(curCol);
                    Console.Write(part);
                }
            }

            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
        }
Exemplo n.º 3
0
        private void PagePilots_Loaded(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Flightschool")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;

                matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Pilot")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
Exemplo n.º 4
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Used" && frmContent != null)
            {
                frmContent.Navigate(new PageUsedAirliners()
                {
                    Tag = this
                });
            }

            if (selection == "Order" && frmContent != null)
            {
                frmContent.Navigate(new PageManufacturers()
                {
                    Tag = this
                });
            }

            if (selection == "New" && frmContent != null)
            {
                frmContent.Navigate(new PageNewAirliners()
                {
                    Tag = this
                });
            }

            if (selection == "Fleet" && frmContent != null)
            {
                frmContent.Navigate(new PageAirlinersHumanFleet()
                {
                    Tag = this
                });
            }
        }
Exemplo n.º 5
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Options" && frmContent != null)
            {
                frmContent.Navigate(new PageShowOptions()
                {
                    Tag = this
                });
            }

            if (selection == "Save" && frmContent != null)
            {
                frmContent.Navigate(new PageSaveGame()
                {
                    Tag = this
                });
            }

            if (selection == "Load" && frmContent != null)
            {
                frmContent.Navigate(new PageLoadGame()
                {
                    Tag = this
                });
            }

            if (selection == "Credits" && frmContent != null)
            {
                frmContent.Navigate(new PageOptionsCredits()
                {
                    Tag = this
                });
            }
        }
        private void btnCreateGame_Click(object sender, RoutedEventArgs e)
        {
            this.StartData.Airline       = (Airline)cbAirline.SelectedItem;
            this.StartData.Airport       = (Airport)cbAirport.SelectedItem;
            this.StartData.CEO           = (string)txtCEO.Text;
            this.StartData.HomeCountry   = (Country)cbCountry.SelectedItem;
            this.StartData.TimeZone      = (GameTimeZone)cbTimeZone.SelectedItem;
            this.StartData.LocalCurrency = cbLocalCurrency.IsChecked.Value && this.StartData.HomeCountry.HasLocalCurrency;

            Size s = PageNavigator.MainWindow.RenderSize;

            GraphicsHelpers.SetContentHeight(s.Height / 2);
            GraphicsHelpers.SetContentWidth(s.Width / 2);

            if (!this.StartData.RandomOpponents)
            {
                PageNavigator.NavigateTo(new PageSelectOpponents(this.StartData));
            }
            else
            {
                SplashControl scCreating = UIHelpers.FindChild <SplashControl>(this, "scCreating");

                scCreating.Visibility = System.Windows.Visibility.Visible;

                BackgroundWorker bgWorker = new BackgroundWorker();
                bgWorker.DoWork += (y, x) =>
                {
                    GameObjectHelpers.CreateGame(this.StartData);
                };
                bgWorker.RunWorkerCompleted += (y, x) =>
                {
                    scCreating.Visibility = System.Windows.Visibility.Collapsed;

                    PageNavigator.NavigateTo(new PageAirline(GameObject.GetInstance().HumanAirline));

                    PageNavigator.ClearNavigator();
                };
                bgWorker.RunWorkerAsync();
            }
        }
Exemplo n.º 7
0
        private async Task SyncLibrarySideBarItemsUI()
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                await SidebarControl.SideBarItemsSemaphore.WaitAsync();
                try
                {
                    var section = SidebarControl.SideBarItems.FirstOrDefault(x => x.Text == "SidebarLibraries".GetLocalized()) as LocationItem;
                    if (UserSettingsService.SidebarSettingsService.ShowLibrarySection && section == null)
                    {
                        librarySection = new LocationItem
                        {
                            Text             = "SidebarLibraries".GetLocalized(),
                            Section          = SectionType.Library,
                            SelectsOnInvoked = false,
                            Icon             = await UIHelpers.GetIconResource(Constants.ImageRes.Libraries),
                            ChildItems       = new ObservableCollection <INavigationControlItem>()
                        };
                        var index = (SidebarControl.SideBarItems.Any(item => item.Section == SectionType.Favorites) ? 1 : 0); // After favorites section
                        SidebarControl.SideBarItems.BeginBulkOperation();
                        SidebarControl.SideBarItems.Insert(Math.Min(index, SidebarControl.SideBarItems.Count), librarySection);
                        SidebarControl.SideBarItems.EndBulkOperation();
                    }
                }
                finally
                {
                    SidebarControl.SideBarItemsSemaphore.Release();
                }

                Libraries.BeginBulkOperation();
                Libraries.Clear();
                var libs = await LibraryHelper.ListUserLibraries();
                if (libs != null)
                {
                    libs.Sort();
                    Libraries.AddRange(libs);
                }
                Libraries.EndBulkOperation();
            });
        }
Exemplo n.º 8
0
    void Update()
    {
        if (running)
        {
            if (usesLimit)
            {
                finalTime = endTime - Time.time;

                if (finalTime < (float)tick + 0.05f)
                {
                    if (tick == 0)
                    {
                    }
                    else
                    {
                        SoundController.PlaySoundEffect(Sounds.TICK);
                    }
                    tick--;
                }

                if (finalTime <= 10f)
                {
                    time.color = Color.red;
                }

                time.text = UIHelpers.ConvertToMillisecondsTimeString(finalTime);
                if (Time.time > endTime)
                {
                    running   = false;
                    time.text = "00:00:00";
                    GameController.Timeout();
                }
            }
            else
            {
                finalTime = Time.time - startTime;
                time.text = UIHelpers.ConvertToMillisecondsTimeString(finalTime);
            }
        }
    }
Exemplo n.º 9
0
        public StrategyTestForm()
        {
            _settingsManager = Factories.CreateSettingsManager();
            _logger          = LoggerFactory.Create(_settingsManager.LogFilePath);

            this._timeManager = ServiceFactory.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Begin),
                                                                 _settingsManager.GetSettingValue(AppSettingsKey.End));

            InitializeComponent();

            if (HasTradeSettings)
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("策略設定", Color.Black, DockStyle.Fill), 0, 0);
            }
            else
            {
                this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("您還沒有設定策略. 請先設定策略才可同步下單.", Color.Red, DockStyle.Fill), 0, 0);
            }

            InitOrderMaker();
            InitStrategyUI();
        }
Exemplo n.º 10
0
        //sets the values of the interval types
        private void setIntevalValues()
        {
            var rbAutoSaves = UIHelpers.FindRBChildren(this, "AutoSave");

            foreach (RadioButton rbInterval in rbAutoSaves)
            {
                if (rbInterval.Tag.ToString() == this.Options.AutoSave.ToString())
                {
                    rbInterval.IsChecked = true;
                }
            }

            var rbClearings = UIHelpers.FindRBChildren(this, "ClearStats");

            foreach (RadioButton rbInterval in rbClearings)
            {
                if (rbInterval.Tag.ToString() == this.Options.ClearStats.ToString())
                {
                    rbInterval.IsChecked = true;
                }
            }
        }
 partial void LoginButtonClicked(NSObject sender)
 {
     if (!string.IsNullOrEmpty(EmailAddressField.StringValue))
     {
         var userDefaults = new NSUserDefaults();
         var email        = EmailAddressField.StringValue;
         userDefaults.SetString(email, "LostCousinsEmail");
         userDefaults.Synchronize();
     }
     WebsiteAvailable = ExportToLostCousins.CheckLostCousinsLogin(EmailAddressField.StringValue, PasswordField.StringValue);
     //LoginButtonOutlet.BezelColor = websiteAvailable ? Color.LightGreen : Color.Red;
     LoginButtonOutlet.Enabled       = !WebsiteAvailable;
     LostCousinsUpdateButton.Enabled = WebsiteAvailable && ConfirmRootPerson.State == NSCellStateValue.On;
     if (WebsiteAvailable)
     {
         UIHelpers.ShowMessage("Lost Cousins login succeeded.");
     }
     else
     {
         UIHelpers.ShowMessage("Unable to login to Lost Cousins website. Check email/password and try again.");
     }
 }
Exemplo n.º 12
0
        private void PageAirports_Loaded(object sender, RoutedEventArgs e)
        {
            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            frmContent.Navigate(new PageShowAirports()
            {
                Tag = this
            });

            var countries = Airports.GetAllAirports().Select(a => new CountryCurrentCountryConverter().Convert(a.Profile.Country) as Country).Distinct().ToList();

            countries.Add(Countries.GetCountry("100"));

            ComboBox cbCountry = UIHelpers.FindChild <ComboBox>(this, "cbCountry");
            ComboBox cbRegion  = UIHelpers.FindChild <ComboBox>(this, "cbRegion");

            cbCountry.ItemsSource = countries.OrderByDescending(c => c.Uid == "100").ThenBy(c => c.Name);

            var regions = countries.Select(c => c.Region).Distinct().ToList().OrderByDescending(r => r.Uid == "100").ThenBy(r => r.Name);

            cbRegion.ItemsSource = regions;
        }
Exemplo n.º 13
0
        private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Alliance alliance = new Alliance(GameObject.GetInstance().GameTime, txtName.Text.Trim(), (Airport)cbHeadquarter.SelectedItem);

            alliance.Logo = logoPath;
            alliance.addMember(new AllianceMember(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime));

            Alliances.AddAlliance(alliance);

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Alliances")
                    .FirstOrDefault();

                //matchingItem.IsSelected = true;
                tab_main.SelectedItem = matchingItem;
            }
        }
Exemplo n.º 14
0
        private void PageRoutePlanner_Loaded(object sender, RoutedEventArgs e)
        {
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Route")
                    .FirstOrDefault();

                matchingItem.Visibility = System.Windows.Visibility.Collapsed;
            }

            foreach (RouteTimeTableEntry entry in this.Airliner.Routes.SelectMany(r => r.TimeTable.Entries.Where(en => en.Airliner == this.Airliner)))
            {
                this.Entries.Add(entry);
            }

            cbRoute.SelectedIndex    = 0;
            cbOutbound.SelectedIndex = 0;
        }
Exemplo n.º 15
0
        public async Task ShowHideRecycleBinItemAsync(bool show)
        {
            await SidebarControl.SideBarItemsSemaphore.WaitAsync();

            try
            {
                if (show)
                {
                    var recycleBinItem = new LocationItem
                    {
                        Text = ApplicationData.Current.LocalSettings.Values.Get("RecycleBin_Title", "Recycle Bin"),
                        Font = Application.Current.Resources["RecycleBinIcons"] as FontFamily,
                        IsDefaultLocation = true,
                        Icon = UIHelpers.GetImageForIconOrNull(IconResources?.FirstOrDefault(x => x.Index == Constants.ImageRes.RecycleBin).Image),
                        Path = App.AppSettings.RecycleBinPath
                    };
                    // Add recycle bin to sidebar, title is read from LocalSettings (provided by the fulltrust process)
                    // TODO: the very first time the app is launched localized name not available
                    if (!favoriteSection.ChildItems.Any(x => x.Path == App.AppSettings.RecycleBinPath))
                    {
                        favoriteSection.ChildItems.Add(recycleBinItem);
                    }
                }
                else
                {
                    foreach (INavigationControlItem item in favoriteSection.ChildItems.ToList())
                    {
                        if (item is LocationItem && item.Path == App.AppSettings.RecycleBinPath)
                        {
                            favoriteSection.ChildItems.Remove(item);
                        }
                    }
                }
            }
            finally
            {
                SidebarControl.SideBarItemsSemaphore.Release();
            }
        }
Exemplo n.º 16
0
        private void btnHire_Click(object sender, RoutedEventArgs e)
        {
            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2801"), Translator.GetInstance().GetString("MessageBox", "2801", "message"), WPFMessageBoxButtons.YesNo);


            if (result == WPFMessageBoxResult.Yes)
            {
                GameObject.GetInstance().HumanAirline.addPilot(this.Pilot);
            }

            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var matchingItem =
                    tab_main.Items.Cast <TabItem>()
                    .Where(item => item.Tag.ToString() == "Pilots")
                    .FirstOrDefault();

                tab_main.SelectedItem = matchingItem;
            }
        }
        private void componentComboBox_Selected(object sender, RoutedEventArgs e)
        {
            ComboBox             comboBox = sender as ComboBox;
            EquipmentListControl eList    = UIHelpers.FindVisualChild <EquipmentListControl>(this);

            if (eList != null)
            {
                if (eList.SelectedItem != null)
                {
                    eList.SelectedItem = null;
                    Storyboard moveBack = (Storyboard)FindResource("systemMoveBack");
                    moveBack.Begin();
                }
            }
            ControllerListControl cList = UIHelpers.FindVisualChild <ControllerListControl>(this);

            if (cList != null)
            {
                cList.SelectedItem = null;
            }
            PanelListControl pList = UIHelpers.FindVisualChild <PanelListControl>(this);

            if (pList != null)
            {
                pList.SelectedItem = null;
            }
            SystemComponentIndex selectedValue = (SystemComponentIndex)comboBox.SelectedValue;

            if (selectedValue == SystemComponentIndex.Connections ||
                selectedValue == SystemComponentIndex.Misc ||
                selectedValue == SystemComponentIndex.Proposal ||
                selectedValue == SystemComponentIndex.Controllers ||
                selectedValue == SystemComponentIndex.Valves)
            {
                Storyboard move = (Storyboard)FindResource("systemMove");
                move.Begin();
            }
        }
Exemplo n.º 18
0
        public void AddCell(PropertyDescriptor data)
        {
            if (data.PropObject == null)
            {
                return;
            }

            var go = _itemContainer.CreateGameObject("PropCell");

            go.AddComponent <RectTransform>();
            var layoutElement = go.AddComponent <LayoutElement>();

            layoutElement.preferredHeight = 16;
            layoutElement.preferredWidth  = 70;

            var contentSizeFitter = go.AddComponent <ContentSizeFitter>();

            contentSizeFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
            contentSizeFitter.verticalFit   = ContentSizeFitter.FitMode.PreferredSize;

            //go.AddComponent<StackLayoutGroup>();

            var cellType = data.Type switch
            {
                EPropertyType.Float => typeof(FloatPropCell),
                EPropertyType.Bool => typeof(BoolPropCell),
                EPropertyType.Color => typeof(ColorPropCell),
                EPropertyType.Texture => typeof(TexturePropCell),
                _ => throw new ArgumentOutOfRangeException()
            };

            var comp = (BasePropCell)go.AddComponent(cellType);

            UIHelpers.ParseFromResource(comp.ContentLocation, go, comp);
            comp.SetData(data);
            _cells.Add(comp);
        }
    }
        private void myTreeView_Drop(object sender, DragEventArgs e)
        {
            TreeViewItem row = UIHelpers.TryFindFromPoint <TreeViewItem>((UIElement)sender, e.GetPosition(myTreeView));

            ProjectFolder blkFld = (ProjectFolder)myTreeView.ItemFromContainer(row);

            while (blkFld != null && !(blkFld is S7ProgrammFolder))
            {
                blkFld = ((ProjectFolder)blkFld).Parent;
                row    = row.TryFindParent <TreeViewItem>();
            }

            if (blkFld != null)
            {
                string             connName = (string)e.Data.GetData("ConnectionName");
                OnlineBlocksFolder oldFld   = null;
                foreach (var projectFolder in blkFld.SubItems)
                {
                    if (projectFolder is OnlineBlocksFolder)
                    {
                        oldFld = (OnlineBlocksFolder)projectFolder;
                    }
                }
                if (oldFld != null)
                {
                    blkFld.SubItems.Remove(oldFld);
                }

                var onlBlkFld = new OnlineBlocksFolder(connName)
                {
                    Parent = blkFld
                };
                blkFld.SubItems.Add(onlBlkFld);
                ((IProgrammFolder)blkFld).OnlineBlocksFolder = onlBlkFld;

                row.Items.Refresh();
            }
        }
Exemplo n.º 20
0
        protected override void OnContextMenuOpening(ContextMenuEventArgs e)
        {
            var mouseTarget        = InputHitTest(Mouse.GetPosition(this)) as DependencyObject;
            var targetListViewItem = UIHelpers.FindVisualAncestorByType <ListBoxItem>(mouseTarget);

            if (targetListViewItem == null)
            {
                e.Handled = true;
                return;
            }

            var tradeRoute = targetListViewItem.DataContext as TradeRoute;

            if (tradeRoute == null)
            {
                e.Handled = true;
                return;
            }

            PopulateTradeRouteMenu(tradeRoute);

            base.OnContextMenuOpening(e);
        }
Exemplo n.º 21
0
        private void tRemoteList_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (_checkingNodes)
            {
                return;
            }

            // If this is a folder node: uncheck all child nodes in the GUI
            // but only put this node (parent folder) in the ignored list.

            _checkingNodes = true;
            UIHelpers.CheckUncheckChildNodes(e.Node, e.Node.Checked);

            if (e.Node.Checked && e.Node.Parent != null && !e.Node.Parent.Checked)
            {
                e.Node.Parent.Checked = true;
                UIHelpers.CheckSingleRoute(e.Node.Parent);
            }

            _checkingNodes = false;

            Program.Account.IgnoreList.Items = UIHelpers.GetUncheckedItems(tRemoteList.Nodes).ToList();
        }
Exemplo n.º 22
0
        private async Task ImportSettings()
        {
            FileOpenPicker filePicker = new FileOpenPicker();

            filePicker.FileTypeFilter.Add(Path.GetExtension(Constants.LocalSettings.UserSettingsFileName));

            StorageFile file = await filePicker.PickSingleFileAsync();

            if (file != null)
            {
                try
                {
                    string import = await FileIO.ReadTextAsync(file);

                    UserSettingsService.ImportSettings(import);
                }
                catch
                {
                    UIHelpers.CloseAllDialogs();
                    await DialogDisplayHelper.ShowDialogAsync("SettingsImportErrorTitle".GetLocalized(), "SettingsImportErrorDescription".GetLocalized());
                }
            }
        }
Exemplo n.º 23
0
    /// <summary>
    /// Enables "minimize to tray" behavior for the specified Window.
    /// </summary>
    /// <param name="window">Window to enable the behavior for.</param>
    public static void Enable(Window window, bool minimizeNow)
    {
        UIHelpers.HideFromAltTab(window);
        if (MinimizeInstances.ContainsKey(window))
        {
            Console.WriteLine(string.Format("Minimization already enabled for '{0}'", window.Title));
            if (minimizeNow)
            {
                MinimizeInstances[window].MinimizeNow();
            }
        }
        else
        {
            var instance = new MinimizeToTrayInstance(window);
            instance.Enable();
            MinimizeInstances.Add(window, instance);

            if (minimizeNow)
            {
                instance.MinimizeNow();
            }
        }
    }
Exemplo n.º 24
0
        private async void UpdateMilestoneListAsync()
        {
            (string owner, string repository) = UIHelpers.GetRepoOwner(cboAvailableRepos.SelectedItem);

            IEnumerable <IssueMilestone> milestones = await s_issueManager.GetMilestonesAsync(owner, repository);

            cboMilestones.Enabled = false;

            // keep track of the old selected milestone and try to re-apply it in the new repo
            IssueMilestone previousMilestone = cboMilestones.SelectedItem as IssueMilestone;
            IssueMilestone newMilestoneInUI  = null;

            cboMilestones.Items.Clear();

            foreach (IssueMilestone item in milestones)
            {
                IssueMilestone newMilestone = item;
                cboMilestones.Items.Add(newMilestone);

                // if a milestone was selected previously and we did have a milestone in the new repo that has the same title
                // then use that in the UI.
                if (previousMilestone != null && previousMilestone.Title == newMilestone.Title)
                {
                    newMilestoneInUI = newMilestone;
                }
            }

            cboMilestones.SelectedItem = newMilestoneInUI;

            // if we did not find a matching milestone in the new repo, clear the text.
            if (newMilestoneInUI == null)
            {
                cboMilestones.Text = string.Empty;
            }

            cboMilestones.Enabled = true;
        }
Exemplo n.º 25
0
        public override void ChooseDowsingTypeAtMouse(Player player)
        {
            var       item_info    = this.item.GetGlobalItem <RodItemInfo>();
            Rectangle screen_frame = UIHelpers.GetWorldFrameOfScreen();
            Vector2   screen_mouse = UIHelpers.ConvertToScreenPosition(new Vector2(Main.mouseX, Main.mouseY) + Main.screenPosition);
            Vector2   world_mouse  = screen_mouse + new Vector2(screen_frame.X, screen_frame.Y);
            int       tile_x       = (int)(world_mouse.X / 16);
            int       tile_y       = (int)(world_mouse.Y / 16);
            Tile      tile         = Framing.GetTileSafely(tile_x, tile_y);

            if (!TileHelpers.IsAir(tile))
            {
                if (TileIdentityHelpers.IsObject(tile.type))
                {
                    string text = Lang.GetMapObjectName(Main.Map[tile_x, tile_y].Type);

                    text = TileIdentityHelpers.GetVanillaTileName(item_info.TargetTileType);

                    if (text == "")
                    {
                        Main.NewText("Vining Rod now attuned to some kind of material...", RodItem.AttunedColor);
                    }
                    else
                    {
                        Main.NewText("Vining Rod now attuned to any " + text, RodItem.AttunedColor);
                    }

                    item_info.TargetTileType = tile.type;

                    RodItem.RenderDowseEffect(new Vector2(tile_x * 16, tile_y * 16), 5, Color.GreenYellow);
                }
                else
                {
                    Main.NewText("Vining Rod may only attune to objects.", Color.Yellow);
                }
            }
        }
Exemplo n.º 26
0
        //shows a route
        private void showRoute(Route route, Panel panelMap, int zoom, Point margin, Boolean isStopoverRoute = false, Airline airline = null)
        {
            if (route.HasStopovers)
            {
                foreach (Route leg in route.Stopovers.SelectMany(s => s.Legs))
                {
                    showRoute(leg, panelMap, zoom, margin, true, route.Airline);
                }
            }
            else
            {
                Point pos = UIHelpers.WorldToTilePos(route.Destination1.Profile.Coordinates.convertToGeoCoordinate(), zoom);

                Point p = new Point(pos.X * ImageSize - margin.X * ImageSize, pos.Y * ImageSize - margin.Y * ImageSize);

                if (p.X < panelMap.Width)
                {
                    panelMap.Children.Add(createPin(p, route.Destination1));
                }

                pos = UIHelpers.WorldToTilePos(route.Destination2.Profile.Coordinates.convertToGeoCoordinate(), zoom);

                p = new Point(pos.X * ImageSize - margin.X * ImageSize, pos.Y * ImageSize - margin.Y * ImageSize);

                if (p.X < panelMap.Width)
                {
                    panelMap.Children.Add(createPin(p, route.Destination2));
                }

                if (airline == null)
                {
                    airline = route.Airline;
                }

                createRouteLine(route.Destination1, route.Destination2, panelMap, zoom, margin, airline, isStopoverRoute);
            }
        }
Exemplo n.º 27
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "New" && frmContent != null)
            {
                frmContent.Navigate(new PageStartData()
                {
                    Tag = this
                });
            }

            if (selection == "Airline" && frmContent != null)
            {
                frmContent.Navigate(new PageNewAirline());
            }

            if (selection == "Difficulty" && frmContent != null)
            {
                frmContent.Navigate(new PageCreateDifficulty()
                {
                    Tag = this
                });
            }

            if (selection == "Scenario" && frmContent != null)
            {
                frmContent.Navigate(new PageShowScenario()
                {
                    Tag = this
                });
            }
        }
Exemplo n.º 28
0
        public async Task Open(bool notify = true)
        {
            if (_firstActivation)
            {
                ParserParams = await _bsmlDecorator.ParseFromResourceAsync(_resourceName, gameObject, this);

                gameObject.SetActive(false);
                _firstActivation = false;

                foreach (var obj in ParserParams.GetObjectsWithTag("canvas"))
                {
                    var newParent = obj.transform.parent.CreateGameObject("CanvasContainer");
                    newParent.AddComponent <RectTransform>();
                    newParent.AddComponent <VerticalLayoutGroup>();
                    newParent.AddComponent <ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
                    newParent.AddComponent <LayoutElement>();

                    newParent.AddComponent <Canvas>();
                    var canvasScaler = newParent.AddComponent <CanvasScaler>();
                    canvasScaler.referencePixelsPerUnit = 10;
                    canvasScaler.scaleFactor            = 3.44f;

                    newParent.AddComponent <CurvedCanvasSettings>();
                    UIHelpers.AddVrRaycaster(newParent, _raycasterWithCache);

                    obj.transform.SetParent(newParent.transform, false);
                }

                await Init();
            }

            gameObject.SetActive(true);
            if (notify)
            {
                DidOpen();
            }
        }
Exemplo n.º 29
0
        private void PageShowRoute_Loaded(object sender, RoutedEventArgs e)
        {
            if (!this.Route.IsCargoRoute)
            {
                foreach (MVVMRouteClass rClass in this.Classes)
                {
                    foreach (MVVMRouteFacility rFacility in rClass.Facilities)
                    {
                        var facility = ((PassengerRoute)this.Route).Classes.Find(c => c.Type == rClass.Type).Facilities.Find(f => f.Type == rFacility.Type);
                        rFacility.SelectedFacility = facility;
                    }
                }
            }
            TabControl tab_main = UIHelpers.FindChild <TabControl>(this.Tag as Page, "tabMenu");

            if (tab_main != null)
            {
                var airlinerItem = tab_main.Items.Cast <TabItem>()
                                   .Where(item => item.Tag.ToString() == "Airliner")
                                   .FirstOrDefault();

                airlinerItem.Visibility = System.Windows.Visibility.Collapsed;
            }
        }
Exemplo n.º 30
0
        private void tcMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TabControl control = (TabControl)sender;

            string selection = ((TabItem)control.SelectedItem).Tag.ToString();

            Frame frmContent = UIHelpers.FindChild <Frame>(this, "frmContent");

            if (selection == "Airports" && frmContent != null)
            {
                frmContent.Navigate(new PageShowAirports()
                {
                    Tag = this
                });
            }

            if (selection == "Statistics" && frmContent != null)
            {
                frmContent.Navigate(new PageAirportsStatistics()
                {
                    Tag = this
                });
            }
        }