Rehsarper 2018.2.3 Disbale inserting new line between summary and single line comment - resharper

I'm not able to find the right setting to disable the automatically inserting of a new line between a documentation header summary and a single line comment on code clean up.
For example i have the following code:
/// <summary> The get data from source. </summary>
/// <returns> The source data. </returns>
// ReSharper disable once MethodTooLong
protected override IDictionary<string, Object> GetData()...
After clean up code (CTRL+E+F) the result is:
/// <summary> The get data from source. </summary>
/// <returns> The source data. </returns>
// ReSharper disable once MethodTooLong
protected override IDictionary<string, Object> GetData()...
How can i get rid of the automatically inserted blank line?

Quite late, but for future:
On Resharper 2018.2.3
Resharper > Options > Code Editing > C# > Formatting Style > Blank Lines : Blank Lines in Declarations : After File header comment = 0
As you also have a comment, make sure you have Resharper > Options > Code Editing > C# > Formatting Style > Blank Lines : General : Before single-line comment = 0

Related

Does AllowedFileTypes in UploadDialog allow for multiple file types, and if so, what is the format?

If I just set one file type, it'll filter properly and allow for the image to be uploaded.
If I try multiple file types in the property, it may filter them, but it will always error (screen shots below). I've tried inputting the two types I want as "png, jpg", "png jpg", "pngjpg", and ".png, .jpg", but none of them work. Some of the formats will auto set the filter to show both *.png, *.jpg, but when I select the file I get an error. Can this work with multiple file types?
Setting field values:
Showing images:
Error on selecting image:
Did you try semi-colon ; separator?
This is the standard Windows extension separator and there's indication Acumatica uses this character for parsing.
/// <summary>
/// Gets or sets string representing file types which are allowed for selecting.
/// </summary>
[Category("Behavior")]
[Description("The string that lists the file types that are allowed for selecting.")]
public string AllowedFileTypes
{
get
{
return this.allowedFileTypes;
}
set
{
this.allowedFileTypes = "";
if (string.IsNullOrEmpty(value))
return;
this.SetAllowedFileTypes(value.Split(';'));
}
}

Acumatica 2020R1 - FirstOrDefault selecting a different row

I have used FirstOrDefault a ton in my code (its a habit, I used linq2sql a lot in the past) and use it in Acumatica. Per development support, it should only be used when you are expecting one result.
I have some code on SOOrderEntry that gets the item on the current line by clicking a button and checking a few things. This is in my Graph Extension.
This code worked prior to the upgrade:
SOLine Line = Base.Transactions.Current;
InventoryItem Item = SelectFrom<InventoryItem>.Where<InventoryItem.inventoryID.IsEqual<#P.AsInt>>.View.Select(Base, Line.InventoryID).FirstOrDefault();
InventoryItemExt ItemExt = Item.GetExtension<InventoryItemExt>();
The result is not as expected. Line.InventoryID returns 10045, which is the correct item. Item.InventoryID is 10046
After debugging, I found that the new argument that can be used easily is the new property TopFirst. This returns the First Result.
The following code works as expected (and how it worked in 2019 R2 and before!).
SOLine Line = Base.Transactions.Current;
InventoryItem Item = SelectFrom<InventoryItem>.Where<InventoryItem.inventoryID.IsEqual<#P.AsInt>>.View.Select(Base, Line.InventoryID).TopFirst;
InventoryItemExt ItemExt = Item.GetExtension<InventoryItemExt>();

Trying to customize JAMS LaborEntry screen, looking for the line of code that will update the header

Brand new to Acumatica development and stuck on a simple thing. :(
I am customizing the LaborEntry screen of the JAMS MFG.
I have added a field to the header by extending the AMBatch DAC, called UsrTimeClocked.
For now I simply wish to set this field to a number right at the end of the RowInserted event at the detail level of the AMMTran and see my number on the screen, up on the header AMBatch.
public class LaborEntry_Extension : PXGraphExtension<LaborEntry>
{
protected virtual void _(Events.RowInserted<AMMTran> e)
{
AMBatchExt ext = Base.batch.Current.GetExtension<AMBatchExt>();
ext.UsrTimeClocked = 5.32;
//Insert line to update the correct object to see 5.32 in the TextBox, before RowSelected is done.
}
}
As is my value goes in the field and any refresh/save/delete of the row does update the correct object and I see my value where I want it. I wish to know the way to force this update.

Class extending AbstractDetailsDescriptionPresenter text gets cut off

I'm using a class extending AbstractDetailsDescriptionPresenter. The summary text is relatively long. For some reason the text gets cut off after a certain length. I could not figure out how to display the entire text without it being cut off.
I tried viewHolder.getBody().setLines(20); and other property changes but nothing seemed to have the desired effect.
This it the Presenter class I'm using:
public class MovieDetailPresenter extends AbstractDetailsDescriptionPresenter {
#Override
protected void onBindDescription(ViewHolder viewHolder, Object item) {
Video video = (Video) item;
if (video != null) {
viewHolder.getTitle().setText(video.title);
viewHolder.getSubtitle().setText(video.subtitle);
viewHolder.getBody().setText(video.summary);
}
}
}
How can I remove the text length limit/cutting off?
Here a picture to better illustrate what I mean. The text at the bottom right isn't displayed in its full length but gets cut off and adds three dots (...) at the end.
Thanks for any hints/help.
Finally found a solution: Making a custom “AbstractDetailsDescriptionPresenter” without the addPreDrawListener() method (which is causing the problem) and use it in the “DetailsDescriptionPresenter”.
body.setMaxLines(Integer.MAX_VALUE) should do the trick unless you are forcing a specific height somewhere in your LayoutParams. I assume you're setting height to wrap_content? You could try enabling Show Layout Bounds in the developer options to see if your changes have any effect.

Hyperlink to page with smart search filter prepopulated

I have a smart search page that shows all the products on the page with some smart search filters that narrows down the products on some criterias (Let's say for example Filter1 has Option1, Option2 and Option3).
What I am trying to accomplish is to have a link on a seperate page that links to the product page, but when the user clicks on that link some of the search filters gets set (For example Filter1 would have Option2 selected).
I'm not sure if that is possible with out of the box solution, but with simple tweaks inside SearchFilter.ascx.cs, you can make a workaround. File is placed under CMSWebParts/SmartSearch/SearchFilter.ascx.cs. You should change method 'GetSelectedItems' to take a look into query string for filter value (see snippet bellow):
/// <summary>
/// Gets selected items.
/// </summary>
/// <param name="control">Control</param>
/// <param name="ids">Id's of selected values separated by semicolon</param>
private string GetSelectedItems(ListControl control, out string ids)
{
ids = "";
string selected = "";
//CUSTOM: retrive value for query string
var customFilter = QueryHelper.GetString("customFilter", "");
// loop through all items
for (int i = 0; i != control.Items.Count; i++)
{
//CUSTOM: ----START-----
if (!RequestHelper.IsPostBack())
{
if (!string.IsNullOrEmpty(customFilter))
{
if (control.Items[i].Text.Equals(customFilter, StringComparison.InvariantCultureIgnoreCase))
{
control.Items[i].Selected = true;
}
}
}
//CUSTOM: ----END-----
if (control.Items[i].Selected)
{
selected = SearchSyntaxHelper.AddSearchCondition(selected, control.Items[i].Value);
ids += ValidationHelper.GetString(i, "") + ";";
}
}
if (String.IsNullOrEmpty(selected) && (control.SelectedItem != null))
{
selected = control.SelectedItem.Value;
ids = control.SelectedIndex.ToString();
}
return selected;
}
And your hyperlink will look like this: /Search-result?searchtext=test&searchmode=anyword&customfilter=coffee
With this modifications, you can send only one value in filter, but if you need more then one value, you can send them and customize it however suits you best. Also, you can send filter name (in case that you have multiple filters) and then add check in method above.
I will recommend you not to modify kentico files. Instead of that, clone default filter web part and make modifications there, because withing next upgrade of project, you will lose your changes. I checked this in Kentico 11.
For Smart Search Filters:
if turn off auto-post back option -then web part control ID should become a query string parameter that you can use.
This above will form something like:
/Smart-search-filter.aspx?searchtext=abc&searchmode=anyword&wf=2;&ws=0;&wa=0
P.S. I suggest you to take a look at the corporate site example: look the smart search filter web part: /Examples/Web-parts/Full-text-search/Smart-search/Smart-search-filter. It is working example you can use it as starting point.

Resources