moje pytanie jest o Fluent, którą połączył się z moim program.exe
w jednym merged.exe z tym kodem:Problemy po scaleniu Fluent do main.exe
public class Program
{
[STAThreadAttribute]
public static void Main()
{
AppDomain.CurrentDomain.AssemblyResolve += OnResolveAssembly;
App.Main();
}
private static Assembly OnResolveAssembly(object sender, ResolveEventArgs args)
{
//We dont' care about System Assemblies and so on...
//if (!args.Name.ToLower().StartsWith("wpfcontrol")) return null;
Assembly thisAssembly = Assembly.GetExecutingAssembly();
//Get the Name of the AssemblyFile
var name = args.Name.Substring(0, args.Name.IndexOf(',')) + ".dll";
//Load form Embedded Resources - This Function is not called if the Assembly is in the Application Folder
var resources = thisAssembly.GetManifestResourceNames().Where(s => s.EndsWith(name));
if (resources.Count() > 0)
{
var resourceName = resources.First();
using (Stream stream = thisAssembly.GetManifestResourceStream(resourceName))
{
if (stream == null) return null;
var block = new byte[stream.Length];
stream.Read(block, 0, block.Length);
return Assembly.Load(block);
}
}
return null;
}
}
Moim problemem jest to, że kontrola Ribbon Zaawansowany mogę znaleźć styl dowolny, ale zdecydowałem się go z nimi kod w moim App.xaml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2010/Silver.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
drugi problem, który mam z tego rozwiązania jest to, że nie mogę połączyć się z bazą danych (SQL Express) z mojego programu, kiedy go uruchomić bez Visual Studio.
kiedy mam biegle w tym samym folderze, to po prostu działa, bo wtedy nie załadować go za pomocą wbudowanego odwołuje płynnie. I Fluent też może znaleźć styl.
Czy ktoś miał podobne doświadczenia z łączeniu DLL/biegle w main.exe i możesz mi pokazać, jak go rozwiązać?
Więc ... dodano zespół jako * * do zasobów aplikacji i ładowania go w czasie wykonywania? Dlaczego nie dodać go jako ** ** i ustawić "Copy Local" na true? –