SHOW();
... профит...using MyWindowInDLL;
....
...
public MainWindow()
{
InitializeComponent();
var wind = new MyWindowInDLL.SuperWindow();
wind.Show();
}
public Form1()
{
InitializeComponent();
webbrowser.BringToFront();
webbrowser.Visible = true;
string url = "https://oauth.vk.com/authorize?client_id=" + VK_main.ID_APP + "&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=" + VK_main.SCOPE + "&response_type=token&v=" + VK_main.VERSION;
webbrowser.LoadingFrameComplete += Webbrowser_LoadingFrameComplete; //жду окончания загрузки
webbrowser.Source = new Uri(url);
}
private void Webbrowser_LoadingFrameComplete(object sender, FrameEventArgs e)
{
if (!e.IsMainFrame) return;
if(e.Url.ToString().Contains("https://oauth.vk.com/blank.html#access_token="))
{
int start = e.Url.Fragment.IndexOf("=");
int end = e.Url.Fragment.IndexOf("&");
VK_main.TOKEN = e.Url.Fragment.Substring(start+1, end-start-1); // записываю в "глобальную переменную токен
webbrowser.LoadingFrameComplete -= Webbrowser_LoadingFrameComplete;
webbrowser.Visible = false;
}
}
// image создаю программно, но можно и из x:Name использовать аналогично (без var image = new System.Windows.Controls.Image();)
var image = new System.Windows.Controls.Image();
BitmapImage bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(path, UriKind.Absolute);
bitmap.EndInit();
Image.Source = bitmap;
[SerializableAttribute]
[ComVisibleAttribute(true)]
public sealed class Bitmap : Image
<Image Width="90" Height="90"
Source="{Binding Path=ImageSource}"
Margin="0,0,0,5" />
public object ImageSource {
get {
BitmapImage image = new BitmapImage();
try {
image.BeginInit();
image.CacheOption = BitmapCacheOption.OnLoad;
image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
image.UriSource = new Uri( FullPath, UriKind.Absolute );
image.EndInit();
}
catch{
return DependencyProperty.UnsetValue;
}
return image;
}
}
<Image>
<Image.Source>
<BitmapImage UriSource="{Binding Path=ImagePath, Converter=...}" />
</Image.Source>
</Image>
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri(value as string);
image.EndInit();
return image;
img.Source = (ImageSource)new ImageSourceConverter().ConvertFromString("/www/image.png");
Assembly assembly = Assembly.LoadFrom("https://мой_сайт.ru/Library2.dll");
Type type = assembly.GetType("Library2.MainWindow");
dynamic obj = Activator.CreateInstance(type);
Window extern= (Window)obj;
exnter .Show();
// extern- wpf переделанный в dll
xmlns:m="clr-namespace:WpfDependency"
в шапке.... <Page>
<Page.Resources>
<Class1 x:Key="blablabla"></Class1 >
</Page.Resources>
<Grid DataContext="{Binding Source={StaticResource blablabla}}"....
// ваш код xaml после чего у mycontrols ставите атрибуты
</Grid>
</Page>
</Window>