public void Update(IMetadataProvider track) { InterfaceUtils.SetField(AlbumBox, AlbumLabel, track.Album); InterfaceUtils.SetField(GenreBox, GenreLabel, string.Join(", ", track.Genres)); InterfaceUtils.SetField(YearBox, YearLabel, track.Year.ToString() == "0" ? null : track.Year.ToString()); InterfaceUtils.SetField(TrackBox, TrackNumberLabel, track.TrackNumber.ToString() == "0" ? null : track.TrackNumber.ToString()); if (track.TrackTotal > 0) { TrackBox.Text += "/" + track.TrackTotal; } InterfaceUtils.SetField(DiscBox, DiscNumberLabel, track.DiscNumber.ToString() == "0" ? null : track.DiscNumber.ToString()); if (track.DiscTotal > 0) { DiscBox.Text += "/" + track.DiscTotal; } if (track is FileMetadataProvider file) { BitrateBox.Text = file.ATLTrack.Bitrate + "kbps " + (file.ATLTrack.SampleRate / 1000) + "kHz"; } else { BitrateBox.Text = Properties.Resources.TRACKINFO_NOTAVAILABLE; } }
private void LoginWindow(IPlayerProvider playerProvider) { ImGui.SetNextWindowSize(_playerWindowSize); if (!ImGui.Begin($"Fantasy Player: {playerProvider.PlayerState.ServiceName} Login", ref _plugin.Configuration.PlayerSettings.PlayerWindowShown, ImGuiWindowFlags.NoResize)) { return; } if (!playerProvider.PlayerState.IsAuthenticating) { InterfaceUtils.TextCentered($"Please login to {playerProvider.PlayerState.ServiceName} to start."); if (InterfaceUtils.ButtonCentered("Login")) { playerProvider.StartAuth(); } } else { InterfaceUtils.TextCentered("Waiting for a response to login... Please check your browser."); if (InterfaceUtils.ButtonCentered("Re-open Url")) { playerProvider.RetryAuth(); } } ImGui.End(); }
internal static bool Start(out ServerManagedAPI managedAPI) { //Log nothing for now //Client may have already initialized the logger if (Logger.Instance == null) { Logger.Instance = new LoggerConfiguration() .WriteTo.File(Log.LogFileName) .CreateLogger(); } Log.Message("Starting managed wrapper"); managedAPI = new ServerManagedAPI(); try { InterfaceUtils.InitializeFields(ServerManagedAPI.DelegateInstanceNamePrefix, managedAPI, typeof(Program)); Log.Message("Managed wrapper started"); ManagedAPI = managedAPI; return(true); } catch (Exception e) { Log.Message(e.Message); managedAPI = null; return(false); } }
public void PopulateFields() { var track = window.CurrentTrack; if (track is null) { return; } if (track.EmbeddedPictures.Count == 0) { CoverArtBox.Source = null; CoverArtOverlay.Visibility = Visibility.Hidden; } else { CoverArtBox.Source = BitmapFrame.Create(new MemoryStream(track.EmbeddedPictures[0].PictureData), BitmapCreateOptions.None, BitmapCacheOption.OnLoad); CoverArtOverlay.Visibility = Visibility.Visible; } InterfaceUtils.SetField(AlbumBox, AlbumLabel, track.Album); InterfaceUtils.SetField(GenreBox, GenreLabel, track.Genre); InterfaceUtils.SetField(YearBox, YearLabel, track.Year.ToString() == "0" ? null : track.Year.ToString()); InterfaceUtils.SetField(TrackBox, TrackNumberLabel, track.TrackNumber.ToString() == "0" ? null : track.TrackNumber.ToString()); if (track.TrackTotal > 0) { TrackBox.Text += "/" + track.TrackTotal; } InterfaceUtils.SetField(DiscBox, DiscNumberLabel, track.DiscNumber.ToString() == "0" ? null : track.DiscNumber.ToString()); if (track.DiscTotal > 0) { DiscBox.Text += "/" + track.DiscTotal; } BitrateBox.Text = track.Bitrate + "kbps " + (track.SampleRate / 1000) + "kHz"; }
/// Initialize the Processors static ProcessorHelper() { foreach (Type ProcessorType in InterfaceUtils.GetSubclassesOf(typeof(IProcessor), true)) { // Only take our own if (!"Greenshot.Processors".Equals(ProcessorType.Namespace)) { continue; } try { if (!ProcessorType.IsAbstract) { IProcessor Processor; try { Processor = (IProcessor)Activator.CreateInstance(ProcessorType); } catch (Exception e) { LOG.ErrorFormat("Can't create instance of {0}", ProcessorType); LOG.Error(e); continue; } if (Processor.isActive) { LOG.DebugFormat("Found Processor {0} with designation {1}", ProcessorType.Name, Processor.Designation); RegisterProcessor(Processor); } else { LOG.DebugFormat("Ignoring Processor {0} with designation {1}", ProcessorType.Name, Processor.Designation); } } } catch (Exception ex) { LOG.ErrorFormat("Error loading processor {0}, message: ", ProcessorType.FullName, ex.Message); } } }
private void Remove_Image_Button_Click(object sender, RoutedEventArgs e) { Properties.Settings.Default.Image = ""; Properties.Settings.Default.Save(); Profile_Image.Source = InterfaceUtils.LoadDefaultImage(); }
/// Initialize the destinations static DestinationHelper() { foreach (Type destinationType in InterfaceUtils.GetSubclassesOf(typeof(IDestination), true)) { // Only take our own if (!"Greenshot.Destinations".Equals(destinationType.Namespace)) { continue; } if (!destinationType.IsAbstract) { IDestination destination; try { destination = (IDestination)Activator.CreateInstance(destinationType); } catch (Exception e) { LOG.ErrorFormat("Can't create instance of {0}", destinationType); LOG.Error(e); continue; } if (destination.IsActive) { LOG.DebugFormat("Found destination {0} with designation {1}", destinationType.Name, destination.Designation); RegisterDestination(destination); } else { LOG.DebugFormat("Ignoring destination {0} with designation {1}", destinationType.Name, destination.Designation); } } } }
private void UpdateMe() { _me = new User { Name = InterfaceUtils.LoadName(), Image = InterfaceUtils.LoadImage() }; }
// tooltip public string ToolTip() { StringBuilder tip = new StringBuilder(); //add relevant data? tip.Replace("{BUFFTIME}", InterfaceUtils.PrettySeconds(buffTime)); return(tip.ToString()); }
private void DefaultDir_Button_Click(object sender, RoutedEventArgs e) { string defaultDir = InterfaceUtils.RetrieveDirectoryLocation(); Properties.Settings.Default.DefaultDir = defaultDir; Properties.Settings.Default.Save(); DefaultDir_TextBox.Text = defaultDir; }
public void ShowAuxilliaryPane(AuxiliaryPane pane, int width = 235, bool openleft = false) { LoggingHandler.Log($"Showing pane --> {pane}"); if (SelectedAuxiliaryPane == pane) { HideAuxilliaryPane(); return; } if (SelectedAuxiliaryPane != AuxiliaryPane.None) { HideAuxilliaryPane(false); } switch (pane) { case AuxiliaryPane.Settings: RightFrame.Navigate(new SettingsPage(this)); break; case AuxiliaryPane.QueueManagement: RightFrame.Navigate(new QueueManagement(this)); break; case AuxiliaryPane.Search: RightFrame.Navigate(new SearchPage(this)); break; case AuxiliaryPane.Notifications: RightFrame.Navigate(new NotificationPage(this)); break; case AuxiliaryPane.TrackInfo: RightFrame.Navigate(new TrackInfoPage(this)); break; case AuxiliaryPane.Lyrics: RightFrame.Navigate(new LyricsPage(this)); break; default: return; } if (!openleft) { DockPanel.SetDock(RightFrame, Dock.Right); } else { DockPanel.SetDock(RightFrame, Dock.Left); } RightFrame.Visibility = Visibility.Visible; var sb = InterfaceUtils.GetDoubleAnimation(0, width, TimeSpan.FromMilliseconds(100), new PropertyPath("Width")); sb.Begin(RightFrame); SelectedAuxiliaryPane = pane; RightFrame.NavigationService.RemoveBackEntry(); }
private void InitializeForm() { ddlDesignation.DataSource = InterfaceUtils.GetEnumerationListItems <Designation>(true); ddlDesignation.DataTextField = "Text"; ddlDesignation.DataValueField = "Value"; ddlDesignation.DataBind(); //ddlStatus.DataSource = InterfaceUtils.GetEnumerationListItems<EmploymentStatus>(true); //ddlStatus.DataTextField = "Text"; //ddlStatus.DataValueField = "Value"; //ddlStatus.DataBind(); ddlSector.DataSource = InterfaceUtils.GetEnumerationListItems <FacilityType>(true); ddlSector.DataTextField = "Text"; ddlSector.DataValueField = "Value"; ddlSector.DataBind(); ddlEmployerGroup.DataSource = InterfaceUtils.GetEnumerationListItems <EmployerGroup>(true); ddlEmployerGroup.DataTextField = "Text"; ddlEmployerGroup.DataValueField = "Value"; ddlEmployerGroup.DataBind(); ddlDistrict.DataSource = InterfaceUtils.GetEnumerationListItems <District>(true); ddlDistrict.DataTextField = "Text"; ddlDistrict.DataValueField = "Value"; ddlDistrict.DataBind(); ddlRegion.DataSource = InterfaceUtils.GetEnumerationListItems <Region>(true); ddlRegion.DataTextField = "Text"; ddlRegion.DataValueField = "Value"; ddlRegion.DataBind(); ddlCommittee.DataSource = InterfaceUtils.GetEnumerationListItems <Committee>(true); ddlCommittee.DataTextField = "Text"; ddlCommittee.DataValueField = "Value"; ddlCommittee.DataBind(); var facilityListItems = _mBs.GetFacilities().OrderBy(f => f.facilityName); ddlFacility.DataSource = facilityListItems; ddlFacility.DataTextField = "facilityName"; ddlFacility.DataValueField = "id"; ddlFacility.DataBind(); ddlLocalTableOfficerPosition.DataSource = InterfaceUtils.GetLocalTableOfficerPositionListItems(); ddlLocalTableOfficerPosition.DataTextField = "Text"; ddlLocalTableOfficerPosition.DataValueField = "Value"; ddlLocalTableOfficerPosition.DataBind(); ddlPosition.DataSource = new List <ListItem> { new ListItem("Please Select", "") }; ddlPosition.DataTextField = "Text"; ddlPosition.DataValueField = "Value"; ddlPosition.DataBind(); }
private void ReceiveFile(TcpClient client) { // receive file name String jsonFileNode = TcpUtils.ReceiveDescription(client); FileNode fileNode = JsonConvert.DeserializeObject <FileNode>(jsonFileNode); String destinationDir = CheckDict(client, fileNode); if (destinationDir != null) { if (!Properties.Settings.Default.AutoAccept) { InterfaceUtils.ShowMainWindow(false); } ReceiveDirectoryFile(client, fileNode, destinationDir); } else { // retrieveing destination dir if (Properties.Settings.Default.AutoAccept) { TcpUtils.SendAcceptanceResponse(client); // default dir destinationDir = Properties.Settings.Default.DefaultDir; } else { // asking user for file acceptance UI.FilesAcceptance fileAcceptanceWindow = new UI.FilesAcceptance(fileNode); // blocking call until window is closed fileAcceptanceWindow.ShowDialog(); if (fileAcceptanceWindow.AreFilesAccepted) { // file accepted TcpUtils.SendAcceptanceResponse(client); destinationDir = fileAcceptanceWindow.DestinationDir; InterfaceUtils.ShowMainWindow(false); } else { // file not accepted or window closed TcpUtils.SendRefuseResponse(client); return; } } ReceiveFileContent(client, fileNode, destinationDir); } }
private void Page_Drop(object sender, DragEventArgs e) { window.Player.Queue.Clear(); InterfaceUtils.DoDragDrop((string[])e.Data.GetData(DataFormats.FileDrop), window.Player, window.Library); window.Player.PlayMusic(); var selectedItem = CategoryPanel.SelectedItem; LoadLibrary(); Thread.Sleep(10); CategoryPanel.SelectedItem = selectedItem; }
public UserSettings() { InitializeComponent(); Name_TextBox.Text = Properties.Settings.Default.Name; Private_CheckBox.IsChecked = Properties.Settings.Default.PrivateMode; AutoAccept_CheckBox.IsChecked = Properties.Settings.Default.AutoAccept; DefaultDir_CheckBox.IsChecked = Properties.Settings.Default.UseDefaultDir; DefaultDir_TextBox.Text = Properties.Settings.Default.DefaultDir; Profile_Image.Source = InterfaceUtils.LoadImage(); }
public void InitFields() { InterfaceUtils.SetField(ArtistBox, ArtistLabel, release.Artist); InterfaceUtils.SetField(AlbumBox, AlbumLabel, release.Name); InterfaceUtils.SetField(GenreBox, GenreLabel, release.Genre); InterfaceUtils.SetField(YearBox, YearLabel, release.Year.ToString() == "0" ? null : release.Year.ToString()); Link.Text = release.URL; Title = release.Name; IntegrationItemBox.SelectedIndex = --track.TrackNumber; PopulateLists(); }
internal static bool GetEngineOverrides(out EngineOverrides pFunctionTable) { Log.Message("Request Engine Overrides interface"); if (InterfaceUtils.SetupInterface(ServerManagedAPI.DelegateInstanceNamePrefix, out pFunctionTable, Wrapper.EngineOverrides)) { Wrapper.EngineOverridesInterface = pFunctionTable; return(true); } return(false); }
internal static bool GetEntityAPI(out DLLFunctions pFunctionTable) { Log.Message("Request DLLFunctions interface"); if (InterfaceUtils.SetupInterface(ServerManagedAPI.DelegateInstanceNamePrefix, out pFunctionTable, Wrapper.DLLFunctions)) { Wrapper.DLLFunctionsInterface = pFunctionTable; return(true); } return(false); }
private void DockPanel_MouseEnter(object sender, MouseEventArgs e) { var fadeIn = InterfaceUtils.GetDoubleAnimation(0f, 1f, TimeSpan.FromMilliseconds(500), new PropertyPath("Opacity")); fadeIn.Begin(TitlebarDockPanel); var brightener = InterfaceUtils.GetDoubleAnimation(0.8, 1f, TimeSpan.FromMilliseconds(500), new PropertyPath("Opacity")); brightener.Begin(BackgroundDockPanel); ArtistTextBlock.Visibility = TitleTextBlock.Visibility = Visibility.Collapsed; ProgressIndicator1.Visibility = ProgressSlider.Visibility = ProgressIndicator2.Visibility = Visibility.Visible; }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FRESHMusicPlayer", "Logs", $"{DateTime.Now:M.d.yyyy hh mm tt}.txt"); File.WriteAllText(path, $":(\n" + "Sorry, FMP had to close because of a serious problem. If this keeps happening, please report this to the devs at https://github.com/royce551/freshmusicplayer/issues ! Include the following information:\n\n" + $"{MainWindowViewModel.ProjectName}\n" + $"{System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}\n" + $"{Environment.OSVersion.VersionString}\n" + $"{(Exception)e.ExceptionObject}"); InterfaceUtils.OpenURL(path); }
internal static bool GetClientDllInterface(out ClientDLLFunctions pFunctionTable) { Log.Message("Request ClientDLLInterface interface"); if (InterfaceUtils.SetupInterface(ClientManagedAPI.DelegateInstanceNamePrefix, out pFunctionTable, Wrapper.ClientDLLFunctions)) { Wrapper.ClientDLLFunctionsInterface = pFunctionTable; return(true); } return(false); }
public async void HideAuxilliaryPane(bool animate = true) { var sb = InterfaceUtils.GetDoubleAnimation(RightFrame.Width, 0, TimeSpan.FromMilliseconds(100), new PropertyPath("Width")); if (animate) { await sb.BeginStoryboardAsync(RightFrame); } else { sb.Begin(RightFrame); } RightFrame.Visibility = Visibility.Collapsed; RightFrame.Source = null; SelectedAuxiliaryPane = AuxiliaryPane.None; }
internal QBoolean ClientConnect(Edict.Native *pEntity, string name, string address, byte *szRejectReason) { try { var result = GameClients.Connect(EntityDictionary.EdictFromNative(pEntity), name, address, out var rejectReason); InterfaceUtils.CopyStringToUnmanagedBuffer(rejectReason ?? string.Empty, szRejectReason, Interfaces.DLLFunctions.ClientConnectRejectReasonLength); return(result ? QBoolean.True : QBoolean.False); } catch (Exception e) { Log.Exception(e); throw; } }
public UdpRequester() { _continueRequesting = true; _udpClient = new UdpClient { Client = { ReceiveTimeout = Constants.AVAILABLE_USERS_UPDATE_INTERVAL * 1000 } }; //_broadcastIp = new IPEndPoint(IPAddress.Broadcast, Constants.DISCOVERY_UDP_PORT); _broadcastIp = new IPEndPoint(IPAddress.Parse("25.255.255.255"), Constants.DISCOVERY_UDP_PORT); // initing current user identity _me = new User { Name = InterfaceUtils.LoadName() }; }
public static List <ListItem> GetPositions(string committeeId) { List <ListItem> positions = new List <ListItem>(); if (String.IsNullOrEmpty(committeeId)) { positions.Insert(0, new ListItem("Please Select", string.Empty)); return(positions); } var cId = int.Parse(committeeId); Committee c = (Committee)cId; positions = (c == Committee.BoardOfDirectors) ? InterfaceUtils.GetBoardOfDirectorsPositionListItems() : InterfaceUtils.GetCommitteePositionListItems(c); return(positions.ToList()); }
private void ManageRefusedFile(string filePath) { // preparing file node for file transfer FileNode fileNode = new FileNode { Name = Path.GetFileName(filePath), ReceiverUserName = _destinationUserName }; // preparing file transfer for main window FileTransfer fileTransfer = new FileTransfer() { File = fileNode, Status = TransferStatus.Refused }; InterfaceUtils.ShowBalloonTip(fileTransfer); }
public async Task HideAuxilliaryPane(bool animate = true) { var sb = InterfaceUtils.GetThicknessAnimation( new Thickness(0), DockPanel.GetDock(RightFrame) == Dock.Left ? new Thickness(RightFrame.Width * -1, 0, 0, 0) : new Thickness(0, 0, RightFrame.Width * -1, 0), TimeSpan.FromMilliseconds(120), new PropertyPath(MarginProperty), new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 3 }); if (animate) { await sb.BeginStoryboardAsync(RightFrame); } RightFrame.Visibility = Visibility.Collapsed; RightFrame.Content = null; CurrentPane = Pane.None; }
private void WelcomeWindow() { ImGui.SetNextWindowSize(_playerWindowSize); if (!ImGui.Begin($"Fantasy Player: Welcome", ref _plugin.Configuration.PlayerSettings.PlayerWindowShown, ImGuiWindowFlags.NoResize)) return; InterfaceUtils.TextCentered("Please select your default provider."); foreach (var provider in _playerManager.PlayerProviders) { ImGui.SameLine(); if (ImGui.Button(provider.Key.Name.Replace("Provider", ""))) { _playerManager.CurrentPlayerProvider = provider.Value; _plugin.Configuration.PlayerSettings.DefaultProvider = provider.Key.FullName; _plugin.Configuration.Save(); } } }
private void ManageRefusedDirectory(string path) { // preparing file node for file transfer FileNode fileNode = new FileNode { // name of the directory Name = new DirectoryInfo(path).Name, ReceiverUserName = _destinationUserName }; // preparing file transfer for main window FileTransfer fileTransfer = new FileTransfer() { File = fileNode, Status = TransferStatus.Refused }; InterfaceUtils.ShowBalloonTip(fileTransfer); }
[SerializeField, TextArea(1, 30)] protected string toolTip; // not public, use ToolTip() public virtual string ToolTip(CharacterValueContainer parent, int level) { StringBuilder tip = new StringBuilder(toolTip); tip.Replace("{NAME}", name); tip.Replace("{LEVEL}", level.ToString()); //tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionLock, Stats.ActionLockScale.ToString(), parent).TotalValue)); tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(_hotBarBehaviour.actionLock)); //tip.Replace("{COOLDOWN}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionCooldown, Stats.CurrentCooldownReduction.ToString(), parent).TotalValue)); //tip.Replace("{ACTIONLOCK}", InterfaceUtils.PrettySeconds(ModifedValue(_hotBarBehaviour.actionLock, Stats.ActionLockScale.ToString(), parent).TotalValue)); tip.Replace("{COOLDOWN}", InterfaceUtils.PrettySeconds(_hotBarBehaviour.actionCooldown)); //tip.Replace("{CASTRANGE}", castRange.Get(level).ToString()); foreach (var cost in _hotBarBehaviour.ResourceCosts) { tip.Replace("{COST}", cost.Amount.ToString()); tip.Replace("{TYPE}", cost.type.ToString()); tip.Replace("{RESOURCE}", cost.resource.ToString()); } return(tip.ToString()); }