Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #3

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open

Refactoring #3

wants to merge 24 commits into from

Conversation

Ambratolm
Copy link

@Ambratolm Ambratolm commented Aug 8, 2021

Changes so far:

  • All code elements (except localized strings properties names and some comments) renamed to English.
  • All long recurring methods shortened.
  • API full rework complete.

Ambratolm added 6 commits August 8, 2021 00:57
Widely used global API method: LanguagesResourceManager.GetString(name, culture) shortened to: GetString(name) and all occurences of the method across the project replaced with the new one.
 Widely used: MessageBox.Show(text, caption, buttons, icon, defaultButton, options); shortened to: QuickMessageBox.ShowX(text) where X represents type of the message (information, question, warning, or error) and all occurences of the method across the project replaced with the new one.
- API global class divided into more particular classes: App, Database, and Language.
- API folder organized into sub-folders: Core and UI Elements.
- All calls to API properties and methods across the project are renamed accordingly.
@AXeL-dev
Copy link
Owner

AXeL-dev commented Aug 8, 2021

I can see that you kinda liked the app 😁 , this app is really old, like maybe 5 or 6 years ago haha, but anyway, i'm glad you enjoy playing with the code & refactoring it.

Let me know when you finish refactoring so i merge all the changes at once! (this way you can still push new commits to this PR).

Ambratolm added 5 commits August 9, 2021 00:53
- (Language.GetCurrentLanguage() == "ar") shortened to: (Language.IsArabic)
- All occurences of the expression replaced with the new one.
API database method FetchAllTables decoupled from UI ToolStripStatuslabel parameter. now the ToolStripStatuslabel is set within the main form logic.
Statement (DateTime.Now.ToString().Replace("/", "-").Replace(":", "-").Replace(" ", "_")) replaced with (DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss")) in all occurences in project.
Now changing current culture, setting message boxes reading direction, and saving language to database is done through one method only.
Ambratolm added 13 commits August 10, 2021 02:22
- Added available languages resources files detection.
- Added support for more than two languages.
- Added language menu-item sub-items auto-generation from available languages resources files (Adding a new language resource file will auto-add that language to application with no need for further setup which gives better support for adding more new translations).
- Added japanese language resource file.
- Added invariant general language resource file for the generation of strongly-typed class that allows access to localized strings through class properties instead of the non-typed GetString method of ResourceManager.
- All GetString calls in project replaced accordinly.
- As it's not really related to Form_Main, LanguageChanged moved to API class, and now to subscribe to the event, no more need to call an instance of Form_Main every time.
- All event subscription logic in project replaced accordinly.
- Removed API Forms Tracking Boolean Properties.
- Now single form opening is checked through form instances properties.
- API code shortened using data access layer classes.
- Now DataTables can be accessed directly through API properties using a wrapper data access class.
- All occurences in project replaced accordingly.
- Some bugs need to be fixed (To do for next commit).
- Database tables and columns renamed to english.
- All references to databae tables and columns names replaced accordingly.
- Data folder (database file and assets folder) added to project tree.
- Added post build event to copy data folder to output folder.
- Fixed some bugs (More to fix in next commit)
Runtime exceptions fixed, now the app can run :D
- The table "Language" name is a reserved word in access database, it caused errors in the DataAdapter object trying to run the generated SQL commands. Renaming it to "CurrentLanguage" fixed the errors.
- Renamed some forgotten references to the old names of the renamed database fields that caused exceptions when loading some forms.
[Forms refactoring work in progression]
- Job and Help forms refactored.
Some API methods added or updated due to form refactoring needs.
- Added GetRows and HasRows methods in TableAccessor class of Database API.
- Expression in refactored forms replaced accordingly.
[Forms refactoring work in progression]
- AddCustomer form refactored.
- Added Assets API class for better control over the creation of assets folders and files.
- API path properties (Database & Assets paths) placed in their respective API classes (Database & Assets).
- Removed AppFolderPath property becuase it's not needed as the paths are natively resolved in a relative way (to the current app executable folder path).
- References affected by changes in project replaced accordingly.
[Forms refactoring work in progression]
- AddCustomer form refactored.
- CustomersList form refactored.
- SearchCustomer form refactored.
- Job and Help forms refactored.
- Added DataTableNavigator utility class.
- Added DataGridViewColumnFormat utility class.
[Forms refactoring work in progression]
EditCustomer form sucks >:-(
@AXeL-dev
Copy link
Owner

Dude, that's a lot of work/refactoring! 😲 "ma3yitish? xD"

@AXeL-dev AXeL-dev linked an issue Aug 29, 2021 that may be closed by this pull request
9 tasks
@Ambratolm
Copy link
Author

Dude, that's a lot of work/refactoring! "ma3yitish? xD"

Hello, I was working on this during holidays, it was fun 💃. but the holidays are done, and I couldn't find time to finish it. well, I think commits up to 8d0e4a0 are ok ✔️ (the app runs without errors), but changes beyond it have some new bugs 🐞 as I remember 😆 I hope it gets some attention 🌹 in free times. I know it's kind of an old forgotten project 👵, but it's not about the project, it's about the message 🃏.

"🌏👽🚀 kawkab zo7al hal min tar7ib!?"

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.

Refactoring & Improvement Suggestions
2 participants