19 Commits
Author SHA1 Message Date
mika@stocksharp.com 3b814d26d2 Samples: build from the applications' sources again and follow the awaited API
The applications moved every host into a folder of its own, so the projects the from-source samples reference
are under Xaml\Avalonia and Xaml\Wpf now, and the FIX connector they named lives in the public connectors
repository. Nine WPF samples still named Xaml and Xaml.Charting where they were before: a missing project
reference is only a warning, so they failed later, at the first DevExpress or StockSharp tag of their markup.

The MultiConnect samples sign in through the window the WPF head has. That head keeps the credentials window
in Studio.WebApi.UI, taking the site's client service; the samples asked StockSharp.Xaml for one taking a
fetcher, which the head does not have, and did not compile from sources. The published UI packages are far
behind the sources and are not what the samples are kept in step with: the package-based projects of these
samples compile once the WPF packages built from that head are published.

The WPF samples await the connector's settings window, which the WPF library offers as ConfigureAsync only,
and the active-orders sample awaits the chart's save instead of the obsolete blocking wrapper. The
package-based projects of the same samples compile once a StockSharp.Xaml package that has ConfigureAsync is
published.

The Avalonia samples keep the connection settings through the awaited store: IConnectorSettingsStore reads
and writes through awaited members now, so the sample store reads or writes its file when it is asked instead
of reading both files up front and queueing its writes. The chart sample saves and loads its chart the same
way.

Eight Avalonia samples put the wheel date picker into columns of 150-170 pixels. It does not get narrower
than about three hundred, so the two of them ran over each other and over the Start and Stop buttons. They
take the compact calendar editor now, which the history testing sample already had.
2026-10-15 23:02:33 +03:00
mika@stocksharp.com 4203be8f5c Unwind the blocking waits left by the async rework and fix what it uncovered
"Mark the blocking wrappers obsolete" left several callers of those wrappers
under #pragma, because a property, a parameter handler or a state setter could
not wait, and a few places that blocked without a wrapper. Each of those
chains now runs through callers that can await.

The emulation connector. A state change collects what its handlers throw and
sends it out once the state lock is released; the disconnect that follows
Stopping is awaited there as well. The change to Stopped moved from a handler
of Disconnected into OnDisconnectedAsync, a step the connector now awaits
before it raises that event.

ExpressionIndexSecurity. Expression records the text and reads the instruments
it names, which needs no compiler. The formula is compiled by GetFormulaAsync;
Formula is an obsolete blocking wrapper over it. IBasketSecurityProcessor gets
InitAsync, where the expression processor takes its formula, and
CreateProcessorAsync creates a processor and prepares it; CreateProcessor and
the IEnumerable ToBasket are obsolete wrappers, and the tests of ToBasket go
through the IAsyncEnumerable overload. The index diagram element builds its
index in OnPrepareAsync.

MathDiagramElement. The inputs are named by the text of the formula; the
formula and its validation are compiled in OnPrepareAsync. An element that was
reset therefore compiles again at the next start instead of refusing to start.
An input that is wired stays while the text is not known to compile, and goes
at the preparation if the compiled formula does not name it. A text replaced
under a running element is an error on every value until the element is
prepared again.

Candle patterns. A CandleExpressionCondition compiled its formula in the
constructor or, for the registry, at the first evaluation. The formula is now
compiled by PrepareAsync: on the condition, on ICandlePattern and, through the
new IIndicator.PrepareAsync, on the indicator that holds a pattern. A pattern
that was not prepared refuses to recognize instead of compiling on the spot.
The checks of a pattern as a whole - a formula reaching outside it, no
formulas at all - moved from the first Recognize to the preparation, and a
failed check no longer leaves the pattern marked as checked. Whoever feeds an
indicator prepares it first: IndicatorDiagramElement in OnPrepareAsync, a
strategy for the indicators its start registered, the chart samples when an
indicator is added. ICandlePatternProvider.Save became SaveAsync and prepares
the pattern before it stores it. The compileOnDemand constructor is gone: no
constructor compiles.

Stopping a strategy from code that cannot wait. When an element was entered
deeper than the overflow limit, DiagramElement.Process stopped the strategy
through AsyncHelper.Run. Strategy gets RequestStop for such code: it reports
the error, refuses new orders at once and leaves the stop itself to
OnNewMessage, which carries it out when the connector hands over the next
message.

Releasing a connector. Connector.DisposeManaged waited for the disconnect, and
for the message that takes the adapters apart, through AsyncHelper.Run. The
release is now DisposeManagedAsync, a virtual chain that the connectors
derived from Connector override. DisposeAsync awaits it, and the sealed
DisposeManaged is the same chain with the caller blocked, as IDisposable
requires. IConnector is IAsyncDisposable, so code that holds a connector by
its interface releases it by await as well.

Diagram elements that waited for their type. A composition read before one of
its element types was registered keeps an empty node for each such element.
Registering the type started their load unawaited, and a failure lost the
settings at the next save. ICompositionRegistry gets
LoadNotLoadedElementsAsync, to be awaited by whoever registered the types. It
loads what waits in the given composition and in the compositions nested in
it, one call at a time. The settings of an element that waits are kept by its
node (ICompositionModelNode.ElementSettings). A loaded element joins its
model: it is announced as an added one and the links of its node are
connected.

The sample windows. CombineHistoryRealtime, LiveTerminal and StoreDataLocal,
WPF and Avalonia, flushed the storage executor, released the CSV registries
and read them at startup through AsyncHelper.Run. A window now refuses the
first attempt to close it, awaits the release and closes itself once the
queued writes are on the disk. A shutdown that does not honour the refusal -
the end of the Windows session, Application.Shutdown - is not waited for: what
is still queued then is lost. LiveOptionsQuoting and MultiConnect called the
blocking Strategy.Start, Stop and GetTimeFrames under a suppressed obsolete
warning; they await the async ones now.

What the rework uncovered:

- Pausing the optimizer. An iteration that had passed the pause gate but
  whose connector had not started replaying yet ran to its end through the
  pause; cloning the strategy asynchronously made that window long enough for
  PauseHaltsBruteForce to see it on CI. An iteration now waits for its
  connector to come up and suspends it if the optimizer is paused by then.
- Undo of diagram elements. An undo scope opened with no undo manager in
  sight took the element's level down when it closed, so the level was
  negative by the time the element reached a composition and no edit was ever
  reported. The scope remembers whether it was counted.
- Undo of a chart panel. A snapshot keeps the series and axes of a panel by
  reference, since a part can only be saved asynchronously, so undo did not
  put back what a part was set to. IChartSnapshotPart is an optional interface
  for a part that can copy its settings in memory; the panel captures and
  gives back the settings of such parts. No chart part implements it yet -
  that is for the chart packages to do.
- The dummy indicator wrapper was left without a chart element, so indicator
  values could not be wired into the panel that a run without a window uses.
- Settings loaded before a composition existed are applied when the strategy
  starts; a test pins it.
- AsyncMessageChannel looked at its state once per wake-up and then went
  through the queue until it was empty, so a message sent right after Suspend
  returned could still be started, and Suspend_PausesProcessing was red from
  time to time. The state is now read under the queue lock, where the next
  message is picked; a channel that is being closed stops starting what is
  queued the same way.

DiagramElementParamTests no longer declares a value that persists itself
through the obsolete IPersistable: declaring one needs a suppressed warning,
and for that contract the parameter relies on SaveEntireAsync and
LoadEntireAsync of Ecng, which are tested there.
2026-10-04 18:59:25 +03:00
mika@stocksharp.com ebdb3b6c0b Update sample source paths for nested Xaml projects 2026-08-28 18:16:38 +03:00
mika@stocksharp.com bbd808faf2 samples: reference what the samples are actually written against
The samples were pointed at published packages that no longer match the sources
next to them, and at one package they had no business referencing at all.

Connectors come from the sibling checkout rather than from NuGet. The published
connector packages were compiled against a StockSharp.Messages that still had
AsyncMessageAdapter; the source has since dropped it, so a package built against
the old base type fails with CS7069 the moment the local Messages project is in
the graph - which it always is inside this solution. FIX is among them now: it
has moved out of the closed repository and is a project like the others, so the
two Hydra samples that used its package take the project too.

Indicators, strategies and the testing stack used to ship inside StockSharp.Algo
and are separate projects now, so referencing Algo alone left every sample
without SimpleMovingAverage, Strategy and RandomWalkTradeGenerator. Two
references cover it: Algo.Strategies reaches Algo.Testing and Algo transitively,
while Algo.Indicators is not reachable from that chain and has to be named.

01_MultiConnect and 02_StoreDataLocal additionally referenced
StockSharp.Studio.WebApi.UI for exactly one type, CredentialsWindow, and got
Studio.Core and Studio.WebApi with it. That type now lives in StockSharp.Xaml,
so the reference goes - from the package projects and the _fromsrc ones alike.
The dialog takes an ICurrentClientFetcher rather than the web API's client
service, and the sample supplies its own: it already registers an
IApiServiceProvider, the same object Studio's registry reads, so the anonymous
lookup is the call it always was, made directly. Web.Api reached those samples
transitively through the Studio package and is named explicitly now;
StockSharp.Web.DomainModel is aliased rather than imported wholesale, since it
also defines Subscription and DataType, which that file uses from
BusinessEntities and Messages.

Both _fromsrc samples build. The package-based pair does not yet: it takes
StockSharp.Xaml transitively from the published StockSharp.Xaml.Charting, and the
published Xaml has no ICurrentClientFetcher. They compile as soon as
StockSharp.Xaml is republished.

Two samples are left failing rather than papered over: 09_Advanced needs the
republished Xaml above, and 03_Storage/03_RemoteSource uses StockSharp.Finam,
stale in the same way the connector packages were, with no Finam project in the
Connectors checkout to point at instead.
2026-07-30 20:27:13 +03:00
mikasoukhov 4dfb975578 build fix. 2026-01-08 18:34:19 +03:00
mikasoukhov ca6d4de17c build fix. 2025-12-30 23:55:07 +03:00
mikasoukhov 450fe68a0e Updated samples and tests for IFileSystem API. 2025-12-26 03:31:29 +03:00
mikasoukhov bdd9777e9c Refactored NativeIdStorage to use provider pattern
- Renamed INativeIdStorage to INativeIdStorageProvider
- Created new INativeIdStorage interface for single isolated storage
- Provider pattern: GetStorage(storageName) returns isolated storage with own buffer
- INativeIdStorageProvider implements IAsyncDisposable
- Each CsvNativeIdStorage instance has isolated buffer and file access
- Updated SecurityNativeIdMessageAdapter, BasketMessageAdapter, TraderHelper, ServicesRegistry
2025-12-23 21:02:38 +03:00
mikasoukhov 0f17bf9bd2 Storages. Init -> InitAsync. 2025-12-16 20:08:38 +03:00
mikasoukhov 260cc53015 Themes fixes. 2025-12-01 09:20:08 +03:00
mikasoukhov daff1dc1ce Fix commit 565a289bdc 2025-11-26 20:14:47 +03:00
mikasoukhov 565a289bdc DelayAction -> ChannelExecutor 2025-11-24 15:30:43 +03:00
mikasoukhov d3b53a9ddb Code cleanup. 2025-10-04 22:37:48 +03:00
mikasoukhov 6f82c05ee6 Samples. MultiConnect supported S# web api authorization. 2024-12-27 10:42:30 +03:00
mikasoukhov a6a7931b3d common_connectors.props 2024-09-29 22:14:13 +03:00
mikasoukhov 444b99ec54 IIndicator, CandleSeries, Candle, IExchangeInfoProvider moved from Algo to BusinessEntities 2024-08-18 19:01:54 +03:00
mikasoukhov 41c0a676e7 Fix commit 7f28b31c13 2024-06-22 14:29:46 +03:00
mikasoukhov b30bf966ec Fix commit 7f28b31c13 2024-06-22 14:04:27 +03:00
mikasoukhov 7f28b31c13 Samples re-org. 2024-06-22 13:45:38 +03:00