- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
The invocation of the constructor on type 'WpfApplication1.MainWindow' that matches the specified binding constraints threw an exception.' Line number '4' and line position '9'.
这就是我在将目标平台从“x86”更改为“任何 CPU”以运行我的可执行文件以在 x86 和 x64 位 Windows 操作系统中运行时遇到的错误。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WebKit;
using WebKit.Interop;
using Twitterizer;
using Facebook;
using TwitterConnect;
using facebook;
namespace WpfApplication3
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
WebKitBrowser wb = new WebKitBrowser();
TwitterConnect.TwitterStuff ts = new TwitterStuff();
Browser b = new Browser();
OpenWebkitBrowser.facebook fb_1 = new OpenWebkitBrowser.facebook();
private void Possibillion_Loaded(object sender, RoutedEventArgs e)
{
System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
host.Child = wb;
this.Grid2.Children.Add(host);
wb.DocumentCompleted += wb_DocumentCompleted;
}
void wb_DocumentCompleted(object sender, System.Windows.Forms.WebBrowserDocumentCompletedEventArgs e)
{
textBox1.Text = wb.Url.ToString();
TabItem1.Header = wb.DocumentTitle;
}
private void btnMinimize_Click(object sender, RoutedEventArgs e)
{
Possibillion.WindowState = WindowState.Minimized;
}
private void btnMaximize_Click(object sender, RoutedEventArgs e)
{
if (Possibillion.WindowState == WindowState.Maximized)
Possibillion.WindowState = WindowState.Normal;
else
Possibillion.WindowState = WindowState.Maximized;
}
private void btnClose_Click(object sender, RoutedEventArgs e)
{
Possibillion.Close();
}
private void btnGo_Click(object sender, RoutedEventArgs e)
{
wb.Navigate("http://" + textBox1.Text);
}
private void btnTwitter_Click(object sender, RoutedEventArgs e)
{
bool loggedIn = b.AlreadyLoggedIn();
if (!loggedIn)
{
//this.Hide();
b.Show();
}
//else
//{
// MainWindow mw = new MainWindow();
// mw.Show();
// this.Close();
//}
else if (textBox1.Text != "")
{
ts.tweetIt(wb.DocumentTitle);
//textBox1.Clear();
}
}
private void btnfacebook_Click_1(object sender, RoutedEventArgs e)
{
if (val.login == true)
{
//fb_1.Show();
if (string.IsNullOrEmpty(textBox1.Text))
{
Dispatcher.Invoke(new Action(() => { System.Windows.MessageBox.Show("Enter message."); }));
return;
}
var fb = new FacebookClient(val.token);
fb.PostCompleted += (o, args) =>
{
if (args.Error != null)
{
Dispatcher.Invoke(new Action(() => { System.Windows.MessageBox.Show(args.Error.Message); }));
return;
}
var result = (IDictionary<string, object>)args.GetResultData();
//_lastMessageId = (string)result["id"];
Dispatcher.Invoke(new Action(() =>
{
System.Windows.MessageBox.Show("Message Posted successfully");
textBox1.Text = string.Empty;
// pho.IsEnabled = true;
}));
};
var fbimg = new Facebook.FacebookMediaObject
{
FileName = Guid.NewGuid() + ".jpg",
ContentType = "image/png"
};
// FileStream fs = new FileStream("Rose.png", FileMode.Open, FileAccess.Read);
// BinaryReader br = new BinaryReader(fs);
// byte[] res = br.ReadBytes((int)fs.Length);
// br.Close();
// fs.Close();
//fbimg.SetValue(res);
// Uri uri = new Uri("/Background.png",UriKind.Relative);
var parameters = new Dictionary<string, object>();
//parameters.Add("picture", fbimg);
//parameters.Add("message", "hi");
// parameters["picture"] ="https://twimg0-a.akamaihd.net/profile_images/2263781693/SAchin_reasonably_small.png";
parameters["message"] = textBox1.Text;
// parameters["picture"] =fbimg;
//fb.PostAsync(@"/photos", parameters);
fb.PostAsync("me/feed", parameters);
}
else
{
Dispatcher.Invoke(new Action(() => { fb_1.ShowDialog(); }));
//System.Windows.MessageBox.Show("message not sent");
}
}
private void textBox1_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
wb.Navigate("http://" + textBox1.Text);
}
}
}
最佳答案
确保您的目标平台与您的build设置相匹配。
如果您已将配置管理器更改为任何 CPU,那么在正在构建的项目属性中您将需要执行相同的操作。
编辑 - 啊,您似乎在尝试在 x64 世界中运行为 x86 构建的工具包。
关于c# - 发生 XMLParseException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18122563/
The invocation of the constructor on type 'WpfApplication1.MainWindow' that matches the specified bi
当我将 WPF 应用程序部署到另一个用户的计算机时,出现以下异常: An unhandled exception of type 'System.Windows.Markup.XamlParseExc
我正在尝试使用 themoviedb API 访问电影信息,因为 imdb 似乎是一个失败的原因。 他们使用我用 * 替换的 key ,但据我所知,这应该是我进行简单搜索所需的全部内容 所以我的代码很
我有以下,很容易重现问题: 我正在创建一个 xaml 应用程序,它使用另一个文件中的资源。要走的路是创建一个 MergedDictionaries-tag 来合并本地和全局资源,如下所示:
我从博客中找到了以下代码,运行它时出现异常 XMLParseException:Start of root element expected. at 9th line. 任何人都可以解释为什么我会收到
我是一名优秀的程序员,十分优秀!