|
|
Nope, we decided that it was not worth the effort to make it work.
Maybe we'll look at it in the future.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
|
see other answer above,
I still crash.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Parent page:-
<object id="CtxMgr" classid="CLSID:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx">
function DoCheck() {
alert(CtxMgr.InitCM());
}
function NewWindow() {
window.open('ChildWindow.html', "", "width=500,height=400");
}
var CtxMgr = document.getElementById('CtxMgr');
Child page:-
function DoCheck() {
try
{
var parentPageObj = window.opener.document.getElementById('CtxMgr');
alert(parentPageObj.InitCM());
}
catch(e) {
debugger;
}
}
Can you provide the solution for the above issue please?
|
|
|
|
|
The only browser which ever supported ActiveX components was Internet Explorer on Windows.
Microsoft have been telling you that Internet Explorer is not a web browser since at least 2019[^]. It will finally be declared "dead" in June this year.
You need to find a safer and better-supported alternative for whatever it is you're trying to do.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Expecting the fix for temporary for a legacy application. meantime it is being migrated.
|
|
|
|
|
There is no fix. ActiveX was only ever supported by IE and older versions of FireFox.
There is no way to instantiate an ActiveX component anymore. Your only recourse is to re-develop the functionality in that component in some other technology that is allowed in the security sandboxes in browsers of today.
modified 10-May-22 21:46pm.
|
|
|
|
|
To add to what Richard has (rightly) said, ActiveX was discontinued because of security concerns: it was just too open to abuse, and that is why only Microsoft's own excuse for a browser ever supported it - and even then that support was disabled by default very quickly after the initial release.
Find a different solution: ActiveX is not what you are looking for.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
EDI : Fixed by changing the pack with "mx-appx" as per documentation example.
Is there a way to check or validate if an URI is valid ?
The Assets folder is in my solution
System.Uri icon = new System.Uri("pack://application:,,,/Assets/icon.png");
This is part of this code which crashes at the instantiation of the ToastCollection.
public async void CreateToastCollection()
{
string displayName = "Is Potato";
string launchArg = "NavigateToPotato";
System.Uri icon = new System.Uri("pack://application:,,,/Assets/icon.png");
ToastCollection licensingManagerToastCollection = new ToastCollection(
"MyToastCollection",
displayName,
launchArg,
icon);
await ToastNotificationManager.GetDefault().GetToastCollectionManager().SaveToastCollectionAsync(licensingManagerToastCollection);
}
Thanks.
CI/CD = Continuous Impediment/Continuous Despair
modified 3-May-22 8:56am.
|
|
|
|
|
Have you tried Uri.TryCreate Method (System) | Microsoft Docs[^] - I haven't either, but ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
No it doesn't. The docs for Uri.TryCreate go all the way back to .NET Framework 1.1.
|
|
|
|
|
If it's actually crashing on the new ToastCollection line, then the URI is valid - otherwise, the new Uri line would crash.
The ToastCollection probably doesn't support pack: URIs. But that's just a guess, since you haven't provided any details of the error.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I think the error was at the URI statement, I checked the documentation (well, duh) and they use "ms-appx:" instead.
Still having errors on related code.
Will ask another question.
Thanks
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
According to the documentation[^], Toast images only support the following URI schemas:
http:// or https:// file:/// ms-appx:/// ms-appdata:///local/
WPF-style pack: URIs are not supported.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, I missed that one.
CI/CD = Continuous Impediment/Continuous Despair
|
|
|
|
|
Hi at all
Im new in C# WPF and SQL
since days im sitting on a problem I could not solve, and hope of help but fdid not find the Problem, because I'm not so good in sql:
I try to delete(Löschen) a Dataset from Listbox and the Database behind(MySQL), and i do not find my failure.
Please can you help me?
I tried to send a Screenshot, but dont find a way.... Thanks for your help
XAML-Code
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="Artikel" Height="450" Width="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="60" />
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Margin="10,50,0,0">
<StackPanel Orientation="Vertical" DataContext="{Binding SelectedItem, ElementName=cbArtikel}">
<Label x:Name="lblArtikel" FontWeight="Bold" Content="Artikel" Margin="45,5" />
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblName" DockPanel.Dock="Left" Width="100" Height="30" Content="Name:" />
<TextBox x:Name="tbName" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding name}"/>
</DockPanel>
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblBeschreibung" DockPanel.Dock="Left" Width="100" Height="30" Content="Beschreibung:" />
<TextBox x:Name="tbBeschreibung" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding beschreibung}" />
</DockPanel>
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblGroesse" DockPanel.Dock="Left" Width="100" Height="30" Content="Größe:" />
<TextBox x:Name="tbGroesse" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding groesse}" />
</DockPanel>
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblFarbe" DockPanel.Dock="Left" Width="100" Height="30" Content="Farbe:" />
<TextBox x:Name="tbFarbe" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding farbe}" />
</DockPanel>
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblMenge" DockPanel.Dock="Left" Width="100" Height="30" Content="Menge:" />
<TextBox x:Name="tbMenge" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding menge}" />
</DockPanel>
<DockPanel Width="300" Margin="0,5,0,5">
<Label x:Name="lblPreis" DockPanel.Dock="Left" Width="100" Height="30" Content="Preis:" />
<TextBox x:Name="tbPreis" DockPanel.Dock="Right" Width="200" Height="30" Text="{Binding preis}" />
</DockPanel>
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1" Grid.Row="0">
<Label Name="lblListArtikel" FontWeight="Bold" FontSize="16" Margin="50,50,0,5">Liste der Artikel</Label>
<ListBox x:Name="lbArtikel" Width="300" Height="220">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding name}" FontWeight="Bold" DockPanel.Dock="Left" Width="85" />
<TextBlock Text="{Binding beschreibung}" FontWeight="Thin" Width="90" />
<TextBlock Text="{Binding groesse}" FontWeight="Thin" Width="30" />
<TextBlock Text="{Binding farbe}" FontWeight="Thin" Width="30" />
<TextBlock Text="{Binding menge}" FontWeight="Thin" Width="30" />
<TextBlock Text="{Binding preis}" FontWeight="Thin" Width="30" />
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button x:Name="btnDelete" Content="Löschen" Width="100" Height="30" Background="Salmon" HorizontalAlignment="Center" Margin="0,15" Click="btnDelete_Click" />
</StackPanel>
<DockPanel Grid.Column="0" Grid.Row="1" LastChildFill="False" HorizontalAlignment="Left" Margin="50,0,0,0">
<Button x:Name="btnAdd" Width="100" Height="30" Click="btnAdd_Click" Content="Hinzufügen" />
</DockPanel>
<DockPanel Grid.Column="1" Grid.Row="1" LastChildFill="False" HorizontalAlignment="Right" Margin="0,0,50,0">
<Button x:Name="btnZurueck" Width="100" Height="30" Content="Zurück" Click="btnZurueck_Click" />
</DockPanel>
</Grid>
</Window>
Code-Behind for that WPF:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 System.Data.Odbc;
using System.Data;
namespace WpfApp1
{
public partial class MainWindow : Window
{
private OdbcConnection odbcConnection;
public MainWindow()
{
InitializeComponent();
odbcConnection = new OdbcConnection("DSN=dbdemo2;");
ArtikelShow();
}
private void ArtikelShow()
{
try
{
string sqlArtikel = "SELECT * FROM artikel";
OdbcCommand odbcCommand = new OdbcCommand(sqlArtikel, odbcConnection);
OdbcDataAdapter odbcDataAdapter = new OdbcDataAdapter(odbcCommand);
DataSet dataSet = new DataSet();
odbcDataAdapter.Fill(dataSet, "tableArtikel");
lbArtikel.ItemsSource = dataSet.Tables["tableArtikel"].DefaultView;
}
catch (Exception ex)
{
MessageBox.Show(ex.GetType() + Environment.NewLine + ex.Message, "Datenbankfehler");
}
}
private void btnDelete_Click(object sender, RoutedEventArgs e)
{
if (lbArtikel.SelectedValue == null)
{
MessageBox.Show("Keinen Eintrag zum Löschen ausgewählt");
}
else
{
try
{
MessageBoxResult messageBoxResult = MessageBox.Show("Wollen Sie wirklich den Artikel aus der Datenbank löschen?", "Bitte bestätigen Sie den Löschvorgang", MessageBoxButton.YesNo);
if (messageBoxResult == MessageBoxResult.Yes)
{
string sqlDelete = "DELETE FROM artikel WHERE id=?";
OdbcCommand odbcCommand = new OdbcCommand(sqlDelete, odbcConnection);
odbcConnection.Open();
odbcCommand.Parameters.AddWithValue("@id", Int32.Parse(lbArtikel.SelectedValue.ToString()));
odbcCommand.ExecuteNonQuery();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.GetType() + Environment.NewLine + ex.Message, "Datenbankfehler");
}
finally
{
odbcConnection.Close();
ArtikelShow();
}
}
}
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
if (tbName.Text.Equals(""))
{
MessageBox.Show("Bitte einen Artikelnamen eingeben");
}
else
{
try
{
string sqlInsert = "INSERT INTO artikel VALUES(NULL, ?, ?, ?, ?, ?, ?)";
OdbcCommand odbcCommand = new OdbcCommand(sqlInsert, odbcConnection);
odbcConnection.Open();
odbcCommand.Parameters.AddWithValue("@name", tbName.Text);
odbcCommand.Parameters.AddWithValue("@beschreibung", tbBeschreibung.Text);
odbcCommand.Parameters.AddWithValue("@groesse", tbGroesse.Text);
odbcCommand.Parameters.AddWithValue("@farbe", tbFarbe.Text);
odbcCommand.Parameters.AddWithValue("@menge", Convert.ToInt32(tbMenge.Text));
odbcCommand.Parameters.AddWithValue("@preis", Convert.ToDouble(tbPreis.Text));
odbcCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
MessageBox.Show(ex.GetType() + Environment.NewLine + ex.Message, "Datenbankfehler");
}
finally
{
odbcConnection.Close();
ArtikelShow();
}
}
}
private void btnZurueck_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}
|
|
|
|
|
You should put your "start up code" in the MainWindow Loaded event; there are too many side effects when you do too much in the "constructor" of the main window (or any window for that matter).
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
That's a good tip, thanks...
As for my background, I'm 56 and what other crosswords are, C# is to me.
I'm currently learning C# with books, but unfortunately they are very buggy and I just can't find the bug:
Database error!
System.FormatException
The input string is in the wrong format
|
|
|
|
|
Test the value of:
Int32.Parse(lbArtikel.SelectedValue.ToString())); I would guess it is probably null.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Hello thanks, im looking around to learn anything about the parsing?, an howto with examples, better than the microsoft site?
|
|
|
|
|
Yes, that's it, but now I must find a way to solve my problem
thank you for the tip
oh, thats a very good side to learn for all beginners like me
https://www.dotnetperls.com/parse
|
|
|
|
|
I have been looking at various ORM libraries. Many of these seem to rely on attributes placed on classes and fields in the model. I understand that attributes can be completely ignored by the build process but I'm not sure how such library-specific attributes fit with the whole idea of dependency injection and being able to swap in/out different data providers without requiring any other changes - and certainly not as 'deep down' as the model layer.
I am also puzzled by the workflow using ORM tools. Some require the POCO class to be defined and some ask the data tables to be designed first, but once the first iteration of all this is in a production environment, how on earth do you then instigate any changes without obliterating the live database?
I'd be extremely grateful if anyone could point me at some good reading around this whole subject.
Kind wishes - Patrick
Thank you to anyone taking the time to read my posts.
|
|
|
|
|
In Entity Framework, you can use "fluent configuration" to configure the store, so that you don't need to add library-specific attributes to the classes.
Creating and configuring a model - EF Core | Microsoft Docs[^]
You can even mix-and-match; I tend to add the non-library-specific attributes like StringLength to the classes, and put the EF-specific stuff in an IEntityTypeConfiguration<T> class.
Patrick Skelton wrote: once the first iteration of all this is in a production environment, how on earth do you then instigate any changes without obliterating the live database?
For Entity Framework, you can use migrations to update the database schema to match the model:
Migrations Overview - EF Core | Microsoft Docs[^]
Other ORMs will probably have something similar.
There are also third-party tools to manage your schema migrations (eg: Flyway) but they tend to cost money.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|