Skip to content

Conversation

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the codebase for consistency and adds development guidelines. It includes:

  • Addition of GitHub Copilot prompts and instructions for contributors
  • Introduction of an .editorconfig file with coding standards
  • Code refactoring across handlers and samples to align with new standards (access modifiers, field naming, formatting)

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
Handler files (iOS, MacCatalyst, Android) Added explicit private access modifiers to methods and fields; reformatted code for consistency
AppHostBuilderExtensions.cs Converted to file-scoped namespace and updated handler registration syntax
SegmentedControlOption.cs Updated field naming from underscore-prefix to camelCase; changed to file-scoped namespace
SegmentedControl.cs, ISegmentedControl.cs Applied formatting consistency; changed to file-scoped namespace
GroupToggleBehavior.cs, ElementChildrenChanging.cs Converted to file-scoped namespace; used primary constructor
Test2ViewModel.cs Refactored field naming to camelCase; converted to file-scoped namespace; used collection expressions
Sample code-behind files Updated field naming and access modifiers to match editorconfig rules
.editorconfig Added comprehensive coding standards including naming rules, analyzers, and formatting preferences
Copilot prompt files Added coding guidelines, best practices, and testing patterns
Comments suppressed due to low confidence (1)

samples/SegmentedControlSamples/SegControlTest1.xaml.cs:70

  • Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
        if (SegmentedControl.SelectedTextColor != Colors.Red)
        {
            SegmentedControl.SelectedTextColor = Colors.Red;
        }
        else
        {
            SegmentedControl.SelectedTextColor = Colors.Green;
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@MykhailoDav I've opened a new pull request, #15, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 8 comments.

Comments suppressed due to low confidence (1)

samples/SegmentedControlSamples/SegControlTest1.xaml.cs:62

  • Both branches of this 'if' statement write to the same variable - consider using '?' to express intent better.
        if (SegmentedControl.SelectedTextColor != Colors.Red)
        {
            SegmentedControl.SelectedTextColor = Colors.Red;
        }
        else
        {
            SegmentedControl.SelectedTextColor = Colors.Green;
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7 to 36
Test2ViewModel viewModel;

public SegControlTest2()
{
InitializeComponent();
SegmentedControl.BindingContext = _viewModel = new Test2ViewModel();

SegmentedControl.BindingContext = viewModel = new Test2ViewModel();
}

private void SegmentedControl_ValueChanged(object sender, Plugin.Maui.SegmentedControl.ValueChangedEventArgs e)
void SegmentedControl_ValueChanged(object sender, Plugin.Maui.SegmentedControl.ValueChangedEventArgs e)
{
segmentIndexLabel.Text = e.NewValue.ToString();
}

PlayerStatus _playerStatus = PlayerStatus.Stopped;
private void SegmentedControl_SegmentTapped(object sender, SegmentTappedEventArgs e)
PlayerStatus playerStatus = PlayerStatus.Stopped;
void SegmentedControl_SegmentTapped(object sender, SegmentTappedEventArgs e)
{
if (e.Index == 1)
{
if (_playerStatus == PlayerStatus.Playing)
if (playerStatus == PlayerStatus.Playing)
{
SegmentedControl.Children[1].Text = "Play";
_playerStatus = PlayerStatus.Stopped;
playerStatus = PlayerStatus.Stopped;
}
else
{
SegmentedControl.Children[1].Text = "Stop";
_playerStatus = PlayerStatus.Playing;
playerStatus = PlayerStatus.Playing;
}
}
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The private modifiers added to fields and methods contradict the project's coding guidelines. According to .github/copilot-instructions.md line 128: "We do not use the private keyword as it is the default accessibility level in C#."

These access modifiers should be removed.

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines +42 to 103
PlayerStatus playerStatus;
PlayerStatus PlayerStatus
{
get { return playerStatus; }
set
{
get { return this.PlayerStatus.ToString(); }
playerStatus = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(PlayerStatusText)));
PlayButtonText = playerStatus == PlayerStatus.Playing ? "STOP" : "Play";
}
}

private string _playButtonText;
public string PlayButtonText
{
get => _playButtonText;
set { _playButtonText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(PlayButtonText))); }
}
public string PlayerStatusText
{
get { return PlayerStatus.ToString(); }
}

private bool _backButtonEnabled = true;
public bool BackButtonEnabled
{
get => _backButtonEnabled;
set { _backButtonEnabled = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(BackButtonEnabled))); }
}
string playButtonText;
public string PlayButtonText
{
get => playButtonText;
set { playButtonText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(PlayButtonText))); }
}

private bool _forwardButtonEnabled = true;
public bool ForwardButtonEnabled
{
get => _forwardButtonEnabled;
set { _forwardButtonEnabled = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ForwardButtonEnabled))); }
}
bool backButtonEnabled = true;
public bool BackButtonEnabled
{
get => backButtonEnabled;
set { backButtonEnabled = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(BackButtonEnabled))); }
}

private string _forwardButtonText;
public string ForwardButtonText
{
get => _forwardButtonText;
set { _forwardButtonText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ForwardButtonText))); }
}
bool forwardButtonEnabled = true;
public bool ForwardButtonEnabled
{
get => forwardButtonEnabled;
set { forwardButtonEnabled = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ForwardButtonEnabled))); }
}

string forwardButtonText;
public string ForwardButtonText
{
get => forwardButtonText;
set { forwardButtonText = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(ForwardButtonText))); }
}

private int _selectedSegment;
public int SelectedSegment
{
get => _selectedSegment;
set
{
_selectedSegment = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(SelectedSegment)));
}
}
private IList<SegmentedControlOption> _segmentItemsSource;
public IList<SegmentedControlOption> SegmentItemsSource
int selectedSegment;
public int SelectedSegment
{
get => selectedSegment;
set
{
get => _segmentItemsSource;
set { _segmentItemsSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentItemsSource))); }
selectedSegment = value;
OnPropertyChanged(new PropertyChangedEventArgs(nameof(SelectedSegment)));
}
}


public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
PropertyChanged?.Invoke(this, e);
}
IList<SegmentedControlOption> segmentItemsSource;
public IList<SegmentedControlOption> SegmentItemsSource
{
get => segmentItemsSource;
set { segmentItemsSource = value; OnPropertyChanged(new PropertyChangedEventArgs(nameof(SegmentItemsSource))); }
}
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The private modifiers added to fields contradict the project's coding guidelines. According to .github/copilot-instructions.md line 128: "We do not use the private keyword as it is the default accessibility level in C#."

These access modifiers should be removed.

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Comment on lines 7 to 9
private SegmentedControl parent;

int _instanceId;
private readonly int instanceId;
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The private modifiers added to fields contradict the project's coding guidelines. According to .github/copilot-instructions.md line 128: "We do not use the private keyword as it is the default accessibility level in C#."

These access modifiers should be removed.

Copilot uses AI. Check for mistakes.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #16, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #17, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #18, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #19, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #20, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #21, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Nov 26, 2025

@yurkinh I've opened a new pull request, #22, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 10 commits November 26, 2025 17:10
Remove private keyword from fields per coding guidelines
[WIP] Address feedback from review on some refactors PR
…d75-8222-2696c59534da

Remove private modifiers per coding guidelines
No changes needed - typo already corrected
Verify removal of private modifiers in Test2ViewModel.cs
Address coding guidelines feedback - private modifiers already removed
@yurkinh yurkinh merged commit 4ffb63a into main Nov 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants