public SetupWizardGarminCategoryAssociationControl(ExtendedWizard wizard) : base(wizard) { InitializeComponent(); Options.Instance.OptionsChanged += new Options.OptionsChangedEventHandler(OnOptionsChanged); ExplanationLabel.Text = GarminFitnessView.GetLocalizedString("CategoryAssociationExplanationText"); ParentCategoryRadioButton.Text = GarminFitnessView.GetLocalizedString("UseParentCategoryText"); CustomCategoryRadioButton.Text = GarminFitnessView.GetLocalizedString("UseCustomCategoryText"); RunningRadioButton.Text = GarminFitnessView.GetLocalizedString("RunningText"); CyclingRadioButton.Text = GarminFitnessView.GetLocalizedString("BikingText"); OtherRadioButton.Text = GarminFitnessView.GetLocalizedString("OtherText"); // Fill category list IApplication app = PluginMain.GetApplication(); List<TreeList.TreeListNode> categories = new List<TreeList.TreeListNode>(); for (int i = 0; i < app.Logbook.ActivityCategories.Count; ++i) { IActivityCategory currentCategory = app.Logbook.ActivityCategories[i]; STToGarminActivityCategoryWrapper newNode = new STToGarminActivityCategoryWrapper(null, currentCategory); categories.Add(newNode); AddCategoryNode(newNode, null); } ActivityCategoryList.RowData = categories; ActivityCategoryList.Columns.Clear(); ActivityCategoryList.Columns.Add(new TreeList.Column("Name", GarminFitnessView.GetLocalizedString("CategoryText"), 150, StringAlignment.Near)); ActivityCategoryList.Columns.Add(new TreeList.Column("GarminCategory", "", 100, StringAlignment.Near)); }
public STToGarminActivityCategoryWrapper(STToGarminActivityCategoryWrapper parent, IActivityCategory element) : base(parent, element) { }
private void AddCategoryNode(STToGarminActivityCategoryWrapper categoryNode, STToGarminActivityCategoryWrapper parent) { IActivityCategory category = (IActivityCategory)categoryNode.Element; if (parent != null) { parent.Children.Add(categoryNode); } for (int i = 0; i < category.SubCategories.Count; ++i) { IActivityCategory currentCategory = category.SubCategories[i]; STToGarminActivityCategoryWrapper newNode = new STToGarminActivityCategoryWrapper(categoryNode, currentCategory); AddCategoryNode(newNode, categoryNode); } }
private void UpdateCategoriesTreeList() { List<TreeList.TreeListNode> categories = new List<TreeList.TreeListNode>(); if (PluginMain.GetApplication().Logbook != null) { for (int i = 0; i < PluginMain.GetApplication().Logbook.ActivityCategories.Count; ++i) { IActivityCategory currentCategory = PluginMain.GetApplication().Logbook.ActivityCategories[i]; STToGarminActivityCategoryWrapper newNode = new STToGarminActivityCategoryWrapper(null, currentCategory); categories.Add(newNode); AddCategoryNode(newNode, null); } } ActivityCategoryList.RowData = categories; ActivityCategoryList.Columns.Clear(); ActivityCategoryList.Columns.Add(new TreeList.Column("Name", GarminFitnessView.GetLocalizedString("CategoryText"), 150, StringAlignment.Near)); ActivityCategoryList.Columns.Add(new TreeList.Column("GarminCategory", "", 110, StringAlignment.Near)); }