如何解压缩.gz文件并使用c#将文件保存在特定文件夹中?
这是我第一次遇到.gz文件.我已经在搜索如何解压缩但它对我不起作用.它没有解压缩特定文件夹中的.gz文件.我不想使用任何第三方应用程序.
任何人都可以给我一个如何解压缩它的示例代码.然后将文件保存在文件夹中.谢谢.
如何使用c#执行方法时,如何记录方法的持续时间,时间开始和结束时间?
例如,我点击一个按钮,它会做一些事情.一旦开始,我将获得开始时间,然后当执行完成时,我将得到时间结束以及完成所需的持续时间.
我怎样才能在 WPF 中为我的数据网格添加标题。我所能做的就是为我的列标题设置样式,但为我的整个表格设置标题对我来说是不可能的。谁能帮我吗。这是我想要的桌子的图像。

单击活动页面中的按钮时,如何从其他页面更改框架的来源。
我正在做的是在page1.xaml中,有一个带有显示page2.xaml的源的框架。单击页面2.xaml中的按钮后,我想将page1.xaml中的框架源更新为page3.xaml,然后该框架应显示page3.xaml而不是page2.xaml。
截至目前,我尝试使用
page1 pg1 = new page1();
pg1.frame.source = new Uri("page3.xaml",UriKind.Relative);
Run Code Online (Sandbox Code Playgroud)
但是它没有在page1.xaml的框架中显示page3.xaml。
我也试过
page1 pg1 = new page1();
pg1.frame.Navigate(new Uri("page3.xaml",UriKind.Relative));
Run Code Online (Sandbox Code Playgroud)
但效果不佳,page2.xaml仍然显示框架。
我有这个程序,其中我使用计时器重定向到另一页.它确实有效,但问题是当我点击取消按钮时会出现一个消息框,当用户不点击它并且计时器滴答时,消息框没有关闭.如何自动关闭消息框?
这就是它的样子..

这是我用来重定向页面的代码
DispatcherTimer sessionTimer = new DispatcherTimer();
public CashDepositAccount()
{
InitializeComponent();
con = new SqlConnection(ConfigurationManager.ConnectionStrings["kiosk_dbConnectionString1"].ConnectionString);
con.Open();
SqlCommand cmd1 = new SqlCommand("Select idle From [dbo].[Idle]", con);
idle = Convert.ToInt32(cmd1.ExecuteScalar());
InputManager.Current.PreProcessInput += Activity;
activityTimer = new DispatcherTimer
{
Interval = TimeSpan.FromMinutes(idle),
IsEnabled = true
};
activityTimer.Tick += Inactivity;
}
#region
void Inactivity(object sender, EventArgs e)
{
navigate = "Home";
Application.Current.Properties["navigate"] = navigate;
}
void Activity(object sender, PreProcessInputEventArgs e)
{
activityTimer.Stop();
activityTimer.Start();
}
Run Code Online (Sandbox Code Playgroud)
当Timer定时器重定向到主页面时,如何关闭消息框?
我正在开发一个需要解压缩文件并存储在特定文件夹中的项目.但问题是,我不知道该怎么做.这是我第一次参与这类项目.
我正在使用visual studio 2010.而且我不会使用任何第三方应用程序.
谁能建议我怎么能这样做?
我已经尝试过这段代码,但ZIPFILE无法识别.它上面有一条红线.
using System;
using System.IO;
using System.IO.Compression;
namespace UnzipFile
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btnZip_Click(object sender, RoutedEventArgs e)
{
string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";
ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);
}
}
Run Code Online (Sandbox Code Playgroud)
}

如何获取以特定字符串开头的文件夹中的所有文件?
例如,假设我有一个包含这三个文件的文件夹:
Family01
Family02
Family03
NotFamily04
Run Code Online (Sandbox Code Playgroud)
如何获得前三个文件,以字符串"Family"开头?
我用过
DirectoryInfo d = new DirectoryInfo(@"C:\Users\H2 Software PC\Documents\Family\");
FileInfo[] Files = d.GetFiles(????);
Run Code Online (Sandbox Code Playgroud)
但我不知道该把什么放进去FileInfo[].
我有这个代码
Word.Application WordApp = new Word.Application();
WordApp.Visible = true;
aDoc = WordApp.Documents.Open(fileName, ReadOnly: readOnly, Visible: isVisible);
aDoc.Activate();
Run Code Online (Sandbox Code Playgroud)
我想确定打开的文档中使用的字体颜色,有办法做到这一点吗?谢谢你!
是否可以将文件名分隔为文件类型/文件扩展名.
例如,我有一个名为sample.text的文件.我想使用c#获取单独的sample和.txt.
谁能帮我.谢谢.
c# ×10
wpf ×3
unzip ×2
auto-close ×1
datagrid ×1
duration ×1
execution ×1
file ×1
filenames ×1
frame ×1
gzip ×1
idle-timer ×1
messagebox ×1
time ×1
timer ×1