public MapControl3D() { this.Config = new MapControlConfig(); this.HoverTileView = new TileAreaView(); this.SelectionTileAreaView = new TileAreaView(); m_game = new MyGame(this); m_game.CursorService.LocationChanged += OnCursorMoved; m_game.SelectionService.SelectionChanged += OnSelectionChanged; m_game.SelectionService.GotSelection += OnGotSelection; m_game.Start(); m_toolTipService = new ToolTipService(this); }
public ToolBarCheckBox(Codon codon, object caller, IReadOnlyCollection <ICondition> conditions) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.conditions = conditions; this.Command = CommandWrapper.CreateCommand(codon, conditions); this.CommandParameter = caller; ICheckableMenuCommand cmd = CommandWrapper.Unwrap(this.Command) as ICheckableMenuCommand; if (cmd != null) { isCheckedBinding = SetBinding(IsCheckedProperty, new Binding("IsChecked") { Source = cmd, Mode = BindingMode.OneWay }); } if (codon.Properties.Contains("template") || codon.Properties.Contains("style") || codon.Properties.Contains("packIconKey")) { ToolBarService.CreateTemplatedToolBarItem(this, codon); } else { this.Content = ToolBarService.CreateToolBarItemContent(codon); } if (codon.Properties.Contains("name")) { this.Name = codon.Properties["name"]; } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.CheckBoxStyleKey); }
// set new device private async void SetNewDevice(DeviceInformation device) { await DisconnectDevice(); ChosenDevice = device; // set chosen device in the public variable this.ConnectStatusText.Text = "Selected device:\n" + "\"" + device.Name + "\""; // change info text with the name of the chosen device // set tooltip to the infotext to show the id of the connected ToolTipService.SetToolTip(this.ConnectStatusText, new ToolTip { Content = ChosenDevice.Name + "\n[id: " + ChosenDevice.Id.ToString() + "]" }); // change hyper link button text (pure estesic purposes) this.DevicesPageLink.Content = "Change device"; AddLog("Device selected: " + ChosenDevice.Name, AppLog.LogCategory.Debug); // check if the device is a mi band in order to use an alternative connection method IsMiBand2 = false; if (ChosenDevice.Name.ToLower().Contains("mi band 2")) { AddLog("Mi Band 2 detected, switched to alternative connection method.", AppLog.LogCategory.Debug); IsMiBand2 = true; miBand = new MiBand2(); } ListCurrentDeviceServicesToLog(); // list all available services of the chosen device in the loglist (debug purposes) await CheckBluetoothStatus(true); // check bluetooth state and if it's turned off, try to turn it on // enable the connect button and set a tooltip this.ConnectButton.IsEnabled = true; ToolTipService.SetToolTip(this.ConnectButton, new ToolTip { Content = "Press this button to connect to the choosen device" }); }
// #region InsertModelPage ============================================== public void InsertModelPage(IRootModel model) { if (model is null) { return; } model.DataRoot.SetLocalizer(Helpers.ResourceExtensions.CoreLocalizer()); var item = navigationView.MenuItems .OfType <WinUI.NavigationViewItem>() .FirstOrDefault(menuItem => (menuItem.Name == "Home")); if (item is null) { return; } var index = navigationView.MenuItems.IndexOf(item) + 2; var navItem = new WinUI.NavigationViewItem { Content = model.TitleName, Icon = new SymbolIcon(Symbol.AllApps), Tag = model }; ToolTipService.SetToolTip(navItem, model.TitleSummary); navItem.Loaded += NavItem_Loaded; navigationView.MenuItems.Insert(index, navItem); //navigationView.SelectedItem = navItem; //Selected = navItem; NavigationService.Navigate(typeof(ModelPage), model); }
internal static MenuItem NewMenuItem(IEntityOperationContext eoc, EntityOperationGroup group) { var man = OperationClient.Manager; MenuItem menuItem = new MenuItem { Header = eoc.OperationSettings?.Text ?? (group == null || group.SimplifyName == null ? eoc.OperationInfo.OperationSymbol.NiceToString() : group.SimplifyName(eoc.OperationInfo.OperationSymbol.NiceToString())), Icon = man.GetImage(eoc.OperationInfo.OperationSymbol, eoc.OperationSettings).ToSmallImage(), Tag = eoc.OperationInfo, Background = man.GetBackground(eoc.OperationInfo, eoc.OperationSettings) }; if (eoc.OperationSettings != null && eoc.OperationSettings.Order != 0) { Common.SetOrder(menuItem, eoc.OperationSettings.Order); } AutomationProperties.SetName(menuItem, eoc.OperationInfo.OperationSymbol.Key); eoc.SenderButton = menuItem; if (eoc.CanExecute != null) { menuItem.ToolTip = eoc.CanExecute; menuItem.IsEnabled = false; ToolTipService.SetShowOnDisabled(menuItem, true); AutomationProperties.SetHelpText(menuItem, eoc.CanExecute); } else { menuItem.Click += (_, __) => OperationExecute(eoc); } return(menuItem); }
public MarkerMapElement(MapElement element, int direction, Map map, ElementLayer mapMarkerLayer) { Image img = new Image() { Width = 32, Height = 37, Margin = new Thickness(0, 0, 0, 37), Source = new BitmapImage(new Uri(GetIconUrl(element), UriKind.RelativeOrAbsolute)), Cursor = Cursors.Hand }; this._mapElement = element; this.ID = element.ID; this.MapElementCategoryID = (int)element.MapElementCategoryID; this.Name = element.ReservedField1; this.Point = new Point((double)element.X, (double)element.Y); this.Direction = direction; this.MapMarker = img; ToolTipService.SetToolTip(this.MapMarker, this.Name); this.Map = map; this.ElementLayer = mapMarkerLayer; }
private void Refresh() { if (this.Item != null) { if (this.EnabledMenu) { this.UseBorderElement.Visibility = Visibility.Visible; this.MenuElement.Visibility = Visibility.Visible; } else { this.UseBorderElement.Visibility = Visibility.Collapsed; this.MenuElement.Visibility = Visibility.Collapsed; } // If this slot type is item or equipment then enable drag and drop. if (this.SlotType == ItemSlotType.Item || this.SlotType == ItemSlotType.Equipment || this.SlotType == ItemSlotType.Spell) { this.EnableDragAndDrop = true; } this.Source = ImageManager.GetImageSource(this.Item.ImageUri()); this.Quantity = this.Item.Quantity(); ToolTipService.SetToolTip(this, String.Format("{0}", this.Item.Name)); } else { ToolTipService.SetToolTip(this, this.ToolTip); this.Source = null; this.Quantity = 0; this.UseBorderElement.Visibility = Visibility.Collapsed; this.MenuElement.Visibility = Visibility.Collapsed; } }
public void VerifySettingsItemToolTip() { NavigationView navView = null; NavigationViewItem settingsItem = null; RunOnUIThread.Execute(() => { navView = new NavigationView(); navView.IsSettingsVisible = true; navView.IsPaneOpen = true; MUXControlsTestApp.App.TestContentRoot = navView; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { settingsItem = (NavigationViewItem)navView.SettingsItem; var toolTip = ToolTipService.GetToolTip(settingsItem); Verify.IsNull(toolTip, "Verify tooltip is disabled when pane is open"); navView.IsPaneOpen = false; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { var toolTip = ToolTipService.GetToolTip(settingsItem); Verify.IsNotNull(toolTip, "Verify tooltip is enabled when pane is closed"); MUXControlsTestApp.App.TestContentRoot = null; }); }
private void AppendResults(string text, bool error = false, string tooltip = null) { var run = new Run() { Text = text }; var para = new Paragraph(); para.Inlines.Add(run); para.Margin = new Thickness(2); textboxResult.Blocks.Add(para); if (error) { para.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red); para.FontWeight = Windows.UI.Text.FontWeights.Bold; } if (!string.IsNullOrEmpty(tooltip)) { // try this one out sometime // https://stackoverflow.com/questions/27649534/set-tooltip-on-range-of-text-in-wpf-richtextbox _tooltipText.Add(run, tooltip); if (ToolTipService.GetToolTip(textboxResult) == null) { ToolTip tip = new ToolTip(); tip.Content = tooltip; ToolTipService.SetToolTip(textboxResult, tip); tip.Opened += Tip_Opened; tip.Closed += Tip_Closed; } //var run2 = new Run() { Text = " " + tooltip.Replace("\r\n", ", ") }; //run2.Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Gray); //run2.FontStyle = Windows.UI.Text.FontStyle.Italic; //para.Inlines.Add(run2); } }
public ToolBarButton(UIElement inputBindingOwner, Codon codon, object caller, bool createCommand) { ToolTipService.SetShowOnDisabled(this, true); this.codon = codon; this.caller = caller; this.Command = CommandWrapper.GetCommand(codon, caller, createCommand); this.Content = ToolBarService.CreateToolBarItemContent(codon); if (codon.Properties.Contains("name")) { this.Name = codon.Properties["name"]; } if (!string.IsNullOrEmpty(codon.Properties["shortcut"])) { KeyGesture kg = MenuService.ParseShortcut(codon.Properties["shortcut"]); MenuCommand.AddGestureToInputBindingOwner(inputBindingOwner, kg, this.Command, GetFeatureName()); this.inputGestureText = kg.GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture); } UpdateText(); SetResourceReference(FrameworkElement.StyleProperty, ToolBar.ButtonStyleKey); }
private async void UpdateDeviceOnlineStatus() { this.connectedDevice.Text = $"You are connected to {App.AppData.ConnectedAucovei.DisplayName}."; while (!this.tokenSrc.IsCancellationRequested) { try { bool result = await this.svcHelper.IsAucovieOnlineAsync(App.AppData.ConnectedAucovei.Id); if (result) { this.connStatus.Fill = this.greenBrush; ToolTipService.SetToolTip(this.connStatus, "Online"); } else { this.connStatus.Fill = this.greyBrush; ToolTipService.SetToolTip(this.connStatus, "Offline"); } } catch (UnauthorizedAccessException uex) { this.tokenSrc.Cancel(); MessageDialog dlg = new MessageDialog(uex.Message); this.rootPage.ShowError(dlg); } catch { //do nothing } finally { await Task.Delay(TimeSpan.FromMilliseconds(500)); } } }
private void ChangeOverviewState(bool isOpen) { if (isOpen) { switch (Position) { case OverviewMapPosition.LowerRight: OverviewPanelTransform.X = myOverviewMap.Width; OverviewPanelTransform.Y = myOverviewMap.Height; break; case OverviewMapPosition.UpperRight: OverviewPanelTransform.X = myOverviewMap.Width; OverviewPanelTransform.Y = -myOverviewMap.Height; break; case OverviewMapPosition.LowerLeft: OverviewPanelTransform.X = -myOverviewMap.Width; OverviewPanelTransform.Y = myOverviewMap.Height; break; case OverviewMapPosition.UpperLeft: OverviewPanelTransform.X = -myOverviewMap.Width; OverviewPanelTransform.Y = -myOverviewMap.Height; break; } (this.Resources[SB_OPEN_OVERVIEWMAP] as Storyboard).Begin(); ToolTipService.SetToolTip(OverviewToggler, "Click to close overview map"); } else { (this.Resources[SB_HIDE_OVERVIEWMAP] as Storyboard).Begin(); ToolTipService.SetToolTip(OverviewToggler, "Click to open overview map"); } }
void FrmApprovalManagement_Loaded(object sender, RoutedEventArgs e) { this.dpStart.Text = System.DateTime.Now.AddDays(-20).ToShortDateString(); this.dpEnd.Text = System.DateTime.Now.ToShortDateString();//30天 txtOwnerName.Text = Common.CurrentLoginUserInfo.EmployeeName; InitEvent(); PARENT.Children.Add(loadbar);//在父面板中加载loading控件 GetEntityLogo("T_OA_APPROVALINFOTEMPLET"); Utility.DisplayGridToolBarButton(ToolBar, "T_OA_APPROVALINFOTEMPLET", true); ToolBar.btnNew.Click += new RoutedEventHandler(btnNew_Click); ToolBar.btnEdit.Click += new RoutedEventHandler(btnEdit_Click); ToolBar.btnDelete.Click += new RoutedEventHandler(btnDelete_Click); SearchUserID = Common.CurrentLoginUserInfo.EmployeeID; string Name = ""; Name = Common.CurrentLoginUserInfo.EmployeeName + "-" + Common.CurrentLoginUserInfo.UserPosts[0].PostName + "-" + Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName + "-" + Common.CurrentLoginUserInfo.EmployeeName + "-" + Common.CurrentLoginUserInfo.UserPosts[0].PostName + "-" + Common.CurrentLoginUserInfo.UserPosts[0].CompanyName; txtOwnerName.Text = Name; ToolTipService.SetToolTip(txtOwnerName, Name); ToolBar.btnRefresh.Click += new RoutedEventHandler(btnRefresh_Click); ToolBar.BtnView.Click += new RoutedEventHandler(BtnView_Click);//查看 ToolBar.btnAudit.Visibility = Visibility.Collapsed; ToolBar.ShowView(false); GetData(); }
private static void AddImageToMap(Aircraft aircraft) { //Print($"Adding to map {aircraft.Id}"); var image = new Image { Height = 16, Source = _black, Stretch = Stretch.None, DataContext = aircraft }; ToolTipService.SetToolTip(image, new ToolTip() { Content = aircraft.Manufacturer }); image.MouseDown += Image_PreviewMouseDown; var location = new Location() { Latitude = aircraft.Lat, Longitude = aircraft.Lon }; var position = PositionOrigin.Center; _imageLayer.AddChild(image, location, position); }
/// <summary> /// Initializes a new instance of the <see cref="AddAppointmentDialog"/> class. /// </summary> /// <param name="patientid">The patientid.</param> /// <param name="firstName">The first name.</param> /// <param name="lastName">The last name.</param> public AddAppointmentDialog(int patientid, string firstName, string lastName) { this.InitializeComponent(); this.dateTip = new ToolTip(); ToolTipService.SetToolTip(this.descriptionTextBox, this.dateTip); this.dateTip.Placement = PlacementMode.Bottom; this.patientid = patientid; this.patientFirstName = firstName; this.patientLastName = lastName; this.dateDatePicker.Date = DateTimeOffset.Now; this.timeTimePicker.Time = TimeSpan.Zero; this.IsPrimaryButtonEnabled = false; this.patientFirstNameTextBlock.Text = this.patientFirstName; this.patientLastNameTextBlock.Text = this.patientLastName; this.patientIdTextBlock.Text = this.patientid.ToString(); this.dateDatePicker.MinYear = DateTimeOffset.Now; this.doctorids = ViewModel.ViewModel.GetEveryDoctorId(); this.doctorIdComboBox.ItemsSource = this.doctorids; }
private void ConnectToService() { if (m_windowsServiceClient != null) { if ((object)m_windowsServiceClient != null && (object)m_windowsServiceClient.Helper != null && (object)m_windowsServiceClient.Helper.RemotingClient != null) { m_windowsServiceClient.Helper.RemotingClient.ConnectionEstablished -= RemotingClient_ConnectionEstablished; m_windowsServiceClient.Helper.RemotingClient.ConnectionTerminated -= RemotingClient_ConnectionTerminated; } } m_windowsServiceClient = CommonFunctions.GetWindowsServiceClient(); if ((object)m_windowsServiceClient != null) { m_windowsServiceClient.Helper.RemotingClient.ConnectionEstablished += RemotingClient_ConnectionEstablished; m_windowsServiceClient.Helper.RemotingClient.ConnectionTerminated += RemotingClient_ConnectionTerminated; if (m_windowsServiceClient.Helper.RemotingClient.CurrentState == ClientState.Connected) { EllipseConnectionState.Dispatcher.BeginInvoke((Action) delegate { EllipseConnectionState.Fill = Application.Current.Resources["GreenRadialGradientBrush"] as RadialGradientBrush; ToolTipService.SetToolTip(EllipseConnectionState, "Connected to the service"); }); } else { EllipseConnectionState.Dispatcher.BeginInvoke((Action) delegate { EllipseConnectionState.Fill = Application.Current.Resources["RedRadialGradientBrush"] as RadialGradientBrush; ToolTipService.SetToolTip(EllipseConnectionState, "Disconnected from the service"); }); } } }
public object AddTreeNode(object parentNode, string title, string tooltip, InfoColor color, bool expand) { ItemCollection collection = null; if (parentNode != null) { collection = (parentNode as RadTreeViewItem).Items; } else { collection = treeData.Items; } var newNode = new RadTreeViewItem(); newNode.Header = title; newNode.Foreground = UIManager.GetColorFromInfoColor(color); if (!string.IsNullOrEmpty(tooltip)) { ToolTipService.SetToolTip(newNode, tooltip); } collection.Add(newNode); newNode.IsExpanded = expand; return(newNode); }
public MarkerMapElement(MapElement element, int direction, Map map, ElementLayer mapMarkerLayer, Dictionary <int, Image> imglist) { this._mapElement = element; this.ID = element.ID; this.MapElementCategoryID = (int)element.MapElementCategoryID; this.Name = element.ReservedField1; this.Point = new Point((double)element.X, (double)element.Y); this.Direction = direction; if (element.MapElementCategoryID != 4) { this.MapMarker = new Image() { Width = 32, Height = 37, Margin = new Thickness(0, 0, 0, 37), Source = imglist[_mapElement.MapElementBizTypeID.Value].Source, Cursor = Cursors.Hand }; } else { this.MapMarker = new Image() { Width = 32, Height = 37, Margin = new Thickness(0, 0, 0, 37), Source = imglist[_mapElement.ReservedField8.Value].Source, Cursor = Cursors.Hand }; } ToolTipService.SetToolTip(this.MapMarker, this.Name); this.Map = map; this.ElementLayer = mapMarkerLayer; }
//以下所有的CreateXXX()方法仅仅是创建模型,初始化后也不显示在界面 /// <summary> /// 煤塔设置有瑕疵0321 /// </summary> public void CreateMT() { //焦炉模型:端台--1#炉区(55孔)--煤塔--2#炉区(55孔)--端台 //借鉴江西丰城的思路,界面显示完整的1#、2#炉区概貌,宽度为1024,每个room的width为7,煤塔宽度为12*7? //即12*7*3+110*7=252+770=1022<1024,2个像素的余量 for (int i = 0; i < mt.Length; i++) { mt[i] = new TextBox { Name = "mt" + (i + 1).ToString("00"), VerticalAlignment = VerticalAlignment.Center, Width = 7 * 12, Height = 110, Background = Brushes.Green, Foreground = Brushes.White, Cursor = Cursors.Hand, BorderBrush = Brushes.White, IsReadOnly = true, IsTabStop = false }; string mtTooltip = (i == 1) ? "煤塔" : (i == 0 ? "1#端台" : "2#端台"); ToolTipService.SetToolTip(mt[i], mtTooltip); Canvas.SetTop(mt[i], 200); double leftValue = 0; if (i == 0) { leftValue = 1; } else { leftValue = i == 1 ? (Canvas.GetLeft(rooms[54]) + rooms[54].Width) : (Canvas.GetLeft(rooms[109]) + rooms[109].Width); } Canvas.SetLeft(mt[i], leftValue); mainCanvas.Children.Add(mt[i]); } }
private void ValidateYearly() { if (IsValidDayMonth()) { PART_DialogOkButton.IsEnabled = true; YearlyDetails12.ClearValue(Control.ForegroundProperty); YearlyDetails12.ClearValue(Control.BorderBrushProperty); YearlyDetails12.ClearValue(Control.BorderThicknessProperty); YearlyDetails12.ClearValue(ToolTipService.ToolTipProperty); YearlyDetails11.ClearValue(Control.ForegroundProperty); YearlyDetails11.ClearValue(Control.BorderBrushProperty); YearlyDetails11.ClearValue(Control.BorderThicknessProperty); YearlyDetails11.ClearValue(ToolTipService.ToolTipProperty); } else { PART_DialogOkButton.IsEnabled = false; YearlyDetails11.BorderBrush = YearlyDetails12.BorderBrush = YearlyDetails11.Foreground = YearlyDetails12.Foreground = new SolidColorBrush(Colors.Red); YearlyDetails11.BorderThickness = YearlyDetails12.BorderThickness = new Thickness(2); int max = 31; int month = YearlyDetails12.SelectedIndex + 1; if (month == 4 || month == 6 || month == 9 || month == 11) { max = 30; } if (month == 2) { max = 29; } string error = String.Format(C1Localizer.GetString("ValidationErrors", "NumberIsOutOfRange", "Please enter value in the range: {0}."), (string)("1 - " + max)); ToolTipService.SetToolTip(YearlyDetails12, error); ToolTipService.SetToolTip(YearlyDetails11, error); } }
private void CtxmConvertToMenuItems(List <CtxmItemData> src, ItemCollection dest, CtxmCode code, bool shortcutTextforListType) { dest.Clear(); src.ForEach(data => { Control item; if (data.Command == EpgCmdsEx.Separator) { item = new Separator(); } else { var menu = new MenuItem(); menu.Header = data.Header; menu.Command = (EpgCmdsEx.IsDummyCmd(data.Command) ? null : data.Command); if (menu.Command != null) { if ((shortcutTextforListType == true || (MC.WorkCmdOptions[data.Command].GesTrg & MenuCmds.GestureTrg.ToView) == MenuCmds.GestureTrg.ToView) && (MC.WorkCmdOptions.ContainsKey(data.Command) == false || MC.WorkCmdOptions[data.Command].IsGestureEnabled == true) && data.ID == 0) { menu.InputGestureText = MenuBinds.GetInputGestureText(data.Command); } } menu.CommandParameter = new EpgCmdParam(typeof(MenuItem), code, data.ID); CtxmConvertToMenuItems(data.Items, menu.Items, code, shortcutTextforListType); item = menu; } item.Tag = data.Command; item.ToolTip = GetCtxmTooltip(data.Command); ToolTipService.SetShowOnDisabled(item, true); dest.Add(item); }); }
private void UpdateFileModificationStateIndicator(ITextEditor textEditor) { if (StatusBar == null) { return; } if (textEditor.FileModificationState == FileModificationState.Untouched) { FileModificationStateIndicatorIcon.Glyph = ""; FileModificationStateIndicator.Visibility = Visibility.Collapsed; } else if (textEditor.FileModificationState == FileModificationState.Modified) { FileModificationStateIndicatorIcon.Glyph = "\uE7BA"; // Warning Icon ToolTipService.SetToolTip(FileModificationStateIndicator, _resourceLoader.GetString("TextEditor_FileModifiedOutsideIndicator_ToolTip")); FileModificationStateIndicator.Visibility = Visibility.Visible; } else if (textEditor.FileModificationState == FileModificationState.RenamedMovedOrDeleted) { FileModificationStateIndicatorIcon.Glyph = "\uE9CE"; // Unknown Icon ToolTipService.SetToolTip(FileModificationStateIndicator, _resourceLoader.GetString("TextEditor_FileRenamedMovedOrDeletedIndicator_ToolTip")); FileModificationStateIndicator.Visibility = Visibility.Visible; } }
protected override void OnPointerExited(Windows.UI.Xaml.Input.PointerRoutedEventArgs e) { ToolTip toolTip = (ToolTip)ToolTipService.GetToolTip(this); toolTip.IsOpen = false; // parent/selected/searched check to reset appearance correctly if (this.Children.Count <= 0) { if (!this.Searched && !this.Selected) { treemapRect.Stroke = new SolidColorBrush(Colors.Gray); treemapRect.StrokeThickness = 0.5; } } else { if (!this.Selected) { treemapRect.Stroke = new SolidColorBrush(Colors.Red); treemapRect.StrokeThickness = 1; } } }
private void MyMap_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) { if (RadioButtonPoint.IsChecked == false) { return; } e.Handled = true; Point mousePosition = e.GetPosition(MyMap); Location pinLocation = MyMap.ViewportPointToLocation(mousePosition); Pins.Add(new DragPin(this.MyMap) { Location = new Location(pinLocation), ImageSource = GetImageSource("/Assets/green_pin.png") }); Pushpin pin = new Pushpin(); pin.Tag = "BK7475AO"; pin.Content = "T"; ToolTipService.SetToolTip(pin, pin.Tag); pin.MouseDoubleClick += (o, args) => { MessageBox.Show(pin.Content + " " + pin.Tag); }; pin.Location = pinLocation; MyMap.Children.Add(pin); }
//Location loc; public list() { InitializeComponent(); String xmlStr = (String)PhoneApplicationService.Current.State["stations"]; XDocument xmlDoc = XDocument.Parse(xmlStr); Carte = new Map(); Carte.ZoomLevel = 10.0; ContentMap.Children.Add(Carte); int inc = 0; List <XElement> listOfStands = xmlDoc.Descendants("stand").ToList(); foreach (XElement item in listOfStands) { if (int.Parse(item.Element("disp").Value) == 1) { Stand std = new Stand(); if (item.HasAttributes) { std.Nom = item.Attribute("name").Value; std.Id = int.Parse(item.Attribute("id").Value); } //Descendants if (item.HasElements) { //MessageBox.Show(item.Element("lng").Value); //Double test = Double.Parse(item.Element("lng").Value); if (item.Element("wcom") != null) { std.Add = item.Element("wcom").Value; } if (item.Element("lng") != null) { std.Lng = Convert.ToDouble(item.Element("lng").Value.Replace(".", ",")); } if (item.Element("lat") != null) { std.Lat = Convert.ToDouble(item.Element("lat").Value.Replace(".", ",")); } if (item.Element("ab") != null) { std.Ab = int.Parse(item.Element("ab").Value); } if (item.Element("ac") != null) { std.Ac = int.Parse(item.Element("ac").Value); } if (item.Element("ap") != null) { std.Ap = int.Parse(item.Element("ap").Value); } if (item.Element("tc") != null) { std.Tc = int.Parse(item.Element("tc").Value); } if (std.Add != null) { std.Add = std.Add.Replace("+", " "); std.Add = std.Add.Replace("%c2", "°"); } loc = new GeoCoordinate(); loc.Longitude = std.Lng; loc.Latitude = std.Lat; Pushpin pin = new Pushpin(); ToolTipService.SetToolTip(pin, "station n°" + std.Id + "\n" + std.Ap + " places disponible" + "\n" + std.Ab + " vélos disponible"); pin.TabIndex = inc; pin.GeoCoordinate = loc; pin.Name = inc.ToString(); Carte.Center = loc; pin.Tap += pin_event; ImageBrush imgBrush = new ImageBrush(); imgBrush.Stretch = System.Windows.Media.Stretch.UniformToFill; imgBrush.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"velo_bleu.png", UriKind.Relative)); Grid MyGrid = new Grid(); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.RowDefinitions.Add(new RowDefinition()); MyGrid.Background = new SolidColorBrush(Colors.Transparent); Rectangle MyRectangle = new Rectangle(); MyRectangle.Fill = imgBrush; MyRectangle.Height = 52; MyRectangle.Width = 85; MyRectangle.Name = inc.ToString(); MyRectangle.SetValue(Grid.RowProperty, 0); MyRectangle.SetValue(Grid.ColumnProperty, 0); MyRectangle.Tap += pin_event; MyGrid.Children.Add(MyRectangle); MapLayer layer = new MapLayer(); MapOverlay overlay = new MapOverlay(); overlay.Content = MyGrid; overlay.GeoCoordinate = pin.GeoCoordinate; layer.Add(overlay); Carte.Layers.Add(layer); inc++; } stands.Add(std); } } // standList.DataContext = stands; }
// This function checks the language filter settings to see which code to filter and also grays out tabs with no content public void CheckLang(object sender, EventArgs e) { if (xcsharpCheck.Content == null) // grays out xaml + c# tab { xamlcsharp.Background = Brushes.Gainsboro; xamlcsharp.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(xamlcsharp, true); _ttp.Content = "This sample is not available in XAML + C#."; xamlcsharp.ToolTip = (_ttp); xamlcsharp.IsEnabled = false; } else if (xcsharpCheck.Content != null) { xamlcsharp.IsEnabled = true; } if (xvbCheck.Content == null) // grays out xaml + vb tab { xamlvb.Background = Brushes.Gainsboro; xamlvb.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(xamlvb, true); _ttp.Content = "This sample is not available in XAML + Visual Basic.NET"; xamlvb.ToolTip = (_ttp); xamlvb.IsEnabled = false; } else if (xvbCheck.Content != null) { xamlvb.IsEnabled = true; } if (xaml.Content == null) // grays out xaml { xaml.IsEnabled = false; xaml.Background = Brushes.Gainsboro; xaml.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(xaml, true); _ttp.Content = "This sample is not available in XAML."; xaml.ToolTip = (_ttp); } else if (xaml.Content != null) { xaml.IsEnabled = true; } if (csharp.Content == null) // grays out c# { csharp.IsEnabled = false; csharp.Background = Brushes.Gainsboro; csharp.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(csharp, true); _ttp.Content = "This sample is not available in C#."; csharp.ToolTip = (_ttp); } else if (csharp.Content != null) { csharp.IsEnabled = true; } if (vb.Content == null) // grays out vb { vb.IsEnabled = false; vb.Background = Brushes.Gainsboro; vb.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(vb, true); _ttp.Content = "This sample is not available in Visual Basic.NET."; vb.ToolTip = (_ttp); } else if (vb.Content != null) { vb.IsEnabled = true; } if (managedcpp.Content == null) // grays out cpp { managedcpp.IsEnabled = false; managedcpp.Background = Brushes.Gainsboro; managedcpp.Foreground = Brushes.White; _ttp = new ToolTip(); ToolTipService.SetShowOnDisabled(managedcpp, true); _ttp.Content = "This sample is not available in Managed C++."; managedcpp.ToolTip = (_ttp); } else if (managedcpp.Content != null) { managedcpp.IsEnabled = true; } if (Welcome.Page1.MyDouble == 1) // XAML only { xaml.Visibility = Visibility.Visible; csharp.Visibility = Visibility.Collapsed; vb.Visibility = Visibility.Collapsed; managedcpp.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Collapsed; xamlvb.Visibility = Visibility.Collapsed; } else if (Welcome.Page1.MyDouble == 2) // CSharp { csharp.Visibility = Visibility.Visible; xaml.Visibility = Visibility.Collapsed; vb.Visibility = Visibility.Collapsed; managedcpp.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Collapsed; xamlvb.Visibility = Visibility.Collapsed; } else if (Welcome.Page1.MyDouble == 3) // Visual Basic { vb.Visibility = Visibility.Visible; xaml.Visibility = Visibility.Collapsed; csharp.Visibility = Visibility.Collapsed; managedcpp.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Collapsed; xamlvb.Visibility = Visibility.Collapsed; } else if (Welcome.Page1.MyDouble == 4) // Managed CPP { managedcpp.Visibility = Visibility.Visible; xaml.Visibility = Visibility.Collapsed; csharp.Visibility = Visibility.Collapsed; vb.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Collapsed; xamlvb.Visibility = Visibility.Collapsed; } else if (Welcome.Page1.MyDouble == 5) // No Filter { xaml.Visibility = Visibility.Visible; csharp.Visibility = Visibility.Visible; vb.Visibility = Visibility.Visible; managedcpp.Visibility = Visibility.Visible; xamlcsharp.Visibility = Visibility.Visible; xamlvb.Visibility = Visibility.Visible; } else if (Welcome.Page1.MyDouble == 6) // XAML + CSharp { xaml.Visibility = Visibility.Collapsed; csharp.Visibility = Visibility.Collapsed; vb.Visibility = Visibility.Collapsed; managedcpp.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Visible; xamlvb.Visibility = Visibility.Collapsed; } else if (Welcome.Page1.MyDouble == 7) // XAML + VB { xaml.Visibility = Visibility.Collapsed; csharp.Visibility = Visibility.Collapsed; vb.Visibility = Visibility.Collapsed; managedcpp.Visibility = Visibility.Collapsed; xamlcsharp.Visibility = Visibility.Collapsed; xamlvb.Visibility = Visibility.Visible; } }
private void StatusBarComponent_OnTapped(object sender, TappedRoutedEventArgs e) { var selectedEditor = NotepadsCore.GetSelectedTextEditor(); if (selectedEditor == null) return; if (sender == FileModificationStateIndicator) { if (selectedEditor.FileModificationState == FileModificationState.Modified) { FileModificationStateIndicator.ContextFlyout.ShowAt(FileModificationStateIndicator); } else if (selectedEditor.FileModificationState == FileModificationState.RenamedMovedOrDeleted) { NotificationCenter.Instance.PostNotification( _resourceLoader.GetString("TextEditor_FileRenamedMovedOrDeletedIndicator_ToolTip"), 2000); } } else if (sender == PathIndicator && !string.IsNullOrEmpty(PathIndicator.Text)) { NotepadsCore.FocusOnSelectedTextEditor(); if (selectedEditor.FileModificationState == FileModificationState.Untouched) { if (selectedEditor.EditingFile != null) { FileModificationStateIndicator.ContextFlyout.ShowAt(FileModificationStateIndicator); } } else if (selectedEditor.FileModificationState == FileModificationState.Modified) { FileModificationStateIndicator.ContextFlyout.ShowAt(FileModificationStateIndicator); } else if (selectedEditor.FileModificationState == FileModificationState.RenamedMovedOrDeleted) { NotificationCenter.Instance.PostNotification( _resourceLoader.GetString("TextEditor_FileRenamedMovedOrDeletedIndicator_ToolTip"), 2000); } } else if (sender == ModificationIndicator) { PreviewTextChangesFlyoutItem.IsEnabled = !selectedEditor.NoChangesSinceLastSaved(compareTextOnly: true) && selectedEditor.Mode != TextEditorMode.DiffPreview; ModificationIndicator?.ContextFlyout.ShowAt(ModificationIndicator); } else if (sender == LineColumnIndicator) { selectedEditor.ShowGoToControl(); } else if (sender == FontZoomIndicator) { FontZoomIndicator?.ContextFlyout.ShowAt(FontZoomIndicator); FontZoomIndicatorFlyout.Opened += (sflyout, eflyout) => ToolTipService.SetToolTip(RestoreDefaultZoom, null); } else if (sender == LineEndingIndicator) { LineEndingIndicator?.ContextFlyout.ShowAt(LineEndingIndicator); } else if (sender == EncodingIndicator) { var reopenWithEncoding = EncodingSelectionFlyout?.Items?.FirstOrDefault(i => i.Name.Equals("ReopenWithEncoding")); if (reopenWithEncoding != null) { reopenWithEncoding.IsEnabled = selectedEditor.EditingFile != null && selectedEditor.FileModificationState != FileModificationState.RenamedMovedOrDeleted; } EncodingIndicator?.ContextFlyout.ShowAt(EncodingIndicator); } else if (sender == ShadowWindowIndicator) { NotificationCenter.Instance.PostNotification( _resourceLoader.GetString("App_ShadowWindowIndicator_Description"), 4000); } }
private async void UpdateTabInformations() { //Set temp tab + tabs list ID try { current_tab = TabsAccessManager.GetTabViaID(new TabID { ID_Tab = current_tab.ID, ID_TabsList = current_list }); name_tab.Text = current_tab.TabName; //Tooltip name ToolTip ButtonTooltip = new ToolTip(); ButtonTooltip.Content = current_tab.TabName; ToolTipService.SetToolTip(IconAndTabNameGrid, ButtonTooltip); switch (current_tab.TabContentType) { case ContentType.File: string ModuleIDIcon = LanguagesHelper.GetModuleIDOfLangageType(current_tab.TabType); TabIcon.Source = await ModulesAccessManager.GetModuleIconViaIDAsync(ModuleIDIcon, ModulesAccessManager.GetModuleViaID(ModuleIDIcon).ModuleSystem); if (!string.IsNullOrEmpty(current_tab.TabOriginalPathContent)) { switch (current_tab.TabStorageMode) { case StorageListTypes.LocalStorage: path_tab.Text = current_tab.TabOriginalPathContent; break; case StorageListTypes.OneDrive: path_tab.Text = "OneDrive file"; break; } Size_Stackpanel.Visibility = Visibility.Visible; Modified_Stackpanel.Visibility = Visibility.Visible; Created_Stackpanel.Visibility = Visibility.Visible; Rename_Tab.IsEnabled = false; } else { Size_Stackpanel.Visibility = Visibility.Collapsed; Modified_Stackpanel.Visibility = Visibility.Collapsed; Created_Stackpanel.Visibility = Visibility.Collapsed; Rename_Tab.IsEnabled = true; } Notification.ShowBadge = current_tab.TabNewModifications; TabsListGrid.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Visible; FolderIcon.Visibility = Visibility.Collapsed; StackInfos.Visibility = Visibility.Visible; MaxHeightAnimShow.Value = 200; MaxHeightAnimRemove.Value = 200; break; case ContentType.Folder: Notification.ShowBadge = false; Rename_Tab.IsEnabled = false; More_Tab.Visibility = Visibility.Visible; TabsListGrid.Visibility = Visibility.Visible; StackInfos.Visibility = Visibility.Collapsed; TabIcon.Visibility = Visibility.Collapsed; FolderIcon.Visibility = Visibility.Visible; if (TempTabID != current_tab.ID && TabsList.ListID != current_list) { if (current_tab.FolderOpened) { ShowInfos.Begin(); infos_opened = true; } else { infos_opened = false; } TabsList.ListTabs.Items.Clear(); TempTabID = current_tab.ID; TabsList.ListID = current_list; foreach (int ID in current_tab.FolderContent) { try { if (TabsAccessManager.GetTabViaID(new TabID { ID_Tab = ID, ID_TabsList = current_list }) != null) { TabsList.ListTabs.Items.Add(new TabID { ID_Tab = ID, ID_TabsList = current_list }); if ((int)AppSettings.Values["Tabs_tab-selected-index"] == ID && (int)AppSettings.Values["Tabs_list-selected-index"] == current_list) { TabsList.ListTabs.SelectedIndex = TabsList.ListTabs.Items.Count - 1; } } } catch { } } } MaxHeightAnimShow.Value = 1500; MaxHeightAnimRemove.Value = 1500; break; } } catch { } }
public async Task <StackPanel> GetAddonWidgetViaIDAsync(object sceelibs, ThemeModuleBrush theme) { StorageFile WidgetFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri(ModuleFolderPath + "widget.json")); var widget_content = new StackPanel { Padding = new Thickness(5, 0, 10, 0), Orientation = Orientation.Horizontal, Name = "" + ModuleID }; using (var reader = new StreamReader(await WidgetFile.OpenStreamForReadAsync())) using (JsonReader JsonReader = new JsonTextReader(reader)) { try { List <AddonWidget> list = new JsonSerializer().Deserialize <List <AddonWidget> >(JsonReader); if (list != null) { foreach (AddonWidget widget in list) { switch (widget.Type) { case WidgetType.Button: var new_button = new Button(); new_button.Margin = new Thickness(5, 0, 5, 0); new_button.Name = widget.WidgetName + ModuleID; new_button.Style = (Style)Application.Current.Resources["Round_Button"]; new_button.Padding = new Thickness(0); new_button.Width = 25; new_button.Height = 25; new_button.FontFamily = new Windows.UI.Xaml.Media.FontFamily("Segoe MDL2 Assets"); new_button.Content = widget.IconButton; new_button.Foreground = theme.ToolbarColorFont; new_button.Background = new SolidColorBrush(Colors.Transparent); new_button.Click += ((e, f) => { Task.Run(() => new AddonExecutor(ModuleID, sceelibs).ExecutePersonalizedFunction(widget.FunctionName)); }); ToolTip ButtonTooltip = new ToolTip(); ButtonTooltip.Content = widget.TooltipText; ToolTipService.SetToolTip(new_button, ButtonTooltip); widget_content.Children.Add(new_button); break; case WidgetType.TextBox: var new_textbox = new TextBox(); new_textbox.Margin = new Thickness(5, 0, 5, 0); new_textbox.Name = widget.WidgetName + ModuleID; new_textbox.Style = (Style)Application.Current.Resources["RoundTextBox"]; //new_textbox.Padding = new Thickness(0); new_textbox.Width = 175; new_textbox.Height = 25; new_textbox.PlaceholderText = widget.PlaceHolderText; new_textbox.FontSize = 14; new_textbox.Background = theme.ToolbarColorFont; new_textbox.Foreground = theme.ToolbarColor; new_textbox.KeyDown += (async(e, f) => { if (f.KeyStatus.RepeatCount == 1) { if (f.Key == Windows.System.VirtualKey.Enter) { await Task.Run(() => new AddonExecutor(ModuleID, sceelibs).ExecutePersonalizedFunction(widget.FunctionName)); } } }); widget_content.Children.Add(new_textbox); break; } } } } catch { return(null); } } return(widget_content); }
public void CustomTooltipButton_Click(object sender, RoutedEventArgs e) { ToolTipService.SetToolTip(SecondTab, "Custom"); }
private void Configure(UIElement ui) { if (ui is FrameworkElement fe) { if (contextMenuChildren.Any()) { fe.ContextMenu = new System.Windows.Controls.ContextMenu(); foreach (var contextMenuItem in contextMenuChildren) { fe.ContextMenu.Items.Add(contextMenuItem.GetWPFElement()); } } if (!string.IsNullOrEmpty(ToolTipText)) { // Use a TextBlock so that the tooltip text can be dynamically updated var toolTipLabel = new TextBlock() { Text = ToolTipText }; var toolTip = new System.Windows.Controls.ToolTip() { Content = toolTipLabel }; fe.ToolTip = toolTip; if (UpdateToolTip != null) { toolTip.ToolTipOpening += (sender, args) => toolTipLabel.Text = UpdateToolTip(); } } var horizAlignment = HorizAlignment.ToLower(); if (horizAlignment == "left") { fe.HorizontalAlignment = HorizontalAlignment.Left; } else if (horizAlignment == "right") { fe.HorizontalAlignment = HorizontalAlignment.Right; } else if (horizAlignment == "middle") { fe.HorizontalAlignment = HorizontalAlignment.Center; } else { fe.HorizontalAlignment = HorizontalAlignment.Stretch; } var vertAlignment = VertAlignment.ToLower(); if (vertAlignment == "top") { fe.VerticalAlignment = VerticalAlignment.Top; } else if (vertAlignment == "bottom") { fe.VerticalAlignment = VerticalAlignment.Bottom; } else if (vertAlignment == "middle") { fe.VerticalAlignment = VerticalAlignment.Center; } else { fe.VerticalAlignment = VerticalAlignment.Stretch; } if (!double.IsNaN(Height)) { fe.Height = Height; } if (!double.IsNaN(Width)) { fe.Width = Width; } if (!double.IsNaN(MinHeight)) { fe.MinHeight = MinHeight; } if (!double.IsNaN(MinWidth)) { fe.MinWidth = MinWidth; } if (!double.IsNaN(MaxHeight)) { fe.MaxHeight = MaxHeight; } if (!double.IsNaN(MaxWidth)) { fe.MaxWidth = MaxWidth; } if (!double.IsNaN(ToolTipShowDuration)) { ToolTipService.SetShowDuration(fe, (int)Math.Round(ToolTipShowDuration * 1000)); } if (double.IsNaN(UniformMargin)) { var margin = new double[] { 0, 0, 0, 0 }; if (!double.IsNaN(LeftMargin)) { margin[0] = LeftMargin; } if (!double.IsNaN(TopMargin)) { margin[1] = TopMargin; } if (!double.IsNaN(RightMargin)) { margin[2] = RightMargin; } if (!double.IsNaN(BottomMargin)) { margin[3] = BottomMargin; } if (margin.Any(d => d > 0 || d < 0)) { fe.Margin = new Thickness(margin[0], margin[1], margin[2], margin[3]); } } else { fe.Margin = new Thickness(UniformMargin); } fe.Visibility = Visible ? Visibility.Visible : Visibility.Collapsed; } ui.AllowDrop = AllowDrop; foreach (var eventHandler in eventHandlers) { eventHandler.Sender = ui; } }