desktop-application 相关问题

在台式机或笔记本电脑中独立运行的应用程序。与“基于Web的应用程序”形成对比,后者需要运行Web浏览器。

我在使用 tkinter 制作应用程序时遇到问题

我正在尝试使用 Python Tkinter 制作图像查看器作为我正在参加的课程的一部分,但我的代码遇到了一些问题。 我的问题在于前锋的位置和......

回答 1 投票 0

如何正确设置 Windows 桌面应用程序以通过 Office 365 发送电子邮件?

我们有一个桌面应用程序,可以代表用户发送电子邮件(用于发票、收据等)。之前我们一直使用基本的 SMTP 身份验证,但现在我们添加了...

回答 1 投票 0

如何实现“在资源管理器/查找器中定位”功能

在很多程序中,都有一个选项可以使用本机操作系统文件资源管理器来查找特定文件。这个功能如何用java实现呢?

回答 3 投票 0

当我点击检查所有连接时如何一一改变这些按钮的背景颜色

单击此处显示应用程序截图 我想设置背景颜色以便连接状态但一一设置。 我这样做了,但签入后所有背景都发生了变化...

回答 1 投票 0

flutter 应用程序中的远程动态本地化

我正在构建flutter桌面应用程序,需要实现本地化/国际化。我将翻译保存在 sql 数据库中并通过 webapi 获取。当字符串被编辑/更改时...

回答 1 投票 0

如何修改 mutableStateMapOf 的值?

我有一个 mutableStateMapOf 类型的字段: var dataPool by mutableStateMapOf("archive" 为 true, "pending" 为 true) 我想通过复选框修改它的值,所以我尝试了......

回答 1 投票 0

如何防止wpf应用程序的多个实例?

如何防止WPF应用程序的多个实例?有什么正确的方法吗?另外,需要帮助来防止同一登录多个实例在不同的机器上。

回答 1 投票 0

如何将 Flutter 桌面应用程序发布到 Windows 应用商店

如何使用 Flutter 2.02 Beta 版将 Flutter 桌面应用上传到 Windows 应用商店?我的桌面应用程序在 2.02 版本上运行良好。 我创建了一个 Windows 版本: 笛子...

回答 2 投票 0

如何将flutter桌面应用发布到Windows应用商店

如何使用flutter 2.02 beta版本在Windows应用商店上传flutter桌面应用程序。我的桌面应用程序在 2.02 版本上运行良好。 创建的窗口构建与 颤动构建

回答 3 投票 0

两个 Flet 应用程序与主 Flet 应用程序 Python 集成

我有两个独立的 Flet 应用程序。我有另一个带有两个按钮的主舰队应用程序,不可能以第一个按钮应打开第一个 FletApp,第二个按钮应打开的方式进行集成...

回答 1 投票 0

ReportDocument.Load() 在 c#.net 中加载 .RPT 文件花费了太多时间

报告文档cryRpt = new ReportDocument(); SqlCommand MyCommand = new SqlCommand(); SqlConnectionStringBuilder 构建器 = new SqlConnectionStringBuilder(cn.ConnectionString); 连接信息

回答 1 投票 0

一列三行的布局,其中中间的应该占据所有剩余空间

我想创建一个 Jetpack Compose 桌面布局,其中包含: 顶行按钮 中间行内容占据所有剩余空间 状态标签的底行 我尝试过这个,但我不能...

回答 1 投票 0

如何在Electron应用程序中打包外部.exe文件

我正在开发一个电子应用程序,其中使用外部 .exe 文件。在开发模式下应用程序运行良好。 但是当我打包应用程序时,它无法找到那些 .exe 文件。 ...

回答 1 投票 0

使用 Leap 运动和 Python 控制 Powerpoint

我刚刚开始使用Python。我最近有一个项目,我必须制作一个Powerpoint幻灯片。这必须使用Leap Motion sdk和Python来完成。所以我的Powerpoint将基于手势。 我该怎么办

回答 6 投票 0

将 Web 应用程序加载为 Windows 桌面应用程序的简单/最佳方式?

你好,基本上我有一个使用 html5/php 等构建的网络应用程序。它是一个音乐播放器,类似于 Spotify 和 pandora。我想将 Web 应用程序作为桌面应用程序分发,以便人们可以运行它

回答 4 投票 0

检索数据时单选按钮的绑定值

我正在尝试检索我的 MAUI c# 桌面应用程序中“isConforme”单选按钮的值。 在我看来,该值没有正确绑定。 这是我的代码 看法: 我正在尝试检索我的 MAUI c# 桌面应用程序中“isConforme”单选按钮的值。 在我看来,该值没有正确绑定。 这是我的代码 查看: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:local="clr-namespace:FntrAudit.ViewModel" x:DataType="local:NewAuditViewModel" xmlns:model="clr-namespace:FntrAudit.Models" x:Class="FntrAudit.Views.NewAudit" Title="Nouvel audit" > <HorizontalStackLayout> <CollectionView ItemsSource="{Binding Audit.Themes}" EmptyView="pas de data"> <CollectionView.ItemTemplate > <DataTemplate x:DataType="model:Theme"> <VerticalStackLayout Spacing="300000" > <ImageButton x:Name="ThemeButton" Source="{Binding LogoTheme }" HeightRequest="50" Clicked="ThemeButton_Clicked" ToolTipProperties.Text="{Binding Intitule}" CornerRadius="100" ></ImageButton> </VerticalStackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> <CollectionView x:Name="sousthemes" ItemsSource="{Binding Audit.SousThemes}" IsVisible="false"> <CollectionView.ItemTemplate> <DataTemplate x:DataType="model:SousTheme"> <VerticalStackLayout> <Button Text="{Binding Intitule}" WidthRequest="350" Clicked="SousTheme_Clicked" BackgroundColor="#AE1439" ></Button> </VerticalStackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> <CollectionView x:Name="question" ItemsSource="{Binding Audit.Questions}" IsVisible="false" HorizontalScrollBarVisibility="Always" VerticalScrollBarVisibility="Always"> <CollectionView.ItemTemplate> <DataTemplate x:DataType="model:Question"> <VerticalStackLayout WidthRequest="900"> <mct:Expander x:Name="questionz" HeightRequest="220" IsExpanded="False"> <mct:Expander.Header> <Grid BackgroundColor="LightGray" HeightRequest="100"> <Label Text="{Binding Intitule}" FontSize="16" Grid.Column="0"></Label> <Image Source="exclamation_mark.png" HeightRequest="20" TranslationX="380" ToolTipProperties.Text="{Binding RappelJuridique}"/> </Grid> </mct:Expander.Header> <mct:Expander.Content> <StackLayout > <HorizontalStackLayout > <RadioButton x:Name="conforme" Content="Conforme" IsChecked="{Binding IsConforme, Mode=TwoWay}" Value="true" CheckedChanged="RadioButton_CheckedChanged" > </RadioButton> <RadioButton x:Name="nonConforme" Content="Non conforme" IsChecked="{Binding IsConforme, Mode=TwoWay}" Value="false" CheckedChanged="RadioButton_CheckedChanged"> </RadioButton> <RadioButton x:Name="nonFait" Content="non Fait" IsChecked="{Binding IsConforme, Mode=TwoWay}" Value="null" CheckedChanged="RadioButton_CheckedChanged"> </RadioButton> </HorizontalStackLayout> <Entry Placeholder="Commentaire" Text="{Binding Commentaire}" HeightRequest="100" ></Entry> </StackLayout> </mct:Expander.Content> </mct:Expander> </VerticalStackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> <VerticalStackLayout> <Button x:Name="record_audit" Text="enregistrer Audit" BackgroundColor="#AE1439" Command="{Binding RecordAudit}"> </Button> <Button x:Name="generate_PDF" Text="Générer PDF" BackgroundColor="#AE1439" Command="{Binding GeneratePdf}"> </Button> </VerticalStackLayout> </HorizontalStackLayout> </ContentPage> 隐藏代码 using CommunityToolkit.Maui.Views; using FntrAudit.DALApi; using FntrAudit.Models; using FntrAudit.Services; using FntrAudit.ViewModel; namespace FntrAudit.Views; public partial class NewAudit : ContentPage { private ISocieteUserService _societeUserService; private IClientService _clientService; private UserContext _userContext; public RestService<Theme> _themeService = new RestService<Theme>(); public RestService<Audit> _themeServices = new RestService<Audit>(); public List<Theme>Themes { get; set; } public List<SousThemeGroup> SousThemes { get; set; } = new List<SousThemeGroup>(); public NewAudit(UserContext ContextCurrent) { InitializeComponent(); _userContext = ContextCurrent; try { BindingContext = new NewAuditViewModel(ContextCurrent); } catch (Exception ex) { var tu = ex.Message; } } private void ThemeButton_Clicked(object sender, EventArgs e) { question.IsVisible = false; var imgbtn = (ImageButton)sender; Theme btnThemeClicked = (Theme)imgbtn.BindingContext; if (btnThemeClicked.SousThemes != null) { sousthemes.IsVisible = true; sousthemes.ItemsSource = btnThemeClicked.SousThemes; } else { sousthemes.IsVisible = false; question.IsVisible = true; question.ItemsSource = btnThemeClicked.Questions; } } private void SousTheme_Clicked(object sender, EventArgs e) { var btn = (Button)sender; SousTheme btnSousThemeClicked = (SousTheme)btn.BindingContext; // btn.BackgroundColor = Colors.LightGray; question.IsVisible = true; question.ItemsSource = btnSousThemeClicked.Questions; } private void RadioButton_CheckedChanged(object sender, CheckedChangedEventArgs e) { //if (sender is RadioButton radioButton && radioButton.BindingContext is Question question) //{ // if (radioButton.IsChecked) // { // // Accédez à la valeur du RadioButton // string value = radioButton.Value.ToString(); // // Mettez à jour la propriété IsConforme de l'objet Question // question.IsConforme = bool.Parse(value); // } //} if (sender is RadioButton radioButton && radioButton.BindingContext is Question question) { if (radioButton.Value.ToString() == "true") { question.IsConforme = true; // if (e.Value) // { // question.IsConforme = true; // } } else if (radioButton.Value.ToString() == "false") { question.IsConforme = false; //if (e.Value) //{ // question.IsConforme = false; // } } else if (radioButton.Value.ToString() == "null") { question.IsConforme = null; //if (e.Value) //{ // question.IsConforme = null; // } } } } private void record_audit_Clicked(object sender, EventArgs e) { var audit = e; } } 视图模型: using FntrAudit.DALApi; using FntrAudit.Models; using FntrAudit.Services; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using CommunityToolkit.Mvvm.ComponentModel; using FntrAudit.DocumentGenerators; using System.Text.Json; using Microsoft.VisualBasic; using FntrAudit.Utils; using FntrAudit.Data; using Microsoft.EntityFrameworkCore; namespace FntrAudit.ViewModel { public partial class NewAuditViewModel : INotifyPropertyChanged { private UserContext _currentContext; private bool isSousThemeVisible; private RestService<Theme> _themeService = new RestService<Theme>(); private RestService<Audit> _auditService = new RestService<Audit>(); private RestService<Client> _clientService = new RestService<Client>(); private Audit audit; SqliteDbContext db = new SqliteDbContext(); private bool? isConforme; public bool? IsConforme { get { return isConforme; } set { if (isConforme != value) { isConforme = value; OnPropertyChanged(nameof(IsConforme)); } } } public bool IsSousThemesVisible { get => isSousThemeVisible; set { SetProperty(ref isSousThemeVisible, value); } } public Audit Audit { get => audit; set { audit = value; OnPropertyChanged(nameof(Audit)); } } public List<Audit> AuditList { get; } =new List<Audit>(); public List<Theme> Themes { get; } = new List<Theme>(); public ICommand RadioButtonCommand { get; } bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null) { if (Object.Equals(storage, value)) return false; storage = value; OnPropertyChanged(propertyName); return true; } public NewAuditViewModel(UserContext ContextCurrent) { _currentContext = ContextCurrent; if (_currentContext.IsReprise) { Audit = JsonSerializer.Deserialize<Audit>(_currentContext.CurrentClient.AuditEncours); } else { if (Constantes.IsBeta) { Audit = db.Audit .Where(a => a.Id == 1) .Include(a => a.Themes) .Include(a => a.SousThemes) .Include(a => a.Questions) .FirstOrDefault(); } else { Audit = _auditService.Get(@"https://localhost:7114/api/Audit/" + 1, new Audit()); } } RecordAudit = new Command(AuditRecord); GeneratePdf = new Command(GeneratePDF); GetSoustheme = new Command(GetSousthemes); } private void HandleRadioButton(string value) { // Logique de gestion de RadioButton ici Console.WriteLine($"RadioButton sélectionné : {value}"); } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public ICommand RecordAudit { get; set; } public ICommand GeneratePdf { get; set; } public ICommand GetSoustheme { get; set; } protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public void AuditRecord() { Client client = new Client(); if (Constantes.IsBeta) { client = db.Client.Where(c => c.Id == _currentContext.ClientId).FirstOrDefault(); } else { client = _clientService.Get(@"https://localhost:7114/api/Client/" + _currentContext.ClientId, new Client()); } var a = Audit; client.AuditEncours = JsonSerializer.Serialize(Audit); if (Constantes.IsBeta) { db.Client.Update(client); db.SaveChanges(); } else { _clientService.Create(client, @"https://localhost:7114/api/Client/updateClient", false); } _currentContext.CurrentClient.AuditEncours = client.AuditEncours; } public void GeneratePDF() { DocumentGenerator documentGenerator = new DocumentGenerator(); DocumentContent documentContent = new DocumentContent() { Audit = Audit, Client = _currentContext.CurrentClient, User = _currentContext.CurrentUser }; documentGenerator.GenerateDoc(documentContent); } public void GetSousthemes() { IsSousThemesVisible = true; } } } 审核模型: using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FntrAudit.Models { public class Audit : BaseEntity, INotifyPropertyChanged { private string code; private List<Theme> themes; private List<SousTheme> sousThemes; private List<Question> questions; private List<QuestionLiee> questionsLiees; public string Code { get { return code; } set { code = value; OnPropertyChanged(nameof(Code)); } } public List<QuestionLiee> QuestionsLiees { get { return questionsLiees; } set { questionsLiees = value; OnPropertyChanged(nameof(QuestionsLiees)); } } public List<Question> Questions { get { return questions; } set { questions = value; OnPropertyChanged(nameof(Questions)); } } public List<SousTheme> SousThemes { get { return sousThemes; } set { sousThemes = value; OnPropertyChanged(nameof(SousThemes)); } } public List<Theme> Themes { get { return themes; } set { themes = value; OnPropertyChanged(nameof(Themes)); } } public event PropertyChangedEventHandler PropertyChanged; void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } } 问题模型: using System.ComponentModel; namespace FntrAudit.Models { public class Question: BaseEntity { public int ThemeId { get; set; } public int AuditId { get; set; } public int? SousThemeId { get; set; } public string RappelJuridique { get; set; } public string Code { get; set; } public string Preconisation { get; set; } public bool? IsConforme { get; set; } public bool HasLinkedQuote { get; set; } public string? Commentaire { get; set; } //private int themeId; //private int auditId; //private int? sousThemeId; //private string rappelJuridique; //private string code; //private string preconisation; //private bool? isConforme; //private bool hasLinkedQuote; //private string commentaire; //public int ThemeId //{ // get { return themeId; } // set { themeId = value; OnPropertyChanged(nameof(ThemeId)); } //} //public int AuditId //{ // get { return auditId; } // set { auditId = value; OnPropertyChanged(nameof(AuditId)); } //} //public int? SousThemeId //{ // get { return sousThemeId; } // set { sousThemeId = value; OnPropertyChanged(nameof(SousThemeId)); } //} //public string RappelJuridique //{ // get { return rappelJuridique; } // set { rappelJuridique = value; OnPropertyChanged(nameof(RappelJuridique)); } //} //public string Code //{ // get { return code; } // set { code = value; OnPropertyChanged(nameof(Code)); } //} //public string Preconisation //{ // get { return preconisation; } // set { preconisation = value; OnPropertyChanged(nameof(Preconisation)); } //} //public bool? IsConforme //{ // get { return isConforme; } // set { isConforme = value; OnPropertyChanged(nameof(IsConforme)); } //} //public bool HasLinkedQuote //{ // get { return hasLinkedQuote; } // set { hasLinkedQuote = value; OnPropertyChanged(nameof(HasLinkedQuote)); } //} //public string? Commentaire //{ // get { return commentaire; } // set { commentaire = value; OnPropertyChanged(nameof(Commentaire)); } //} //public event PropertyChangedEventHandler PropertyChanged; //void OnPropertyChanged(string name) => // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } } 我尝试了很多东西,但当我加载包含属性 isconforme 未绑定的对象审计时,没有任何效果。当我保存审计时,我有 isconforme 的良好价值,并且在我的数据库中没有问题。当我在代码中查看该属性时,该属性很好。 提前致谢 根据@Jason 评论,您不能将所有三个单选按钮绑定到同一个布尔值。另外,因为您的问题视图模型有 TwoWay 绑定,所以您不需要实现 CheckedChanged。您将可以访问问题视图模型中的更改。 在下面,我更改了您的问题视图模型,使其具有 3 个布尔值,并且每个布尔值都会升高 PropertyChanged?。然后,在 Audit 视图模型中,我连接到 PropertyChanged? 事件并做出相应的反应。我提供了一个模拟 MainPage.xaml 来演示 Binding,并且所有内容都已连接,无需实现 CheckedChanged,除了视图模型中的内容之外,我的代码隐藏中也不需要任何特殊代码。 // Question.cs ... public class Question : INotifyPropertyChanged { private bool _isConforme; public bool IsConforme { get { return _isConforme; } set { _isConforme = value; OnPropertyChanged(nameof(IsConforme)); } } private bool _nonConforme; public bool NonConforme { get { return _nonConforme; } set { _nonConforme = value; OnPropertyChanged(nameof(NonConforme)); } } private bool _nonFait; public bool NonFait { get { return _nonFait; } set { _nonFait = value; OnPropertyChanged(nameof(NonFait)); } } public event PropertyChangedEventHandler PropertyChanged; void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } // Audit.cs ... public class Audit : INotifyPropertyChanged { public IList<Question> Questions { get; } = new List<Question>(); public Audit() { Questions.Add(new Question()); Questions.Add(new Question()); for (int i = 0; i < Questions.Count; i++) { var currentQuestion = Questions[i]; currentQuestion.PropertyChanged += (s, e) => Question_PropertyChanged(i, currentQuestion); } } private void Question_PropertyChanged(int index, Question currentQuestion) { Debug.WriteLine($"Question_PropertyChanged: {index} {currentQuestion.IsConforme} {currentQuestion.NonConforme} {currentQuestion.NonFait}"); } public event PropertyChangedEventHandler PropertyChanged; void OnPropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); } // MainPage.xaml.cs public partial class MainPage : ContentPage { public Audit Audit { get; } = new Audit(); public MainPage() { BindingContext = this; InitializeComponent(); } } <!-- MainPage.xaml ... --> <CollectionView ItemsSource="{Binding Audit.Questions}"> <CollectionView.ItemTemplate> <DataTemplate x:DataType="{x:Type local:Question}"> <HorizontalStackLayout> <RadioButton Content="Conforme" IsChecked="{Binding IsConforme, Mode=TwoWay}"/> <RadioButton Content="Non conforme" IsChecked="{Binding NonConforme, Mode=TwoWay}"/> <RadioButton Content="non Fait" IsChecked="{Binding NonFait, Mode=TwoWay}"/> </HorizontalStackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView>

回答 1 投票 0

如何在C#中创建预先设计的(模板)表单

我有多表单C#应用程序,大多数表单都具有相同的设计(自定义边框、自定义控制框...)并且它们进行了编程,所以我的问题是,我如何创建一个模板表单插入.. .

回答 1 投票 0

在 Windows 11 上运行的 .Net Maui 应用程序中关闭辅助窗口时如何解决未处理的异常

在 C# .NET Maui 桌面应用程序中,当使用打开多个窗口时 Application.Current.OpenWindow(),使用

回答 1 投票 0

在 Windows 11 上运行的 .Net Maui 应用程序中关闭辅助窗口时如何解决未处理的异常

在 C# .net Maui 桌面应用程序中,当使用打开多个窗口时 Application.Current.OpenWindow() 使用

回答 1 投票 0

Unity 中的桌面和手机游戏

我的问题是:可以在Unity中制作一个桌面Windows GUI,而不是可以控制手机游戏中的对象,但是是实时的。我是游戏开发新手,但如果可能的话,你能...

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.