|
|
I killed the communication between my PC and my Android phone a while ago. The phone won't work with my portable, nor with my desktop. It lost them both ad the same time, so it wasn't the fault of the PC(s) - and I know how I did it:
I am not a big fan of smartphone apps. My eyes are too old, my fingers too large, and touch screens everywhere refuse to react to my fingertips - if you see someone at the coffee machine tapping, tapping harder, tapping again, ... then it could be me. Same with my baking oven. And my desktop radio. I set up my Bluetooth PC keyboard to talk to the phone, but that works at home only.
I decided to clean up my phone, so that it would have only the apps that I "must" have. Not the other hundred or so apps that somehow have made it into my phone. I killed off every one that I didn't remember ever using. Obviously, I removed one too many.
I haven't yet gotten around to fixing it, but assume that a complete 'restore to factory settings' will do the job - crossing my fingers for factory restore still being available even if OS updates no longer are. If not, I have another reason for replacing my six year old Galaxy S7 edge with several cracks in the front glass 
|
|
|
|
|
trønderen wrote: touch screens everywhere refuse to react to my fingertips
I used to have a similar problem until I realized that the cause was that I wasn't keeping my finger stationary during the tap.
If you make contact with the screen and don't keep your finger absolutely stationary, it will assume you mean to start a drag and drop operation.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I've recently experimented with base and derived forms, and though it works fine with non-resizable forms, there are problems with resizable forms.
As you know, with resizable forms, you use anchoring and docking to keep the controls in place and let the form resize gracefully. But when you inherit from a form that has anchored or docked controls, the inherited form does not display correctly in the Visual Studio Form Designer. It appears to compile and display correctly while running, but that too could break.
Obviously, in an inherited form, both constructors execute, the base form's and the derived form's. It seems the problem is that one form's constructor sets measurements while the layout is suspended in the other form's constructor. I read about this in Roland Weigelt's blog Roland Weigelt - Visual Inheritance - How to escape Layout Hell[^]
He explains that
Quote: In the moment the constructor of the base class is left, the layout and the controls are perfect for a Form1 instance - but that's not what we want. The method InitializeComponent() of class Form2 contains the code that is necessary to achieve the desired layout by tweaking the base form and adding the second button. While setting the Text property to "Form2" is rather trivial, setting the ClientSize property causes serious trouble. The problem is that the size is set while the layout logic is suspended; i.e. the size of the form is changed, but the anchored elements of the base class are not updated.
And in Roland Weigelt - Visual Inheritance Revisited[^]
Quote: Question: So why does docking work, but not anchoring?
Docking tells a control to grab as much space as possible (for top/bottom/left/right: towards to the specified direction) until a border of the container is reached. When the size of the control's container changes, the border is moving, so the docked control will resize itself accordingly.
Anchoring tells a control to keep a constant distance between a specified border (top/bottom/left/right) of the control and the corresponding border of the container at all times. Now if the container is resized while layout is suspended (which is the case in InitializeComponent() of class Form2), the anchored control does not notice the change. When layout is resumed, the control will keep the distance that exists at this time. This can be observed if you resize the form either inside the forms designer or at run time. The anchoring works perfectly, but unfortunately using the wrong offsets...
He advises to use docked panels, but I found this not to work, probably because WinForms has changed since 2003, when he wrote that article.
For now, I'm experimenting with form templates. But templates go only one way. They are basically just copies, so later revisions to the templates don't appear in the forms created from the templates.
Do you use form inheritance, and if so, how do you deal with this?
|
|
|
|
|
So, WinForms. Might helpt a bit if you include that info.
RobertSF wrote: He advises to use docked panels, but I found this not to work, probably because WinForms has changed since 2003, when he wrote that article. It didn't, but you found me in a non explaining mood.
Did you really think that WinForms would change after these years?
RobertSF wrote: Do you use form inheritance, and if so, how do you deal with this? Yes. And elegant.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Sorry, and thank you. Hope your day gets better.
|
|
|
|
|
Hahaha, yeah, you do that
You can inherit resizable forms offcourse.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I inherit from resizable WinForms quite often (mostly to provide a common "look and feel" plus I use large image buttons and fonts that all forms need - and it works well:
public partial class FormBase : Form
{
...
}
public partial class FrmMain : FormBase
{
...
}
The "standard" buttons are set in FrmBase, and all derived forms include them.
The only PITA for me is that the base form cannot be abstract because the designer can't cope unless you add a dummy concrete class "in the middle" for design mode only (which I hate because it means I'm not testing the same code I'll use in production).
I've never had a problem with Anchoring or Docking - what exactly is happening to your derived form when you resize it?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
OriginalGriff wrote: I've never had a problem with Anchoring or Docking - what exactly is happening to your derived form when you resize it?
The problem happens as soon as I derive a form from a base form. The derived form appears in the visual designer like this https://i.ibb.co/5sDNBRP/Untitled.png[^]
The derived form only shows the control box. I expand the form to its proper default size, and everything looks good. When I reopen that form in the designer, however, the controls are all jumbled and out of place. Curiously, if I compile and open the form during execution, it appears fine.
The blog I linked in my first post describes the problem and its causes. Thanks for the reality check. I'll upgrade my VS 2017 to the latest, and maybe it's time to move to WPF and drop WinForms. 
|
|
|
|
|
Have you tried expanding the size?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Yes, and when expanded, the form looks fine, but after saving and reopening, then the controls are jumbled and out of place. However, I'll have to figure out what I did different because now the form reopens just fine. Thanks for your suggestions.
Maybe it did solve the issue to use docked panels instead of putting the controls directly in the form. Is that a technique you use?
If you have a chance, give the articles I linked a look. They're interesting, and the writer seems to know his stuff.
|
|
|
|
|
Mostly, yes - though I generally create a UserControl if it's going to fill an area like a toolbar does, or provide a status bar. Those work fine docked to the top / bottom, then I'll use a central panel to drop other controls on.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
It can get confusing sometimes - easy mistake to make!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hello,
I already have a approved bot account on non english wikipedia. I am having trouble with converting the provided sample codes to C#. Would someone kindly do it? More details can be found at API:Tutorial - MediaWiki[^] and API:Edit - MediaWiki[^] Samples in java, PHP and python can be found at "API:Edit - MediaWiki" link. Here is sample code in java:
var request = require('request').defaults({jar: true}),
url = "https://test.wikipedia.org/w/api.php";
function getLoginToken() {
var params_0 = {
action: "query",
meta: "tokens",
type: "login",
format: "json"
};
request.get({ url: url, qs: params_0 }, function (error, res, body) {
if (error) {
return;
}
var data = JSON.parse(body);
loginRequest(data.query.tokens.logintoken);
});
}
function loginRequest(login_token) {
var params_1 = {
action: "login",
lgname: "bot_username",
lgpassword: "bot_password",
lgtoken: login_token,
format: "json"
};
request.post({ url: url, form: params_1 }, function (error, res, body) {
if (error) {
return;
}
getCsrfToken();
});
}
function getCsrfToken() {
var params_2 = {
action: "query",
meta: "tokens",
format: "json"
};
request.get({ url: url, qs: params_2 }, function(error, res, body) {
if (error) {
return;
}
var data = JSON.parse(body);
editRequest(data.query.tokens.csrftoken);
});
}
function editRequest(csrf_token) {
var params_3 = {
action: "edit",
title: "Project:Sandbox",
appendtext: "test edit",
token: csrf_token,
format: "json"
};
request.post({ url: url, form: params_3 }, function (error, res, body) {
if (error) {
return;
}
console.log(body);
});
}
getLoginToken();
Thanks a lot in advance.
modified 9-Feb-22 12:08pm.
|
|
|
|
|
Pallavi H Shinde wrote: Would someone kindly do it? Sure. As soon as we agree on payment.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I am doing it for free for wikipedia 
|
|
|
|
|
You're not doing it, you're asking me kindly to do it.
I do not do free work, as most here won't.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
|
I write in Postman this URL for Get method: https://localhost:7033/api/restaurant and I get 404 not found result. I don't know where is the problem. For https://localhostlocalhost:7033 it works, so it must be something wrong with [Route("api/restaurant")]
Here is the Controller code:
[Route("api/restaurant")]
public class RestaurantController : ControllerBase
{
private readonly RestaurantDbContext _dbContext;
public RestaurantController(RestaurantDbContext dbContext)
{
_dbContext = dbContext;
}
[HttpGet]
public ActionResult<ienumerable<restaurant>> GetAll()
{
var restaurants = _dbContext.Restaurants.ToList();
return Ok(restaurants);
}
}
and launchSettings file code:
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:8196",
"sslPort": 44311
}
},
"profiles": {
"RestaurantApp": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7033;http://localhost:5033",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
modified 6-Feb-22 6:56am.
|
|
|
|
|
|
Hello,
when i set three '/' over my Property, i can declare a Comment for Intellisense.
Like this:
Now i have a special custom Attribute on this Proeprty.
I want to includ einformations of this Attribute into the Comment für Intellisense
Sample:
[MyCustomAttribute("ExtendedInformation")]
IPickingOrder Order { get; }
Now i see in intellisense the Text "Zugehöriger Auftrag" but i want to include the Attribute.
Anybody knows how to do that?
Best regard
Armin
|
|
|
|
|
If you're asking how you can automatically add the Attribute to part of the comment, you can't. You have to type it out yourself.
|
|
|
|
|
To add to what Dave has said, there is no way to get Intellisense to recognise your attributes as "Taggable" - the list cannot be customised, but "user defined" tags are allowed so there is nothing stopping you from typing it yourself (and it'll add the closing for you if you do).
The full list of "known tags" that intellisense will type for you is here: Documentation comments - C# language specification | Microsoft Docs[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
If it's simply a matter of enhancing the documentation, this may help (when adding the attribute in the first place).
Documentation comments - C# language specification | Microsoft Docs
I add a comment if something needs commenting. If the attribute was important enough (without resorting to "find") I would have added it to the "Summary" in the first place. And what seemed important at the time, becomes the familiar.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|