עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

קבלת מידע מהמערכת ב-Form1_Load עם WPF

Featured Replies

פורסם

יש לי תוכנה שכתובה ה-winform ולה מתודה מהסוג:


private void Form1_Load(object sender, EventArgs e)
{


}

המתודה הזו בעצם סורקת בעזרת class את כל ההתקני רשת של המחשב ואח"כ מכניסה אותם ל-combobox.

לאחרונה העברתי את התוכנה מ-winform ל-wpf ושם אין לי מתודה מהסוג הזה.

כשאני מסתכל בדיבגר בתוכנת ה- winform שלי אני רואה שאחרי הזו:


public Form1()
{
InitializeComponent();
}

התוכנה הולכת למתודה הבאה ובה מתבצעת הקריאה למה שאני צריך:


static void Main()
{
Adapters addr = new Adapters();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}

אין לי מושג איך ואם בכלל אפשרי לעשות מה שאני רוצה, אשמח לעזרה.

פורסם
  • מחבר

בתגובה השנייה בלינק יש הצעה לערוך את ה-XAML ככה:


<Window x:Class="WpfTest.MainWindow"
xmlns="[url]http://schemas.microsoft.com/winfx/2006/xaml/presentation"[/url]
xmlns:x="[url]http://schemas.microsoft.com/winfx/2006/xaml"[/url]
Title="Your App" Loaded="Window_Loaded">

כשאני אצלי בקוד מוסיף בשורה Title את הערך "Loaded="Window_Loaded

אני מקבל שגיאה שאומרת Player.MainWindow' does not contain a definition for 'Window_Loaded' and no extension method 'Window_Loaded' accepting a first argument of type 'PacketPlayer.MainWindow' could be found (are you missing a using directive or an assembly reference?)




בשורה האחרונה כאן אני מכניס את הערך:


<Window x:Class="PacketPlayer.MainWindow"
xmlns="[url]http://schemas.microsoft.com/winfx/2006/xaml/presentation"[/url]
xmlns:x="[url]http://schemas.microsoft.com/winfx/2006/xaml"[/url]
Title="Player" AllowsTransparency="False" Icon="/Player;component/Images/Organize.ico" mc:Ignorable="d" xmlns:d="[url]http://schemas.microsoft.com/expression/blend/2008"[/url] xmlns:mc="[url]http://schemas.openxmlformats.org/markup-compatibility/2006"[/url] Height="594" Width="521" >

פורסם

מה שהוספת קשר את הEVENT עם פונקצייה שלא קיימת אתה צריך להגדיר אותה בקוד.

פורסם

טעות, אפשר למחוק.

פורסם
  • מחבר

הסתדרתי בסופו של דבר אבל השאלה שלי היא האם יכולה להיות לי פונקציה מהסוג הבא שאני יגש אליה ממש לפני שהאפליקציה עולה כמו ב-Winform:


private void Form1_Load(object sender, EventArgs e)
{




}

פורסם

מה זאת אומרת? steelmanx נתן לך בדיוק לינק שמסביר על המקבילה של הדבר הזה ב-WPF.

פורסם
  • מחבר

תודה הסתדרתי.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.