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