我有一个问题@SequenceGenerator
:
@SequenceGenerator(name="pk_user_id", sequenceName="seq_user_id", allocationSize=1)
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="pk_user_id")
Run Code Online (Sandbox Code Playgroud)
应用程序启动时会显示警告:
WARN 7388 --- [main] org.hibernate.orm.deprecation:HHH90000014:发现使用不推荐的[org.hibernate.id.SequenceHiLoGenerator]基于序列的id生成器; 请改用org.hibernate.id.enhanced.SequenceStyleGenerator.有关详细信息,请参阅"休眠域模型映射指南"
我试图找出如何用新的代码替换已弃用的代码,但找不到任何解决方案.
我的网络浏览器:
XAML:
//...
xmlns:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
//...
<my:WindowsFormsHost Name="windowsFormsHost"/>
Run Code Online (Sandbox Code Playgroud)
C#背后的代码:
System.Windows.Forms.WebBrowser Browser = new System.Windows.Forms.WebBrowser();
windowsFormsHost.Child = Browser;
Run Code Online (Sandbox Code Playgroud)
我的问题是如何禁用所有音频输出.
我找到了这个:
C#:
private const int Feature = 21; //FEATURE_DISABLE_NAVIGATION_SOUNDS
private const int SetFeatureOnProcess = 0x00000002;
[DllImport("urlmon.dll")]
[PreserveSig]
[return: MarshalAs(UnmanagedType.Error)]
static extern int CoInternetSetFeatureEnabled(int featureEntry,
[MarshalAs(UnmanagedType.U4)] int dwFlags,
bool fEnable);
Run Code Online (Sandbox Code Playgroud)
它很好,但是这段代码只能禁用"咔嗒"声,所以在这种情况下它的那种无用.
我只想从我的应用程序100%静音,没有声音.
我已经读过,在这个webbrowser中,它需要通过Windows Sounds来完成,但我真的不知道我在代码中无法做到这一点.
我试着添加:
using System.Windows.Forms
Run Code Online (Sandbox Code Playgroud)
但它给我一个错误.
我知道我必须把它装到我的VS2012上,但我不知道怎么做.我到处搜索并尝试了我发现的一切,但这些都没有帮助我.
@edit在网上搜索1小时...写完这篇文章2分钟后我发现...项目>>添加参考...
解决了 :]
我正在使用C#和.NET 4.5,直到我需要为Windows XP制作应用程序,但.NET 4.5不支持
我的问题是如何使这个功能:
private async Task<int> wait(int czas)
{
return await Task.Run(() =>
{
Thread.Sleep(czas * 1000);
return 0;
});
}
Run Code Online (Sandbox Code Playgroud)
在.NET 4.0中
我试图在鼠标移动时旋转一个矩形。
我的代码:
private int i = 0;
private void Canvas_MouseMove(object sender, MouseEventArgs e)
{
RotateTransform rotation = new RotateTransform();
rotation.Angle = i;
rotation.CenterX = Canvas.GetLeft(rect) + rect.Width/2;
rotation.CenterY = Canvas.GetTop(rect) + rect.Height/2;
rect.LayoutTransform = rotation;
i++;
}
Run Code Online (Sandbox Code Playgroud)
我想通过矩形的中心旋转,但它以另一种方式旋转。这行:
rotation.CenterX = Canvas.GetLeft(rect) + rect.Width/2;
rotation.CenterY = Canvas.GetTop(rect) + rect.Height/2;
Run Code Online (Sandbox Code Playgroud)
不要改变任何东西。你知道为什么吗 ?
我在本论坛的另一篇文章中找到了解决方案,因此我的解决方案是:
double left = Canvas.GetLeft(rect);
double top = Canvas.GetTop(rect);
Canvas.SetLeft(rect, 0);
Canvas.SetTop(rect, 0);
RotateTransform rotation = new RotateTransform();
rotation.Angle = i;
rotation.CenterX = rect.Width/2;
rotation.CenterY = rect.Height/2;
rect.RenderTransform …
Run Code Online (Sandbox Code Playgroud) 我需要一些有效的方法来计算.txt文件中的列.我的文件格式:
123.222 333.333 454.45 453.333
14.222 3.333 434.45 423.333
33.2 223.333 434.45 153.333
Run Code Online (Sandbox Code Playgroud)
所以我尝试了这个:
StreamReader sr = new StreamReader(_path);
int ColumnsCount = Array.ConvertAll(sr.ReadLine().Split(' '), Double.Parse).Count();
Run Code Online (Sandbox Code Playgroud)
第一行足以以此文本格式获取列数.
所以我的问题是我想在给定地址上创建新对象.
MethodA()
{
TreeNode* nodeResult = NULL;
initObject(nodeResult);
//nodeResult is NULL anyway
}
void initObject(TreeNode* obj)
{
if(obj == NULL)
{
obj = new TreeNode();
}
}
Run Code Online (Sandbox Code Playgroud)
看起来新对象已创建但在initObject
方法括号末尾删除.
我尝试使用string.Replace()函数,但它无法正常工作.
string test = "AAA AA AA faseffs AEfAfse AFAEf AEFAEf";
test.Replace('A', 'C');
label.Text = test;
Run Code Online (Sandbox Code Playgroud)
label
显示test
字符串而不替换任何东西.
我正在使用awesomium WebControl.
我想用方法:LoadURL(String)
.但这是一种私人方法.是否有可能使用私有方法?
我的代码:
XAML:
<my:WindowsFormsHost Name="windowsFormsHost" Visibility="Hidden"/>
Run Code Online (Sandbox Code Playgroud)
代码背后[C#]
Awesomium.Windows.Forms.WebControl Browser2 = new Awesomium.Windows.Forms.WebControl();
private void start_Click(object sender, RoutedEventArgs e)
{
windowsFormsHost.Child = Browser2;
windowsFormsHost.Visibility = Visibility.Visible;
}
Run Code Online (Sandbox Code Playgroud)
我想用:
Browser2.LoadURL(String);
Run Code Online (Sandbox Code Playgroud)
方法在这里:http: //awesomium.com/docs/1_6_3/sharp_api/?tc = 163d5346-d13d-e0cf-49ba-72b2b04d7620