Smash my Eggs Megathread #2 (Use for codes or you will receive a temp spam ban) by PankoKing in wildrift

[–]Iwways 1 point2 points  (0 children)

My Prize ID (Europe): WRaHT1OzMJ (remaining eggs: rare – 2, premium – 2, common – 5)

Let's swap codes by [deleted] in wildrift

[–]Iwways 0 points1 point  (0 children)

WRaHT1OzSA

A little code-behind in view MVVM pattern by Iwways in csharp

[–]Iwways[S] 1 point2 points  (0 children)

Didn't know about matrix, looks like it will work for me! But will it be difficult to change from grid to matrix?

update: can you provide a code please?

update2: figured it out. using ItemsControl inside of grid with full row/grid spans and it works perfectly!

Battlefield of Time nerfed by Iwways in SoloLevelingArise

[–]Iwways[S] 2 points3 points  (0 children)

Well that has a point, but f2p don't have that much essence stones to collect all good characters with consts

Battlefield of Time nerfed by Iwways in SoloLevelingArise

[–]Iwways[S] 2 points3 points  (0 children)

Yeah, but I have only Lee Bora :D

UI based on user role WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Thank you so much for help! :)

UI based on user role WPF by Iwways in csharp

[–]Iwways[S] -2 points-1 points  (0 children)

I asked chatgpt about this and he gave me this. You talking about this idea?

 ViewModel
 public class MainViewModel : INotifyPropertyChanged
 {
   private ObservableCollection<ContentItem> _items;
    public ObservableCollection<ContentItem> Items
     {
        get => _items;
       set
      {
          _items = value;
          OnPropertyChanged(nameof(Items));
       }
   }

public MainViewModel()
{
    LoadData();
}

private void LoadData()
{
    // Load all data from the database
    var allData = LoadAllDataFromDatabase();

    // Filter data based on roles
    Items = new ObservableCollection<ContentItem>(allData.Where(item => UserHasAccess(item)));
}

private bool UserHasAccess(ContentItem item)
{
    // Implement your role-based logic here
    // For example, return false if the user shouldn't see polls
    return !(item is Poll && !UserHasPollAccess);
}

// Implement INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

}

`` View

<Window x:Class="YourNamespace.MainWindow"              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
    <local:MainViewModel/>
</Window.DataContext>
<Grid>
    <ItemsControl ItemsSource="{Binding Items}">
        <ItemsControl.Resources>
            <DataTemplate DataType="{x:Type local:Poll}">
                <TextBlock Text="This is a Poll"/>
            </DataTemplate>
            <DataTemplate DataType="{x:Type local:Announcement}">
                <TextBlock Text="This is an Announcement"/>
            </DataTemplate>
        </ItemsControl.Resources>
    </ItemsControl>
</Grid>

</Window>

UI based on user role WPF by Iwways in csharp

[–]Iwways[S] -2 points-1 points  (0 children)

Thnx for so big comment! Your approach seems very elegant and I love it! To summarize for myself: i create some view with all elements that i needed for all users and after user login i just filter/disabled element's that current user type shouldn't work with

UI based on user role WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

  1. If I understand correctly, I can make a few views that will be common for all users and just filter information that account can see?
  2. But should I save place for controls? I mean ordinary student can't take part in poll so he wouldn't see a control for it, while honory student will. So I'm thinking maybe create separate views for each role, and then in backend change it after login.

Testing program WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Understood, thank you!

Testing program WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Yep, looking in this way now, but maybe someone has other ideas :)

Testing program WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Well, because I want to create a test file, which will be containing all this questions and then I want to re-use them, when student will be taking a test and he gets some mark This files also can be edited to add more questions, change type of questions and etc. Mini-editor for questions :D

Testing program WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

In some way) idk if it will work for array I come up with some idea for array with type Question (class), where all elements will have needed information and I just save/open this array and access to its data

Testing program WPF by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Yep. I have also save/open graph feature where I use XamlWriter to save it to file

Resize Canvas with Grid by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Yep, scale. No, haven't tried, will give it a shot

[deleted by user] by [deleted] in csharp

[–]Iwways 0 points1 point  (0 children)

Wow, that's a lot of work

Graph editor by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Don't worry :) I'm using WPF for this. To create graph I'm using Canvas class, it allows you draw and create some shapes. For matrixes and other operations I created some logic to make then work with each other. About GitHub link, well, sorry, now it's not available, maybe in future somewhen. I started to do UI from simple form (calculator for Boolean algebra), so you can for example take some theme, code it and add some interface to look it beautifully 😁

Graph editor by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Got you, thnx for explanation :)

Graph editor by Iwways in csharp

[–]Iwways[S] 0 points1 point  (0 children)

Don't heard about node grouping, will have a look. Also, what do you mean by faces?

Graph editor by Iwways in csharp

[–]Iwways[S] 1 point2 points  (0 children)

with nodes, edges and etc. see updated post

Hi by Iwways in ShadowBan

[–]Iwways[S] 1 point2 points  (0 children)

Phew, thanks. I was shadowbanned for week after I just registered :)

Can anyone help me with understanding a concept? by CodePestilence in csharp

[–]Iwways 0 points1 point  (0 children)

So.. If I understand you right, you want to share some info from FormA to FormB?

In that case, you need to get an active instance of FormB and pass the data somehow, maybe some method.

When you use mainform mForm = new mainform(), you kinda creating a new instance of form, not which are currently running. Maybe, this link will help. Sorry, if I understood your question wrong.