Skip to content

Commit

Permalink
statistic views fixes; mobile StatusViewSwitch fixes;
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin authored and Admin committed Dec 13, 2018
1 parent 62c7497 commit b47eb00
Show file tree
Hide file tree
Showing 97 changed files with 39 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionName="First" package="lazurite.lazurite" android:versionCode="219">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionName="First" package="lazurite.lazurite" android:versionCode="223">
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="26" />
<application android:label="Lazurite" android:icon="@drawable/splashscreen"></application>
<receiver android:name=".StartLazuriteServiceReceiver" android:enabled="true" android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ private void _changer_VolumeChanged(object sender, EventsArgs<int> args)
}
}

private bool IsNeedShowSearchButton()
{
return _model.AcceptedValues.Length > 15;
}

public StatusViewSwitch(SwitchScenarioModel scenarioModel) : this()
{
//megaCrutchCode
Expand All @@ -103,21 +108,29 @@ public StatusViewSwitch(SwitchScenarioModel scenarioModel) : this()

_currentVal = _model.ScenarioValue;

listView.ItemsSource = GetItemsSource();
listView.ItemsSource = _model.AcceptedValues; // Crutch to allocate listView height

if (_model.AcceptedValues.Length > 10)
if (IsNeedShowSearchButton())
{
tbSearch.Text = GetSearchCache(_model.Scenario.ScenarioId);
HandleSearch();

tbSearch.Completed += (o, e) => HandleSearch();

// HELL
bool initiateSearchHandled = false;
listView.SizeChanged += (o, e) => {
if (!initiateSearchHandled)
{
initiateSearchHandled = true;
if (!string.IsNullOrEmpty(tbSearch.Text))
HandleSearch();
}
};

btClearSearch.Click += (o, e) =>
{
tbSearch.Text = string.Empty;
SetSearchCache(_model.Scenario.ScenarioId, string.Empty);
btClearSearch.IsVisible = false;
listView.ItemsSource = GetItemsSource();
HandleSearch();
};

iconTitle.IsVisible = false;
Expand Down Expand Up @@ -204,6 +217,7 @@ private void HandleSearch()
{
SetSearchCache(_model.Scenario.ScenarioId, tbSearch.Text);
btClearSearch.IsVisible = !string.IsNullOrEmpty(tbSearch.Text);

listView.ItemsSource = GetItemsSource();
}

Expand Down
10 changes: 5 additions & 5 deletions Lazurite/LazuriteUI.Windows.Controls/ItemViewFast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static ItemViewFast()
}

private Button button;
private Label label;
private TextBlock tblock;

public ItemViewFast()
{
Expand All @@ -100,8 +100,8 @@ private void ApplyText()
.Replace("\n", string.Empty)
.ToString().Replace("_", "__"); // Сrutch for "mnemonic key using"
if (textWidth > ActualWidth)
label.Content = Text.Substring(0, (int)(ActualWidth / CharWidth) - 2) + "...";
else label.Content = Text;
tblock.Text = Text.Substring(0, (int)(ActualWidth / CharWidth) - 2) + "...";
else tblock.Text = Text;
}
}

Expand Down Expand Up @@ -159,7 +159,7 @@ private void InitializeComponent()

button.Template = EmptyButtonTemplate;

label = new Label()
tblock = new TextBlock()
{
IsHitTestVisible = false,
Background = Brushes.Transparent,
Expand All @@ -169,7 +169,7 @@ private void InitializeComponent()
Foreground = Visual.Foreground,
FontSize = Visual.FontSize
};
grid.Children.Add(label);
grid.Children.Add(tblock);

var ellipse = new Ellipse();
ellipse.Fill = Brushes.LightSlateGray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup>
<UICulture>ru-RU</UICulture>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.253.0")]
[assembly: AssemblyFileVersion("1.0.255.0")]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Lazurite.IOC;
using Lazurite.MainDomain;
using Lazurite.MainDomain.Statistics;
using Lazurite.Scenarios.ScenarioTypes;
using LazuriteUI.Windows.Controls;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -33,7 +34,7 @@ public StatisticsScenariosView()
var registrationInfo = StatisticsManager.GetRegistrationInfo(ScenariosRepository.Scenarios);
foreach (var scenario in ScenariosRepository.Scenarios)
{
var item = new StatisticsScenarioItemView(scenario, registrationInfo.IsRegistered(scenario.Id));
var item = new StatisticsScenarioItemView(scenario, registrationInfo.IsRegistered(scenario.Id) && (scenario.GetIsAvailable() || !(scenario is RemoteScenario)));
spItems.Children.Add(item);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ private void Refresh()
var items = ScenariosRepository
.Scenarios
.Where(x => registrationInfo.IsRegistered(x.Id))
.Where(x => registrationInfo.IsRegistered(x.Id) && (x.GetIsAvailable() || !(x is RemoteScenario)))
.Select(x => StatisticsManager.GetStatisticsInfoForScenario(x, SystemActionSource))
.SelectMany(x => StatisticsManager.GetItems(x, dateSince, dateTo, SystemActionSource))
.OrderByDescending(x => x.DateTime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Lazurite.IOC;
using Lazurite.MainDomain;
using Lazurite.MainDomain.Statistics;
using Lazurite.Scenarios.ScenarioTypes;
using LazuriteUI.Windows.Main.Statistics.Views.DiagramViewImplementation;

namespace LazuriteUI.Windows.Main.Statistics.Views
Expand Down Expand Up @@ -82,7 +83,7 @@ private void InitiateReload()
var registrationInfo = StatisticsManager
.GetRegistrationInfo(selectedScenarios);
var scenarios = selectedScenarios
.Where(x => registrationInfo.IsRegistered(x.Id))
.Where(x => registrationInfo.IsRegistered(x.Id) && (x.GetIsAvailable() || !(x is RemoteScenario)))
.ToArray();
_infos = scenarios.Select(x => StatisticsManager.GetStatisticsInfoForScenario(x, SystemActionSource)).ToArray();
NeedItems?.Invoke(new StatisticsFilter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Lazurite.IOC;
using Lazurite.MainDomain;
using Lazurite.MainDomain.Statistics;
using Lazurite.Scenarios.ScenarioTypes;
using Lazurite.Shared;
using LazuriteUI.Windows.Controls;
using System;
Expand Down Expand Up @@ -46,7 +47,7 @@ x.ValueType is InfoValueType ||

var registrationInfo = StatisticsManager.GetRegistrationInfo(targetScenarios);

targetScenarios = targetScenarios.Where(x => registrationInfo.IsRegistered(x.Id)).ToArray();
targetScenarios = targetScenarios.Where(x => registrationInfo.IsRegistered(x.Id) && (x.GetIsAvailable() || !(x is RemoteScenario))).ToArray();

foreach (var scenario in targetScenarios)
{
Expand Down
Loading

0 comments on commit b47eb00

Please sign in to comment.