Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Properties.Resources
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Globalization;
- using System.Resources;
- using System.Runtime.CompilerServices;
- namespace KairosPlanet.Properties
- {
- [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [DebuggerNonUserCode]
- [CompilerGenerated]
- public class Resources
- {
- private static ResourceManager resourceMan;
- private static CultureInfo resourceCulture;
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static ResourceManager ResourceManager
- {
- get
- {
- if (object.ReferenceEquals((object) Resources.resourceMan, (object) null))
- Resources.resourceMan = new ResourceManager("KairosPlanet.Properties.Resources", typeof (Resources).Assembly);
- return Resources.resourceMan;
- }
- }
- [EditorBrowsable(EditorBrowsableState.Advanced)]
- public static CultureInfo Culture
- {
- get
- {
- return Resources.resourceCulture;
- }
- set
- {
- Resources.resourceCulture = value;
- }
- }
- public static string ActivationError_TryReinstallModule
- {
- get
- {
- return Resources.ResourceManager.GetString("ActivationError_TryReinstallModule", Resources.resourceCulture);
- }
- }
- public static string Cancel
- {
- get
- {
- return Resources.ResourceManager.GetString("Cancel", Resources.resourceCulture);
- }
- }
- public static string ChangePasswordUC_ChangePasswordButtonContent
- {
- get
- {
- return Resources.ResourceManager.GetString("ChangePasswordUC_ChangePasswordButtonContent", Resources.resourceCulture);
- }
- }
- public static string ChangePasswordUC_ConfirmNewPasswordTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ChangePasswordUC_ConfirmNewPasswordTitle", Resources.resourceCulture);
- }
- }
- public static string ChangePasswordUC_CurrentPasswordTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ChangePasswordUC_CurrentPasswordTitle", Resources.resourceCulture);
- }
- }
- public static string ChangePasswordUC_NewPasswordTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ChangePasswordUC_NewPasswordTitle", Resources.resourceCulture);
- }
- }
- public static string ChangePasswordUC_Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ChangePasswordUC_Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_AddressTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_AddressTitle", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_CityTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_CityTitle", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_Email1Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_Email1Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_Email2Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_Email2Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_Telephone1Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_Telephone1Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_Telephone2Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_Telephone2Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_Title
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_Title", Resources.resourceCulture);
- }
- }
- public static string ContactInformationUC_ZipCodeTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("ContactInformationUC_ZipCodeTitle", Resources.resourceCulture);
- }
- }
- public static string Error
- {
- get
- {
- return Resources.ResourceManager.GetString("Error", Resources.resourceCulture);
- }
- }
- public static string Error_ConfirmNewPasswordIsEmpty
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_ConfirmNewPasswordIsEmpty", Resources.resourceCulture);
- }
- }
- public static string Error_ConnectionError
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_ConnectionError", Resources.resourceCulture);
- }
- }
- public static string Error_EmailIsEmpty
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_EmailIsEmpty", Resources.resourceCulture);
- }
- }
- public static string Error_EnterCurrentPasswordToChange
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_EnterCurrentPasswordToChange", Resources.resourceCulture);
- }
- }
- public static string Error_NewPasswordIsEmpty
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_NewPasswordIsEmpty", Resources.resourceCulture);
- }
- }
- public static string Error_PasswordIsEmpty
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_PasswordIsEmpty", Resources.resourceCulture);
- }
- }
- public static string Error_PasswordOrEmailInvalid
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_PasswordOrEmailInvalid", Resources.resourceCulture);
- }
- }
- public static string Error_PasswordsNotIdentical
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_PasswordsNotIdentical", Resources.resourceCulture);
- }
- }
- public static string Error_ServerReturnIncorrectData
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_ServerReturnIncorrectData", Resources.resourceCulture);
- }
- }
- public static string Error_UserDeletedError
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_UserDeletedError", Resources.resourceCulture);
- }
- }
- public static string Error_UserPasswordIncorrect
- {
- get
- {
- return Resources.ResourceManager.GetString("Error_UserPasswordIncorrect", Resources.resourceCulture);
- }
- }
- public static string FemaleGender
- {
- get
- {
- return Resources.ResourceManager.GetString("FemaleGender", Resources.resourceCulture);
- }
- }
- public static string InformationNotSpecified
- {
- get
- {
- return Resources.ResourceManager.GetString("InformationNotSpecified", Resources.resourceCulture);
- }
- }
- public static string LoginUC_AutoLoginTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("LoginUC_AutoLoginTitle", Resources.resourceCulture);
- }
- }
- public static string LoginUC_LoginBtn
- {
- get
- {
- return Resources.ResourceManager.GetString("LoginUC_LoginBtn", Resources.resourceCulture);
- }
- }
- public static string LoginUC_RecoverPasswordHyperLink
- {
- get
- {
- return Resources.ResourceManager.GetString("LoginUC_RecoverPasswordHyperLink", Resources.resourceCulture);
- }
- }
- public static string LoginUC_RegisterBtn
- {
- get
- {
- return Resources.ResourceManager.GetString("LoginUC_RegisterBtn", Resources.resourceCulture);
- }
- }
- public static string MainMenu_Profile
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_Profile", Resources.resourceCulture);
- }
- }
- public static string MainMenu_ProfileContact
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_ProfileContact", Resources.resourceCulture);
- }
- }
- public static string MainMenu_ProfilePassword
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_ProfilePassword", Resources.resourceCulture);
- }
- }
- public static string MainMenu_ProfilePersonal
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_ProfilePersonal", Resources.resourceCulture);
- }
- }
- public static string MainMenu_ServiceCategories
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_ServiceCategories", Resources.resourceCulture);
- }
- }
- public static string MainMenu_Services
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_Services", Resources.resourceCulture);
- }
- }
- public static string MainMenu_SessionHistory
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_SessionHistory", Resources.resourceCulture);
- }
- }
- public static string MainMenu_Settings
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_Settings", Resources.resourceCulture);
- }
- }
- public static string MainMenu_Statistics
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_Statistics", Resources.resourceCulture);
- }
- }
- public static string MainMenu_StatisticsSummary
- {
- get
- {
- return Resources.ResourceManager.GetString("MainMenu_StatisticsSummary", Resources.resourceCulture);
- }
- }
- public static string MainWindow_Exit
- {
- get
- {
- return Resources.ResourceManager.GetString("MainWindow_Exit", Resources.resourceCulture);
- }
- }
- public static string MainWindow_LogOut
- {
- get
- {
- return Resources.ResourceManager.GetString("MainWindow_LogOut", Resources.resourceCulture);
- }
- }
- public static string MainWindow_Open
- {
- get
- {
- return Resources.ResourceManager.GetString("MainWindow_Open", Resources.resourceCulture);
- }
- }
- public static string MaleGender
- {
- get
- {
- return Resources.ResourceManager.GetString("MaleGender", Resources.resourceCulture);
- }
- }
- public static string Message_NewPackageIsAvailable
- {
- get
- {
- return Resources.ResourceManager.GetString("Message_NewPackageIsAvailable", Resources.resourceCulture);
- }
- }
- public static string NetworkState_None
- {
- get
- {
- return Resources.ResourceManager.GetString("NetworkState_None", Resources.resourceCulture);
- }
- }
- public static string NetworkState_Offline
- {
- get
- {
- return Resources.ResourceManager.GetString("NetworkState_Offline", Resources.resourceCulture);
- }
- }
- public static string NetworkState_Online
- {
- get
- {
- return Resources.ResourceManager.GetString("NetworkState_Online", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_BirthDateTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_BirthDateTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_CountryTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_CountryTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_CreationDateTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_CreationDateTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_EmailTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_EmailTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_GenderTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_GenderTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_NameTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_NameTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_TelephoneTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_TelephoneTitle", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_Title
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_Title", Resources.resourceCulture);
- }
- }
- public static string PersonalInformationUC_UserStatusTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("PersonalInformationUC_UserStatusTitle", Resources.resourceCulture);
- }
- }
- public static string Refresh_NewPackage
- {
- get
- {
- return Resources.ResourceManager.GetString("Refresh_NewPackage", Resources.resourceCulture);
- }
- }
- public static string Save
- {
- get
- {
- return Resources.ResourceManager.GetString("Save", Resources.resourceCulture);
- }
- }
- public static string SaveEditButton_Edit
- {
- get
- {
- return Resources.ResourceManager.GetString("SaveEditButton_Edit", Resources.resourceCulture);
- }
- }
- public static string SaveEditButton_Save
- {
- get
- {
- return Resources.ResourceManager.GetString("SaveEditButton_Save", Resources.resourceCulture);
- }
- }
- public static string ScreenManager_ModuleInstalled
- {
- get
- {
- return Resources.ResourceManager.GetString("ScreenManager_ModuleInstalled", Resources.resourceCulture);
- }
- }
- public static string ScreenManager_Success
- {
- get
- {
- return Resources.ResourceManager.GetString("ScreenManager_Success", Resources.resourceCulture);
- }
- }
- public static string ServicesUC_BackHyperLink
- {
- get
- {
- return Resources.ResourceManager.GetString("ServicesUC_BackHyperLink", Resources.resourceCulture);
- }
- }
- public static string ServicesVM_ProductDescriptionFileName
- {
- get
- {
- return Resources.ResourceManager.GetString("ServicesVM_ProductDescriptionFileName", Resources.resourceCulture);
- }
- }
- public static string ServiceVM_Activate
- {
- get
- {
- return Resources.ResourceManager.GetString("ServiceVM_Activate", Resources.resourceCulture);
- }
- }
- public static string ServiceVM_Buy
- {
- get
- {
- return Resources.ResourceManager.GetString("ServiceVM_Buy", Resources.resourceCulture);
- }
- }
- public static string ServiceVM_Details
- {
- get
- {
- return Resources.ResourceManager.GetString("ServiceVM_Details", Resources.resourceCulture);
- }
- }
- public static string ServiceVM_Install
- {
- get
- {
- return Resources.ResourceManager.GetString("ServiceVM_Install", Resources.resourceCulture);
- }
- }
- public static string ServiceVM_Order
- {
- get
- {
- return Resources.ResourceManager.GetString("ServiceVM_Order", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_Date
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_Date", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_DateAxis
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_DateAxis", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_Duration
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_Duration", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_DurationAxis
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_DurationAxis", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_EmtyChartMessage
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_EmtyChartMessage", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_EndTime
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_EndTime", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_PeriodFrom
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_PeriodFrom", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_PeriodTo
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_PeriodTo", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_SessionHistory
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_SessionHistory", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_ShowPeriod
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_ShowPeriod", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_StartTime
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_StartTime", Resources.resourceCulture);
- }
- }
- public static string SessionHistoryUC_Total
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionHistoryUC_Total", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_CurrentMonthTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_CurrentMonthTitle", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_CurrentSessionNonActive
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_CurrentSessionNonActive", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_CurrentSessionTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_CurrentSessionTitle", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_LastMonthTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_LastMonthTitle", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_RetrievingDataFromServerText
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_RetrievingDataFromServerText", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_TimeLeftToEarnMoney
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_TimeLeftToEarnMoney", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_TimeOnline
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_TimeOnline", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_Title
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_Title", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_TodayTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_TodayTitle", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_TotalTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_TotalTitle", Resources.resourceCulture);
- }
- }
- public static string SessionStatisticsUC_YesterdayTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SessionStatisticsUC_YesterdayTitle", Resources.resourceCulture);
- }
- }
- public static string Settings
- {
- get
- {
- return Resources.ResourceManager.GetString("Settings", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_ConnectionMethod_Title
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_ConnectionMethod_Title", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_ICMPUsed
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_ICMPUsed", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_IsAutoLoginTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_IsAutoLoginTitle", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_IsHttpiPingUsed_Inner
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_IsHttpiPingUsed_Inner", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_LanguageSelectedText
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_LanguageSelectedText", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_LanguageTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_LanguageTitle", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_RestartNow
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_RestartNow", Resources.resourceCulture);
- }
- }
- public static string SettingsUC_RunOnStartUpTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("SettingsUC_RunOnStartUpTitle", Resources.resourceCulture);
- }
- }
- public static string StatusMessage_CanNotLoadServices
- {
- get
- {
- return Resources.ResourceManager.GetString("StatusMessage_CanNotLoadServices", Resources.resourceCulture);
- }
- }
- public static string StatusMessage_IsRefreshing
- {
- get
- {
- return Resources.ResourceManager.GetString("StatusMessage_IsRefreshing", Resources.resourceCulture);
- }
- }
- public static string StatusMessage_NoNewPurchases
- {
- get
- {
- return Resources.ResourceManager.GetString("StatusMessage_NoNewPurchases", Resources.resourceCulture);
- }
- }
- public static string StatusMessage_ServicesLoading
- {
- get
- {
- return Resources.ResourceManager.GetString("StatusMessage_ServicesLoading", Resources.resourceCulture);
- }
- }
- public static string StatusMessage_TryActivateKeyRefresh
- {
- get
- {
- return Resources.ResourceManager.GetString("StatusMessage_TryActivateKeyRefresh", Resources.resourceCulture);
- }
- }
- public static string Tray_LogIn
- {
- get
- {
- return Resources.ResourceManager.GetString("Tray_LogIn", Resources.resourceCulture);
- }
- }
- public static string Tray_LogOut
- {
- get
- {
- return Resources.ResourceManager.GetString("Tray_LogOut", Resources.resourceCulture);
- }
- }
- public static string Tray_ModuleCrashOrNotFoundMainFiledMessage
- {
- get
- {
- return Resources.ResourceManager.GetString("Tray_ModuleCrashOrNotFoundMainFiledMessage", Resources.resourceCulture);
- }
- }
- public static string Tray_ModuleNotInstalledMessage
- {
- get
- {
- return Resources.ResourceManager.GetString("Tray_ModuleNotInstalledMessage", Resources.resourceCulture);
- }
- }
- public static string Tray_NotificationTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("Tray_NotificationTitle", Resources.resourceCulture);
- }
- }
- public static string User_EmailTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("User_EmailTitle", Resources.resourceCulture);
- }
- }
- public static string User_PasswordTitle
- {
- get
- {
- return Resources.ResourceManager.GetString("User_PasswordTitle", Resources.resourceCulture);
- }
- }
- public static string VersionUC_CurrentVersionCaption
- {
- get
- {
- return Resources.ResourceManager.GetString("VersionUC_CurrentVersionCaption", Resources.resourceCulture);
- }
- }
- public static string VersionUC_DownloadNewAppVersion
- {
- get
- {
- return Resources.ResourceManager.GetString("VersionUC_DownloadNewAppVersion", Resources.resourceCulture);
- }
- }
- public static string VersionUC_LinkToSiteText
- {
- get
- {
- return Resources.ResourceManager.GetString("VersionUC_LinkToSiteText", Resources.resourceCulture);
- }
- }
- public static string VersionUC_NewVersionCaption
- {
- get
- {
- return Resources.ResourceManager.GetString("VersionUC_NewVersionCaption", Resources.resourceCulture);
- }
- }
- public static string VersionUC_NewVersionIsAvailable
- {
- get
- {
- return Resources.ResourceManager.GetString("VersionUC_NewVersionIsAvailable", Resources.resourceCulture);
- }
- }
- internal Resources()
- {
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Properties.Settings
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.CodeDom.Compiler;
- using System.Configuration;
- using System.Runtime.CompilerServices;
- namespace KairosPlanet.Properties
- {
- [GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
- [CompilerGenerated]
- internal sealed class Settings : ApplicationSettingsBase
- {
- private static Settings defaultInstance = (Settings) SettingsBase.Synchronized((SettingsBase) new Settings());
- public static Settings Default
- {
- get
- {
- return Settings.defaultInstance;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.ModuleErrorState
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace KairosPlanet
- {
- internal enum ModuleErrorState
- {
- NoError,
- CrashOrNotFoundMainFile,
- ModuleNotInstalledMessage,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Data.PurchaseManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers.Interfaces;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using WinApp.Data.Model;
- using WinApp.Managers.Interfaces;
- using WinApp.Module;
- using WinApp.Service.Repository.Interface;
- namespace KairosPlanet.Managers.Data
- {
- public class PurchaseManager : IPurchaseManager
- {
- private ObservableCollection<Purchase> _currentPurchases;
- private bool _needUpdate;
- public ObservableCollection<Purchase> Purchases
- {
- get
- {
- if (this._currentPurchases == null)
- this._currentPurchases = new ObservableCollection<Purchase>();
- if (this._needUpdate)
- this.UpdatePurchases();
- return this._currentPurchases;
- }
- }
- public PurchaseManager()
- {
- this._needUpdate = true;
- }
- public void UpdatePurchases()
- {
- Purchase[] purchases = Map.Get<ISessionManager>().GetPurchases();
- if (purchases == null)
- {
- Logger.WriteWarning((object) this, "UpdatePurchases()", "Purchases is not loaded");
- }
- else
- {
- this._needUpdate = false;
- Logger.WriteInfo((object) this, "UpdatePurchases()", "Loaded purchases count: " + (object) purchases.Length);
- List<Purchase> list = Enumerable.ToList<Purchase>((IEnumerable<Purchase>) purchases);
- int count = list.Count;
- foreach (Purchase purchase in list)
- Logger.WriteInfo((object) this, "UpdatePurchases", string.Format("UpdatePurchases(): purchase: ProductId='{0}', PackageStatus='{1}', Status='{2}'", (object) purchase.ProductId, (object) purchase.PackageStatus, (object) purchase.Status));
- foreach (Purchase purchase in list)
- {
- if (!this.Purchases.Contains(purchase))
- this.Purchases.Add(purchase);
- else
- this.Purchases[this.Purchases.IndexOf(purchase)] = purchase;
- }
- }
- }
- [Obsolete]
- public Purchase[] GetNewPurchases()
- {
- Purchase[] purchases = Map.Get<ISessionManager>().GetPurchases();
- if (purchases == null)
- {
- Logger.WriteWarning((object) this, "GetNewPurchases()", "Purchases is not loaded");
- return (Purchase[]) null;
- }
- Logger.WriteInfo((object) this, "GetNewPurchases()", "Loaded purchases count: " + (object) purchases.Length);
- Purchase[] purchaseArray = Enumerable.ToArray<Purchase>(Enumerable.Where<Purchase>((IEnumerable<Purchase>) purchases, (Func<Purchase, bool>) (x => !this.Purchases.Contains(x))));
- if (purchaseArray.Length <= 0)
- return new Purchase[0];
- return purchaseArray;
- }
- public bool ActivateModule(Purchase purchase)
- {
- try
- {
- if (purchase == null)
- {
- Logger.WriteError((object) this, "ActivateInstalledModule", "Exit from action of activation: purchase is null");
- return false;
- }
- Logger.WriteInfo((object) this, "ActivateInstalledModule", "Start action of activation");
- IModuleResolver moduleResolver = Map.Get<IModuleResolver>();
- ModuleInfo moduleInfo = Map.Get<IModuleResolver>().GetModuleInfo(purchase.ProductId);
- IModuleManager moduleManager = moduleResolver.GetModuleManager(moduleInfo);
- if (moduleManager == null)
- {
- Logger.WriteError((object) this, "ActivateInstalledModule", "Exit from action of activation: module manager is empty");
- return false;
- }
- Module moduleByProductId = Map.Get<IModuleRepository>().GetModuleByProductId(purchase.ProductId);
- if (moduleByProductId.StateEnum != ModuleState.Installed && moduleByProductId.StateEnum != ModuleState.InstalledAndActivated)
- {
- Logger.WriteError((object) this, "ActivateInstalledModule", "Exit from action of activation: install for module not executed");
- return false;
- }
- Logger.WriteInfo((object) this, "ActivateInstalledModule", "Start activation on server");
- string str = Map.Get<ISessionManager>().Activation(purchase.Id);
- if (string.IsNullOrEmpty(str))
- {
- Logger.WriteError((object) this, "ActivateInstalledModule", "Exit from action of activation: security key is not received");
- Map.Get<IScreenManager>().ShowStatusMessage(Resources.ActivationError_TryReinstallModule, 5, false);
- return false;
- }
- moduleManager.SetSecurityKey(str, purchase.ProductId, purchase.Id, (IModuleCallback) moduleResolver);
- Logger.WriteInfo((object) this, "ActivateInstalledModule", "Activation on server executed");
- moduleByProductId.StateEnum = ModuleState.InstalledAndActivated;
- Map.Get<IModuleRepository>().Save(moduleByProductId);
- Logger.WriteInfo((object) this, "ActivateInstalledModule", string.Format(Resources.ScreenManager_ModuleInstalled, (object) purchase.ProductId));
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "ModuleInstalled", "Activate module after install for product with Id = '" + (object) purchase.ProductId + "' error:", ex);
- throw;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.StatisticManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using IncMap;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using WinApp.Api.Data;
- using WinApp.Managers.Interfaces;
- namespace KairosPlanet.Managers
- {
- public class StatisticManager
- {
- private static object _lockObject = new object();
- private int _refreshStatisticminutsInterval = 10;
- private static StatisticManager _instance;
- private Statistic[] _cachedStatistics;
- private DateTime? _gettedStatisticsDate;
- public static StatisticManager Instance
- {
- get
- {
- if (StatisticManager._instance == null)
- {
- lock (StatisticManager._lockObject)
- {
- if (StatisticManager._instance == null)
- StatisticManager._instance = new StatisticManager();
- }
- }
- return StatisticManager._instance;
- }
- }
- private StatisticManager()
- {
- }
- public void SetNeedRefreshStatistics()
- {
- lock (StatisticManager._lockObject)
- {
- this._cachedStatistics = (Statistic[]) null;
- this._gettedStatisticsDate = new DateTime?();
- }
- }
- public Statistic[] GetStatistics()
- {
- if (!this._gettedStatisticsDate.HasValue || this._gettedStatisticsDate.Value.Subtract(DateTime.Now).Minutes > this._refreshStatisticminutsInterval)
- {
- lock (StatisticManager._lockObject)
- {
- if (this._gettedStatisticsDate.HasValue)
- {
- if (this._gettedStatisticsDate.Value.Subtract(DateTime.Now).Minutes <= this._refreshStatisticminutsInterval)
- goto label_6;
- }
- this._cachedStatistics = Map.Get<ISessionManager>().GetStatistics();
- this._gettedStatisticsDate = this._cachedStatistics == null ? new DateTime?() : new DateTime?(DateTime.Now);
- }
- }
- label_6:
- return this._cachedStatistics;
- }
- public Statistic[] GetStatistics(DateTime periodStart, DateTime periodEnd)
- {
- return Enumerable.ToArray<Statistic>(Enumerable.Where<Statistic>((IEnumerable<Statistic>) this.GetStatistics(), (Func<Statistic, bool>) (s =>
- {
- if (s.CreatedDate >= periodStart)
- return s.CreatedDate.AddSeconds((double) s.Lifetime) <= periodEnd;
- return false;
- })));
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Interfaces.IPurchaseManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Collections.ObjectModel;
- using WinApp.Data.Model;
- namespace KairosPlanet.Managers.Interfaces
- {
- internal interface IPurchaseManager
- {
- ObservableCollection<Purchase> Purchases { get; }
- void UpdatePurchases();
- [Obsolete]
- Purchase[] GetNewPurchases();
- bool ActivateModule(Purchase purchase);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Network.SessionMonitor
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet;
- using KairosPlanet.Managers.Interfaces;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Timers;
- using WinApp;
- using WinApp.Api;
- using WinApp.Api.Data;
- using WinApp.Data.Model;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Network;
- using WinApp.Service.Repository.Interface;
- using WinApp.Tray.RichNotifyIcon;
- using WinApp.ViewModel;
- namespace KairosPlanet.Managers.Network
- {
- public class SessionMonitor
- {
- private static SessionMonitor _instance = new SessionMonitor();
- private static bool _showedTrayMessage = false;
- private SessionState _sessionState;
- private Timer _sessionMonitorTimer;
- private string _activeModuleSecureKey;
- private bool _secondAttempt;
- public static SessionMonitor Instance
- {
- get
- {
- return SessionMonitor._instance;
- }
- }
- public PingResponse FirstSessionPing { get; set; }
- internal SessionState SessionState
- {
- get
- {
- return this._sessionState;
- }
- private set
- {
- if (this._sessionState == value)
- return;
- this._sessionState = value;
- Logger.WriteInfo((object) this, "SessionState", "SessionState changed status on '" + (object) this._sessionState + "'");
- if (this.SessionStateChanged == null)
- return;
- this.SessionStateChanged((object) this, new SessionStateEventArgs(value));
- }
- }
- internal event EventHandler<SessionStateEventArgs> SessionStateChanged;
- internal event SessionMonitor.PingEventHandler PingEvent;
- private SessionMonitor()
- {
- }
- public bool PingSession()
- {
- try
- {
- PingResponse pingResponse = Map.Get<ISessionManager>().PingSession(this._activeModuleSecureKey);
- if (pingResponse != null)
- this.InvokePingEvent(pingResponse.Lifetime);
- if (pingResponse != null)
- this.FirstSessionPing = pingResponse;
- return pingResponse != null;
- }
- catch (ApiException ex)
- {
- if (string.Equals(ex.StatusDescription, "Secret key not found"))
- this.TryGetNewSecureKey();
- else
- Logger.WriteError((object) this, "PingSession()", "Error during operation Ping on SessionMonitor", (Exception) ex);
- return false;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "PingSession()", "Error during operation Ping on SessionMonitor", ex);
- return false;
- }
- }
- public void InvokePingEvent(long lifeTime)
- {
- if (this.PingEvent == null)
- return;
- this.PingEvent((object) this, new PingEventArgs(lifeTime));
- }
- internal void SetSessionStateToLogon()
- {
- NetworkMonitor.NetworkStateChanged -= new EventHandler<NetworkStateEventArgs>(this.OnNetworkStateChanged);
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.OnNetworkStateChanged);
- if (Map.Get<ISessionManager>().CurrentUser != null)
- {
- this.SessionState = SessionState.LogOn;
- this.TryChangeStateToAccrual();
- }
- else
- {
- Logger.WriteInfo((object) this, "SetSessionStateToLogon()", "??????? ?????? ?? ???? ??????? ? ????????? LogOn, ??? ??? ???????????? ???????????");
- this.SessionState = SessionState.LogOff;
- }
- }
- internal void SetSessionStateToSuspended()
- {
- this.SessionState = SessionState.Suspended;
- NetworkMonitor.CheckServerOn(true);
- }
- private static bool GetPackageModuleIsActive()
- {
- if (!AppVM.Instance.ActivePackageId.HasValue)
- return false;
- Module moduleByProductId = Map.Get<IModuleRepository>().GetModuleByProductId(AppVM.Instance.ActivePackageId.Value);
- return moduleByProductId != null && moduleByProductId.StateEnum == ModuleState.InstalledAndActivated;
- }
- private void TryChangeStateToAccrual()
- {
- if (!AppVM.Instance.ActivePackageId.HasValue || AppVM.Instance.ActivePackageId.Value == 0L)
- {
- Logger.WriteWarning((object) this, "CheckActivePackageToAccrual", "??????? ??? ??????????? ?????????? ?? ???????????. ??? ????????? ??????.");
- AppVM.Instance.ModuleErrorState = ModuleErrorState.ModuleNotInstalledMessage;
- if (SessionMonitor._showedTrayMessage)
- return;
- ((TaskbarIcon) Map.Get<IAppTray>()).ShowBalloonTip(Resources.Tray_NotificationTitle, Resources.Tray_ModuleNotInstalledMessage, BalloonIcon.Info);
- SessionMonitor._showedTrayMessage = true;
- }
- else
- {
- this.SessionState = SessionState.Suspended;
- if (!SessionMonitor.GetPackageModuleIsActive())
- {
- Logger.WriteError((object) this, "CheckActivePackageToAccrual", "Ping not execute. The package module is not active or not installed");
- AppVM.Instance.ModuleErrorState = ModuleErrorState.ModuleNotInstalledMessage;
- if (SessionMonitor._showedTrayMessage)
- return;
- ((TaskbarIcon) Map.Get<IAppTray>()).ShowBalloonTip(Resources.Tray_NotificationTitle, Resources.Tray_ModuleNotInstalledMessage, BalloonIcon.Info);
- SessionMonitor._showedTrayMessage = true;
- }
- else
- {
- this._activeModuleSecureKey = Map.Get<IModuleResolver>().GetActiveModuleSecureKey();
- if (string.IsNullOrEmpty(this._activeModuleSecureKey))
- {
- Logger.WriteError((object) this, "CheckActivePackageToAccrual", "Ping not execute. The secure key not exists");
- AppVM.Instance.ModuleErrorState = ModuleErrorState.CrashOrNotFoundMainFile;
- if (SessionMonitor._showedTrayMessage)
- return;
- ((TaskbarIcon) Map.Get<IAppTray>()).ShowBalloonTip(Resources.Tray_NotificationTitle, Resources.Tray_ModuleCrashOrNotFoundMainFiledMessage, BalloonIcon.Info);
- SessionMonitor._showedTrayMessage = true;
- }
- else
- {
- AppVM.Instance.ModuleErrorState = ModuleErrorState.NoError;
- this.CheckSessionPing();
- }
- }
- }
- }
- private bool TryGetNewSecureKey()
- {
- if (!AppVM.Instance.ActivePackageId.HasValue)
- return false;
- try
- {
- long productId = AppVM.Instance.ActivePackageId.Value;
- IScreenManager screenManager = Map.Get<IScreenManager>();
- screenManager.DoVisualSafe(screenManager.ShowStatusMessage(Resources.StatusMessage_TryActivateKeyRefresh, 5, false));
- Logger.WriteInfo((object) this, "TryGetNewSecureKey", "??????? ????????? ?????? ????? ????????? ?? ???????? ? ID = " + (object) productId);
- DateTime? lastTime = Enumerable.Max<Purchase, DateTime?>(Enumerable.Where<Purchase>((IEnumerable<Purchase>) Map.Get<IPurchaseManager>().Purchases, (Func<Purchase, bool>) (x => x.ProductId == productId)), (Func<Purchase, DateTime?>) (x => x.Date));
- if (Map.Get<IPurchaseManager>().ActivateModule(Enumerable.SingleOrDefault<Purchase>((IEnumerable<Purchase>) Map.Get<IPurchaseManager>().Purchases, (Func<Purchase, bool>) (x =>
- {
- if (x.ProductId != productId)
- return false;
- DateTime? date = x.Date;
- DateTime? nullable = lastTime;
- if (date.HasValue != nullable.HasValue)
- return false;
- if (date.HasValue)
- return date.GetValueOrDefault() == nullable.GetValueOrDefault();
- return true;
- }))))
- {
- this._activeModuleSecureKey = Map.Get<IModuleResolver>().GetActiveModuleSecureKey();
- return true;
- }
- Logger.WriteError((object) this, "CheckActivePackageToAccrual", "Ping not execute. The secure key not exists");
- AppVM.Instance.ModuleErrorState = ModuleErrorState.CrashOrNotFoundMainFile;
- if (!SessionMonitor._showedTrayMessage)
- {
- ((TaskbarIcon) Map.Get<IAppTray>()).ShowBalloonTip(Resources.Tray_NotificationTitle, Resources.Tray_ModuleCrashOrNotFoundMainFiledMessage, BalloonIcon.Info);
- SessionMonitor._showedTrayMessage = true;
- }
- return false;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "TryGetNewSecureKey", "?????? ??? ?????????? ????? ?????????: " + ex.Message);
- return false;
- }
- }
- private void CheckSessionPing()
- {
- bool flag = false;
- if (this.PingSession())
- {
- this._secondAttempt = false;
- flag = this.SessionState != SessionState.InAccrual;
- this.SessionState = SessionState.InAccrual;
- NetworkMonitor.CheckServerOff();
- }
- else if (this._secondAttempt)
- this.SetSessionStateToSuspended();
- else
- this._secondAttempt = true;
- this.StartSessionMonitorTimer(this._secondAttempt || flag);
- }
- private void StartSessionMonitorTimer(bool shortInterval)
- {
- if (this._sessionMonitorTimer == null)
- {
- this._sessionMonitorTimer = new Timer(30000.0);
- this._sessionMonitorTimer.Elapsed += new ElapsedEventHandler(this.OnSessionMonitorTimerTick);
- Logger.WriteInfo(typeof (NetworkMonitor), "StartSessionMonitorTimer()", "??????? ?????? ????? ??????");
- }
- else
- this._sessionMonitorTimer.Interval = shortInterval ? 30000.0 : 180000.0;
- this._sessionMonitorTimer.Start();
- }
- private void OnSessionMonitorTimerTick(object sender, ElapsedEventArgs e)
- {
- this._sessionMonitorTimer.Stop();
- this.CheckSessionPing();
- }
- private void OnNetworkStateChanged(object sender, NetworkStateEventArgs e)
- {
- if (e.State != NetworkState.ServerOnline)
- return;
- Logger.WriteInfo((object) this, "OnNetworkStateChanged()", "???? ? ?????? Online");
- this.SetSessionStateToLogon();
- }
- public delegate void PingEventHandler(object sender, PingEventArgs e);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Network.SessionState
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace KairosPlanet.Managers.Network
- {
- internal enum SessionState
- {
- LogOff,
- LogOn,
- Suspended,
- InAccrual,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Network.SessionStateEventArgs
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- namespace KairosPlanet.Managers.Network
- {
- internal class SessionStateEventArgs : EventArgs
- {
- public SessionState State { get; private set; }
- public SessionStateEventArgs(SessionState state)
- {
- this.State = state;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.Managers.Localization.UnifyCultureInfo
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Globalization;
- namespace KairosPlanet.Managers.Localization
- {
- public class UnifyCultureInfo : CultureInfo
- {
- public override DateTimeFormatInfo DateTimeFormat
- {
- get
- {
- DateTimeFormatInfo dateTimeFormat = base.DateTimeFormat;
- dateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
- return dateTimeFormat;
- }
- set
- {
- base.DateTimeFormat = value;
- }
- }
- public UnifyCultureInfo(string name)
- : base(name)
- {
- }
- public UnifyCultureInfo(string name, bool useUserOverride)
- : base(name, useUserOverride)
- {
- }
- public UnifyCultureInfo(int culture)
- : base(culture)
- {
- }
- public UnifyCultureInfo(int culture, bool useUserOverride)
- : base(culture, useUserOverride)
- {
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.ViewModel.Services.RtfReplaseser
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Collections.Generic;
- using System.Text;
- namespace KairosPlanet.ViewModel.Services
- {
- public class RtfReplaseser
- {
- private static string _open = "<%";
- private static string _close = "%>";
- private bool _pasteSpase = true;
- private string _inStr;
- private StringBuilder _outStr;
- private Dictionary<string, string> _dictionary;
- private RtfReplaseser()
- {
- }
- public static string Replase(string text, Dictionary<string, string> dictionary)
- {
- return new RtfReplaseser().OnReplase(text, dictionary);
- }
- private void Replace()
- {
- string str = string.Empty;
- string key = string.Empty;
- bool flag = false;
- int index = 0;
- this._outStr = new StringBuilder();
- foreach (char ch in this._inStr)
- {
- if (!flag)
- {
- str += (string) (object) ch;
- key += (string) (object) ch;
- if ((int) RtfReplaseser._open[index] == (int) ch)
- {
- ++index;
- if (RtfReplaseser._open.Length == index)
- {
- flag = true;
- str = string.Empty;
- index = 0;
- }
- }
- else
- {
- this._outStr.Append(key);
- index = 0;
- str = key = string.Empty;
- }
- }
- else
- {
- str += (string) (object) ch;
- key += (string) (object) ch;
- if ((int) ch == 32)
- {
- this._outStr.Append(key);
- index = 0;
- str = key = string.Empty;
- flag = false;
- }
- if ((int) RtfReplaseser._close[index] == (int) ch)
- {
- ++index;
- if (RtfReplaseser._close.Length == index)
- {
- if (this._dictionary.ContainsKey(key))
- this._outStr.Append(this._dictionary[key]);
- else if (!this._pasteSpase)
- this._outStr.Append(key);
- str = key = string.Empty;
- index = 0;
- flag = false;
- }
- }
- }
- }
- }
- private string OnReplase(string text, Dictionary<string, string> dictionary)
- {
- this._inStr = text;
- this._dictionary = dictionary;
- this.Replace();
- return this._outStr.ToString();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.AppTray
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Drawing;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.Managers.Interfaces;
- using WinApp.Tray.RichNotifyIcon;
- using WinApp.ViewModel.Tray;
- namespace WinApp.View
- {
- internal class AppTray : TaskbarIcon, IAppTray, IComponentConnector
- {
- private readonly AppTrayVM _viewModel;
- private bool _contentLoaded;
- public UIElement Tray
- {
- get
- {
- return (UIElement) this;
- }
- }
- public AppTray()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this._viewModel = new AppTrayVM()
- {
- NoLoginContextMenu = (ContextMenu) this.Resources[(object) "NoLoginContextMenu"],
- FullContextMenu = (ContextMenu) this.Resources[(object) "FullContextMenu"]
- });
- }
- ~AppTray()
- {
- this.Visibility = Visibility.Collapsed;
- this.Icon = (Icon) null;
- this.Dispose();
- }
- public void Refresh()
- {
- this._viewModel.Refresh();
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/apptray.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, (object) this, handler);
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Base.IWindowArrangeView
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Windows;
- namespace WinApp.View.Base
- {
- public interface IWindowArrangeView
- {
- double WindowHeight { get; }
- double WindowWidth { get; }
- ResizeMode ResizeMode { get; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Base.WindowCommon
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Media;
- using Telerik.Windows.Controls;
- namespace WinApp.View.Base
- {
- internal class WindowCommon : RadWindow
- {
- public static readonly DependencyProperty TaskbarIconProperty = DependencyProperty.Register("TaskbarIcon", typeof (ImageSource), typeof (WindowCommon), new PropertyMetadata((object) null));
- private Window _parentWindow;
- public ImageSource TaskbarIcon
- {
- get
- {
- return (ImageSource) ((DependencyObject) this).GetValue(WindowCommon.TaskbarIconProperty);
- }
- set
- {
- ((DependencyObject) this).SetValue(WindowCommon.TaskbarIconProperty, (object) value);
- }
- }
- public Window ParentWindow
- {
- get
- {
- if (this._parentWindow == null)
- {
- this._parentWindow = (Window) ParentOfTypeExtensions.ParentOfType<Window>((DependencyObject) this);
- if (this._parentWindow == null)
- return (Window) null;
- this._parentWindow.SetBinding(FrameworkElement.DataContextProperty, (BindingBase) new Binding("DataContext")
- {
- Source = (object) this
- });
- BindingExpression bindingExpression = ((FrameworkElement) this).GetBindingExpression(HeaderedContentControl.HeaderProperty);
- if (bindingExpression != null)
- this._parentWindow.SetBinding(Window.TitleProperty, (BindingBase) bindingExpression.ParentBinding);
- else
- this._parentWindow.SetValue(Window.TitleProperty, ((HeaderedContentControl) this).Header);
- this._parentWindow.SetBinding(Window.IconProperty, (BindingBase) new Binding("TaskbarIcon")
- {
- Source = (object) this
- });
- }
- return this._parentWindow;
- }
- }
- protected bool ShowInTaskbar
- {
- get
- {
- if (this.ParentWindow == null)
- return false;
- return this.ParentWindow.ShowInTaskbar;
- }
- set
- {
- if (this.ParentWindow == null)
- return;
- this.ParentWindow.ShowInTaskbar = value;
- }
- }
- public WindowCommon()
- {
- base.\u002Ector();
- ((FrameworkElement) this).Loaded += new RoutedEventHandler(this.OnLoaded);
- }
- protected virtual void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
- {
- this.ShowInTaskbar = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.MainViewUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using Telerik.Windows.Controls;
- using WinApp.View.Base;
- using WinApp.ViewModel;
- namespace WinApp.View
- {
- internal class MainViewUC : UserControl, IWindowArrangeView, IComponentConnector
- {
- private readonly MainViewVM _viewModel;
- internal RadTreeView Menu;
- internal FlowDocumentScrollViewer ErrorBox;
- private bool _contentLoaded;
- public MainViewVM ViewModel
- {
- get
- {
- return this._viewModel;
- }
- }
- public double WindowHeight
- {
- get
- {
- return 600.0;
- }
- }
- public double WindowWidth
- {
- get
- {
- return 1000.0;
- }
- }
- public ResizeMode ResizeMode
- {
- get
- {
- return ResizeMode.CanResize;
- }
- }
- public MainViewUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this._viewModel = new MainViewVM(this));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/mainviewuc.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- this.Menu = (RadTreeView) target;
- break;
- case 2:
- this.ErrorBox = (FlowDocumentScrollViewer) target;
- break;
- default:
- this._contentLoaded = true;
- break;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.LoginUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using Telerik.Windows.Controls;
- using WinApp.View.Base;
- using WinApp.ViewModel;
- namespace WinApp.View
- {
- internal class LoginUC : UserControl, IWindowArrangeView, IComponentConnector
- {
- internal RadWatermarkTextBox LoginBox;
- private bool _contentLoaded;
- public double WindowHeight
- {
- get
- {
- return 500.0;
- }
- }
- public double WindowWidth
- {
- get
- {
- return 400.0;
- }
- }
- public ResizeMode ResizeMode
- {
- get
- {
- return ResizeMode.CanMinimize;
- }
- }
- public LoginVM ViewModel { get; private set; }
- public LoginUC()
- : this(new LoginVM())
- {
- }
- public LoginUC(LoginVM loginVm)
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = loginVm);
- this.ViewModel.Initialize();
- }
- private void LoginUC_OnLoaded(object sender, RoutedEventArgs e)
- {
- ((UIElement) this.LoginBox).Focus();
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/loginuc.xaml", UriKind.Relative));
- }
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- switch (connectionId)
- {
- case 1:
- ((FrameworkElement) target).Loaded += new RoutedEventHandler(this.LoginUC_OnLoaded);
- break;
- case 2:
- this.LoginBox = (RadWatermarkTextBox) target;
- break;
- default:
- this._contentLoaded = true;
- break;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.ChangePasswordUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class ChangePasswordUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public ChangePasswordVM ViewModel { get; private set; }
- public ChangePasswordUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new ChangePasswordVM());
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/changepassworduc.xaml", UriKind.Relative));
- }
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.SessionHistoryUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class SessionHistoryUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public SessionHistoryVM ViewModel { get; private set; }
- public SessionHistoryUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new SessionHistoryVM());
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/sessionhistoryuc.xaml", UriKind.Relative));
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Helpers.TelerikThemeManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using System.Windows;
- using System.Windows.Media;
- using Telerik.Windows.Controls;
- namespace WinApp.View.Helpers
- {
- internal class TelerikThemeManager : DependencyObject
- {
- public TelerikThemeManager()
- {
- TelerikThemeManager.ApplyTheme();
- }
- public static void ApplyTheme()
- {
- MetroColors.get_PaletteInstance().set_AccentColor(Color.FromArgb(byte.MaxValue, (byte) 61, (byte) 86, (byte) 109));
- MetroColors.get_PaletteInstance().set_StrongColor(Color.FromArgb(byte.MaxValue, (byte) 63, (byte) 63, (byte) 63));
- TelerikThemeManager.ApplyTheme((Theme) new MetroTheme());
- }
- public static void ApplyTheme(Theme theme)
- {
- Logger.WriteInfo(typeof (TelerikThemeManager), "ApplyTheme()", string.Format("?????????? ???? '{0}'...", (object) theme));
- StyleManager.set_ApplicationTheme(theme);
- Logger.WriteInfo(typeof (TelerikThemeManager), "ApplyTheme()", "???? ??????? ?????????");
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Helpers.WebHelper
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.IO;
- using System.Net;
- using WinApp.Managers.Configuration;
- namespace WinApp.View.Helpers
- {
- public static class WebHelper
- {
- public static Stream DownloadImage(Uri uri, string savePath)
- {
- HttpWebRequest httpWebRequest = WebRequest.Create(uri) as HttpWebRequest;
- if (httpWebRequest == null)
- return Stream.Null;
- httpWebRequest.UserAgent = ConfigurationManager.GetUserAgent();
- WebResponse response = httpWebRequest.GetResponse();
- using (Stream responseStream = response.GetResponseStream())
- {
- byte[] numArray = new byte[response.ContentLength];
- int offset = 0;
- while (responseStream != null)
- {
- int num = responseStream.Read(numArray, offset, numArray.Length - offset);
- offset += num;
- if (num <= 0)
- {
- string directoryName = Path.GetDirectoryName(savePath);
- if (!Directory.Exists(directoryName))
- Directory.CreateDirectory(directoryName);
- System.IO.File.WriteAllBytes(savePath, numArray);
- return (Stream) new MemoryStream(numArray);
- }
- }
- return Stream.Null;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Helpers.PasswordBoxAssistant
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Windows;
- using System.Windows.Controls;
- namespace WinApp.View.Helpers
- {
- public static class PasswordBoxAssistant
- {
- public static readonly DependencyProperty BoundPassword = DependencyProperty.RegisterAttached("BoundPassword", typeof (string), typeof (PasswordBoxAssistant), new PropertyMetadata((object) string.Empty, new PropertyChangedCallback(PasswordBoxAssistant.OnBoundPasswordChanged)));
- public static readonly DependencyProperty BindPassword = DependencyProperty.RegisterAttached("BindPassword", typeof (bool), typeof (PasswordBoxAssistant), new PropertyMetadata((object) false, new PropertyChangedCallback(PasswordBoxAssistant.OnBindPasswordChanged)));
- private static readonly DependencyProperty _updatingPassword = DependencyProperty.RegisterAttached("_updatingPassword", typeof (bool), typeof (PasswordBoxAssistant), new PropertyMetadata((object) false));
- public static void SetBindPassword(DependencyObject dp, bool value)
- {
- dp.SetValue(PasswordBoxAssistant.BindPassword, (object) (bool) (value ? 1 : 0));
- }
- public static bool GetBindPassword(DependencyObject dp)
- {
- return (bool) dp.GetValue(PasswordBoxAssistant.BindPassword);
- }
- public static string GetBoundPassword(DependencyObject dp)
- {
- return (string) dp.GetValue(PasswordBoxAssistant.BoundPassword);
- }
- public static void SetBoundPassword(DependencyObject dp, string value)
- {
- dp.SetValue(PasswordBoxAssistant.BoundPassword, (object) value);
- }
- private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- PasswordBox passwordBox = d as PasswordBox;
- if (d == null || !PasswordBoxAssistant.GetBindPassword(d) || passwordBox == null)
- return;
- passwordBox.PasswordChanged -= new RoutedEventHandler(PasswordBoxAssistant.HandlePasswordChanged);
- string str = (string) e.NewValue;
- if (!PasswordBoxAssistant.GetUpdatingPassword((DependencyObject) passwordBox))
- passwordBox.Password = str;
- passwordBox.PasswordChanged += new RoutedEventHandler(PasswordBoxAssistant.HandlePasswordChanged);
- }
- private static void OnBindPasswordChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
- {
- PasswordBox passwordBox = dp as PasswordBox;
- if (passwordBox == null)
- return;
- bool flag1 = (bool) e.OldValue;
- bool flag2 = (bool) e.NewValue;
- if (flag1)
- passwordBox.PasswordChanged -= new RoutedEventHandler(PasswordBoxAssistant.HandlePasswordChanged);
- if (!flag2)
- return;
- passwordBox.PasswordChanged += new RoutedEventHandler(PasswordBoxAssistant.HandlePasswordChanged);
- }
- private static void HandlePasswordChanged(object sender, RoutedEventArgs e)
- {
- PasswordBox passwordBox = sender as PasswordBox;
- PasswordBoxAssistant.SetUpdatingPassword((DependencyObject) passwordBox, true);
- if (passwordBox == null)
- return;
- PasswordBoxAssistant.SetBoundPassword((DependencyObject) passwordBox, passwordBox.Password);
- PasswordBoxAssistant.SetUpdatingPassword((DependencyObject) passwordBox, false);
- }
- private static bool GetUpdatingPassword(DependencyObject dp)
- {
- return (bool) dp.GetValue(PasswordBoxAssistant._updatingPassword);
- }
- private static void SetUpdatingPassword(DependencyObject dp, bool value)
- {
- dp.SetValue(PasswordBoxAssistant._updatingPassword, (object) (bool) (value ? 1 : 0));
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Helpers.CommandBindingExtension
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Reflection;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Markup;
- namespace WinApp.View.Helpers
- {
- [MarkupExtensionReturnType(typeof (ICommand))]
- public class CommandBindingExtension : MarkupExtension
- {
- private object targetObject;
- private object targetProperty;
- private bool dataContextChangeHandlerSet;
- [ConstructorArgument("commandName")]
- public string CommandName { get; set; }
- public CommandBindingExtension()
- {
- }
- public CommandBindingExtension(string commandName)
- {
- this.CommandName = commandName;
- }
- public override object ProvideValue(IServiceProvider serviceProvider)
- {
- IProvideValueTarget provideValueTarget = serviceProvider.GetService(typeof (IProvideValueTarget)) as IProvideValueTarget;
- if (provideValueTarget != null)
- {
- this.targetObject = provideValueTarget.TargetObject;
- this.targetProperty = provideValueTarget.TargetProperty;
- }
- if (!string.IsNullOrEmpty(this.CommandName))
- {
- ParserContext privateFieldValue1 = this.GetPrivateFieldValue<ParserContext>((object) serviceProvider, "_context");
- if (privateFieldValue1 != null)
- {
- FrameworkElement privateFieldValue2 = this.GetPrivateFieldValue<FrameworkElement>((object) privateFieldValue1, "_rootElement");
- if (privateFieldValue2 != null)
- {
- object dataContext = privateFieldValue2.DataContext;
- if (!this.dataContextChangeHandlerSet)
- {
- privateFieldValue2.DataContextChanged += new DependencyPropertyChangedEventHandler(this.rootElement_DataContextChanged);
- this.dataContextChangeHandlerSet = true;
- }
- if (dataContext != null)
- {
- ICommand command = this.GetCommand(dataContext, this.CommandName);
- if (command != null)
- return (object) command;
- }
- }
- }
- }
- return (object) CommandBindingExtension.DummyCommand.Instance;
- }
- private ICommand GetCommand(object dataContext, string commandName)
- {
- PropertyInfo property = dataContext.GetType().GetProperty(commandName);
- if (property != null)
- {
- ICommand command = property.GetValue(dataContext, (object[]) null) as ICommand;
- if (command != null)
- return command;
- }
- return (ICommand) null;
- }
- private void AssignCommand(ICommand command)
- {
- if (this.targetObject == null || this.targetProperty == null)
- return;
- if (this.targetProperty is DependencyProperty)
- (this.targetObject as DependencyObject).SetValue(this.targetProperty as DependencyProperty, (object) command);
- else
- (this.targetProperty as PropertyInfo).SetValue(this.targetObject, (object) command, (object[]) null);
- }
- private void rootElement_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- FrameworkElement frameworkElement = sender as FrameworkElement;
- if (frameworkElement == null)
- return;
- object dataContext = frameworkElement.DataContext;
- if (dataContext == null)
- return;
- ICommand command = this.GetCommand(dataContext, this.CommandName);
- if (command == null)
- return;
- this.AssignCommand(command);
- }
- private T GetPrivateFieldValue<T>(object target, string fieldName)
- {
- FieldInfo field = target.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic);
- if (field != null)
- return (T) field.GetValue(target);
- return default (T);
- }
- private class DummyCommand : ICommand
- {
- private static CommandBindingExtension.DummyCommand _instance;
- public static CommandBindingExtension.DummyCommand Instance
- {
- get
- {
- if (CommandBindingExtension.DummyCommand._instance == null)
- CommandBindingExtension.DummyCommand._instance = new CommandBindingExtension.DummyCommand();
- return CommandBindingExtension.DummyCommand._instance;
- }
- }
- public event EventHandler CanExecuteChanged;
- private DummyCommand()
- {
- }
- public bool CanExecute(object parameter)
- {
- return false;
- }
- public void Execute(object parameter)
- {
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.Helpers.VisualDescendantsExtention
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Collections.Generic;
- using System.Windows;
- using System.Windows.Media;
- namespace WinApp.View.Helpers
- {
- public static class VisualDescendantsExtention
- {
- public static IEnumerable<T> GetVisualDescendants<T>(this DependencyObject depObj) where T : DependencyObject
- {
- if (depObj != null)
- {
- for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); ++i)
- {
- DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
- if (child is T)
- yield return (T) child;
- foreach (T obj in VisualDescendantsExtention.GetVisualDescendants<T>(child))
- yield return obj;
- }
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.PersonalInformationUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using IncMap;
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.Managers.Interfaces;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class PersonalInformationUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public PersonalInformationVM ViewModel { get; private set; }
- public PersonalInformationUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new PersonalInformationVM(Map.Get<ISessionManager>().CurrentUser));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/personalinformationuc.xaml", UriKind.Relative));
- }
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.ContactInformationUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using IncMap;
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.Managers.Interfaces;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class ContactInformationUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public ContactInformationVM ViewModel { get; private set; }
- public ContactInformationUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new ContactInformationVM(Map.Get<ISessionManager>().CurrentUser));
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/contactinformationuc.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.ServicesUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using System.Windows.Markup;
- using Telerik.Windows;
- using Telerik.Windows.Controls;
- using WinApp.View.Helpers;
- using WinApp.ViewModel.Controls;
- using WinApp.ViewModel.Services;
- namespace WinApp.View
- {
- internal class ServicesUC : UserControl, IComponentConnector, IStyleConnector
- {
- private readonly ServicesControlVM _viewModel;
- private bool _contentLoaded;
- public ServicesUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this._viewModel = new ServicesControlVM());
- }
- private void Service_OnMouseLeftUp(object sender, MouseButtonEventArgs e)
- {
- RadTileViewItem radTileViewItem = sender as RadTileViewItem;
- if (radTileViewItem == null)
- return;
- ServiceVM serviceVm = (ServiceVM) null;
- if (((FrameworkElement) radTileViewItem).DataContext != null)
- serviceVm = ((FrameworkElement) radTileViewItem).DataContext as ServiceVM;
- if (serviceVm == null || !serviceVm.IsEnableMainButton || radTileViewItem.get_TileState() == 1)
- return;
- radTileViewItem.set_TileState((TileViewItemState) 1);
- }
- private void RadTileView_OnTileStateChanged(object sender, RadRoutedEventArgs e)
- {
- RadTileViewItem radTileViewItem = ((RoutedEventArgs) e).Source as RadTileViewItem;
- if (radTileViewItem == null)
- return;
- RadFluidContentControl fluidContentControl = Enumerable.SingleOrDefault<RadFluidContentControl>(VisualDescendantsExtention.GetVisualDescendants<RadFluidContentControl>((DependencyObject) radTileViewItem));
- if (fluidContentControl == null)
- return;
- switch ((int) radTileViewItem.get_TileState())
- {
- case 0:
- fluidContentControl.set_State((FluidContentControlState) 1);
- break;
- case 1:
- fluidContentControl.set_State((FluidContentControlState) 2);
- break;
- case 2:
- fluidContentControl.set_State((FluidContentControlState) 0);
- break;
- }
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/servicesuc.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- if (connectionId == 1)
- ((RadTileView) target).add_TileStateChanged(new EventHandler<RadRoutedEventArgs>(this.RadTileView_OnTileStateChanged));
- else
- this._contentLoaded = true;
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- void IStyleConnector.Connect(int connectionId, object target)
- {
- if (connectionId != 2)
- return;
- ((Style) target).Setters.Add((SetterBase) new EventSetter()
- {
- Event = UIElement.MouseLeftButtonUpEvent,
- Handler = (Delegate) new MouseButtonEventHandler(this.Service_OnMouseLeftUp)
- });
- ((Style) target).Setters.Add((SetterBase) new EventSetter()
- {
- Event = (RoutedEvent) RadTileViewItem.TileStateChangedEvent,
- Handler = (Delegate) new EventHandler<RadRoutedEventArgs>(this.RadTileView_OnTileStateChanged)
- });
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.SettingsUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class SettingsUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public SettingsVM ViewModel { get; private set; }
- public SettingsUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new SettingsVM());
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/settingsuc.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [DebuggerNonUserCode]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.MainWindow
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using Telerik.Windows.Controls;
- using WinApp.Managers.Interfaces;
- using WinApp.View.Base;
- using WinApp.ViewModel;
- namespace WinApp.View
- {
- internal class MainWindow : WindowCommon, IMainWindow, IComponentConnector
- {
- private WindowState _lastWindowState;
- internal Grid LayoutGrid;
- private bool _contentLoaded;
- public bool CloseToTray { get; set; }
- public MainWindowVM ViewModel { get; private set; }
- public MainWindow()
- {
- this.InitializeComponent();
- ((FrameworkElement) this).DataContext = (object) (this.ViewModel = new MainWindowVM(this));
- this.CloseToTray = true;
- this.LayoutGrid.Children.Add(Map.Get<IAppTray>().Tray);
- }
- public void Open()
- {
- if (((WindowBase) this).get_WindowState() == WindowState.Minimized)
- {
- Logger.WriteInfo(typeof (MainWindow), "Open()", "???????? ?????????? ?? ????");
- this.ShowInTaskbar = true;
- ((UIElement) this).Visibility = Visibility.Visible;
- ((WindowBase) this).set_WindowState(this._lastWindowState != WindowState.Minimized ? this._lastWindowState : WindowState.Normal);
- }
- ((WindowBase) this).BringToFront();
- }
- protected virtual void OnPreviewClosed(WindowPreviewClosedEventArgs e)
- {
- if (!this.CloseToTray)
- return;
- Logger.WriteInfo(typeof (MainWindow), "OnPreviewClosed()", "???????????? ?????????? ? ????");
- e.set_Cancel(new bool?(true));
- this._lastWindowState = ((WindowBase) this).get_WindowState();
- ((WindowBase) this).set_WindowState(WindowState.Minimized);
- ((UIElement) this).Visibility = Visibility.Collapsed;
- this.ShowInTaskbar = false;
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- ((MainWindowVM) ((FrameworkElement) this).DataContext).MainWindowLoaded();
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/mainwindow.xaml", UriKind.Relative));
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- internal Delegate _CreateDelegate(Type delegateType, string handler)
- {
- return Delegate.CreateDelegate(delegateType, (object) this, handler);
- }
- [DebuggerNonUserCode]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- if (connectionId == 1)
- this.LayoutGrid = (Grid) target;
- else
- this._contentLoaded = true;
- }
- void IMainWindow.Show()
- {
- this.Show();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.VersionUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- public class VersionUC : UserControl, IComponentConnector
- {
- private VersionControlVM _viewModel;
- private bool _contentLoaded;
- public double WindowHeight
- {
- get
- {
- return 400.0;
- }
- }
- public double WindowWidth
- {
- get
- {
- return 400.0;
- }
- }
- public ResizeMode ResizeMode
- {
- get
- {
- return ResizeMode.CanMinimize;
- }
- }
- public VersionUC(Version appVersionOnSite, Version appVersionCurrent)
- {
- this.InitializeComponent();
- this._viewModel = new VersionControlVM(appVersionOnSite, appVersionCurrent);
- this.DataContext = (object) this._viewModel;
- }
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- this._viewModel.ButtonOkClick();
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/versionuc.xaml", UriKind.Relative));
- }
- [EditorBrowsable(EditorBrowsableState.Never)]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.View.SessionStatisticsUC
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Markup;
- using WinApp.ViewModel.Controls;
- namespace WinApp.View
- {
- internal class SessionStatisticsUC : UserControl, IComponentConnector
- {
- private bool _contentLoaded;
- public SessionStatisticsVM ViewModel { get; private set; }
- public SessionStatisticsUC()
- {
- this.InitializeComponent();
- this.DataContext = (object) (this.ViewModel = new SessionStatisticsVM());
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/view/sessionstatisticsuc.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [DebuggerNonUserCode]
- void IComponentConnector.Connect(int connectionId, object target)
- {
- this._contentLoaded = true;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.RoutedEventHelper
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Windows;
- namespace WinApp.Tray.RichNotifyIcon
- {
- internal static class RoutedEventHelper
- {
- internal static void RaiseEvent(DependencyObject target, RoutedEventArgs args)
- {
- if (target is UIElement)
- {
- (target as UIElement).RaiseEvent(args);
- }
- else
- {
- if (!(target is ContentElement))
- return;
- (target as ContentElement).RaiseEvent(args);
- }
- }
- internal static void AddHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
- {
- UIElement uiElement = element as UIElement;
- if (uiElement != null)
- {
- uiElement.AddHandler(routedEvent, handler);
- }
- else
- {
- ContentElement contentElement = element as ContentElement;
- if (contentElement == null)
- return;
- contentElement.AddHandler(routedEvent, handler);
- }
- }
- internal static void RemoveHandler(DependencyObject element, RoutedEvent routedEvent, Delegate handler)
- {
- UIElement uiElement = element as UIElement;
- if (uiElement != null)
- {
- uiElement.RemoveHandler(routedEvent, handler);
- }
- else
- {
- ContentElement contentElement = element as ContentElement;
- if (contentElement == null)
- return;
- contentElement.RemoveHandler(routedEvent, handler);
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.PopupActivationMode
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon
- {
- public enum PopupActivationMode
- {
- LeftClick,
- RightClick,
- DoubleClick,
- LeftOrRightClick,
- LeftOrDoubleClick,
- MiddleClick,
- All,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.TaskbarIcon
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.ComponentModel;
- using System.Drawing;
- using System.Threading;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Controls.Primitives;
- using System.Windows.Input;
- using System.Windows.Interop;
- using System.Windows.Media;
- using System.Windows.Threading;
- using WinApp.Tray.RichNotifyIcon.Interop;
- namespace WinApp.Tray.RichNotifyIcon
- {
- public class TaskbarIcon : FrameworkElement, IDisposable
- {
- private static readonly DependencyPropertyKey TrayPopupResolvedPropertyKey = DependencyProperty.RegisterReadOnly("TrayPopupResolved", typeof (Popup), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty TrayPopupResolvedProperty = TaskbarIcon.TrayPopupResolvedPropertyKey.DependencyProperty;
- private static readonly DependencyPropertyKey TrayToolTipResolvedPropertyKey = DependencyProperty.RegisterReadOnly("TrayToolTipResolved", typeof (ToolTip), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty TrayToolTipResolvedProperty = TaskbarIcon.TrayToolTipResolvedPropertyKey.DependencyProperty;
- private static readonly DependencyPropertyKey CustomBalloonPropertyKey = DependencyProperty.RegisterReadOnly("CustomBalloon", typeof (Popup), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty CustomBalloonProperty = TaskbarIcon.CustomBalloonPropertyKey.DependencyProperty;
- public static readonly DependencyProperty IconSourceProperty = DependencyProperty.Register("IconSource", typeof (ImageSource), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) null, new PropertyChangedCallback(TaskbarIcon.IconSourcePropertyChanged)));
- public static readonly DependencyProperty ToolTipTextProperty = DependencyProperty.Register("ToolTipText", typeof (string), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) string.Empty, new PropertyChangedCallback(TaskbarIcon.ToolTipTextPropertyChanged)));
- public static readonly DependencyProperty TrayToolTipProperty = DependencyProperty.Register("TrayToolTip", typeof (UIElement), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) null, new PropertyChangedCallback(TaskbarIcon.TrayToolTipPropertyChanged)));
- public static readonly DependencyProperty TrayPopupProperty = DependencyProperty.Register("TrayPopup", typeof (UIElement), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) null, new PropertyChangedCallback(TaskbarIcon.TrayPopupPropertyChanged)));
- public static readonly DependencyProperty MenuActivationProperty = DependencyProperty.Register("MenuActivation", typeof (PopupActivationMode), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) PopupActivationMode.RightClick));
- public static readonly DependencyProperty PopupActivationProperty = DependencyProperty.Register("PopupActivation", typeof (PopupActivationMode), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) PopupActivationMode.LeftClick));
- public static readonly DependencyProperty DoubleClickCommandProperty = DependencyProperty.Register("DoubleClickCommand", typeof (ICommand), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty DoubleClickCommandParameterProperty = DependencyProperty.Register("DoubleClickCommandParameter", typeof (object), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty DoubleClickCommandTargetProperty = DependencyProperty.Register("DoubleClickCommandTarget", typeof (IInputElement), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty LeftClickCommandProperty = DependencyProperty.Register("LeftClickCommand", typeof (ICommand), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty LeftClickCommandParameterProperty = DependencyProperty.Register("LeftClickCommandParameter", typeof (object), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly DependencyProperty LeftClickCommandTargetProperty = DependencyProperty.Register("LeftClickCommandTarget", typeof (IInputElement), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((PropertyChangedCallback) null));
- public static readonly RoutedEvent TrayLeftMouseDownEvent = EventManager.RegisterRoutedEvent("TrayLeftMouseDown", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayRightMouseDownEvent = EventManager.RegisterRoutedEvent("TrayRightMouseDown", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayMiddleMouseDownEvent = EventManager.RegisterRoutedEvent("TrayMiddleMouseDown", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayLeftMouseUpEvent = EventManager.RegisterRoutedEvent("TrayLeftMouseUp", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayRightMouseUpEvent = EventManager.RegisterRoutedEvent("TrayRightMouseUp", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayMiddleMouseUpEvent = EventManager.RegisterRoutedEvent("TrayMiddleMouseUp", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayMouseDoubleClickEvent = EventManager.RegisterRoutedEvent("TrayMouseDoubleClick", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayMouseMoveEvent = EventManager.RegisterRoutedEvent("TrayMouseMove", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayBalloonTipShownEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipShown", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayBalloonTipClosedEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipClosed", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayBalloonTipClickedEvent = EventManager.RegisterRoutedEvent("TrayBalloonTipClicked", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayContextMenuOpenEvent = EventManager.RegisterRoutedEvent("TrayContextMenuOpen", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent PreviewTrayContextMenuOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayContextMenuOpen", RoutingStrategy.Tunnel, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayPopupOpenEvent = EventManager.RegisterRoutedEvent("TrayPopupOpen", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent PreviewTrayPopupOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayPopupOpen", RoutingStrategy.Tunnel, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayToolTipOpenEvent = EventManager.RegisterRoutedEvent("TrayToolTipOpen", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent PreviewTrayToolTipOpenEvent = EventManager.RegisterRoutedEvent("PreviewTrayToolTipOpen", RoutingStrategy.Tunnel, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent TrayToolTipCloseEvent = EventManager.RegisterRoutedEvent("TrayToolTipClose", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent PreviewTrayToolTipCloseEvent = EventManager.RegisterRoutedEvent("PreviewTrayToolTipClose", RoutingStrategy.Tunnel, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent PopupOpenedEvent = EventManager.RegisterRoutedEvent("PopupOpened", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent ToolTipOpenedEvent = EventManager.RegisterRoutedEvent("ToolTipOpened", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent ToolTipCloseEvent = EventManager.RegisterRoutedEvent("ToolTipClose", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent BalloonShowingEvent = EventManager.RegisterRoutedEvent("BalloonShowing", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly RoutedEvent BalloonClosingEvent = EventManager.RegisterRoutedEvent("BalloonClosing", RoutingStrategy.Bubble, typeof (RoutedEventHandler), typeof (TaskbarIcon));
- public static readonly DependencyProperty ParentTaskbarIconProperty = DependencyProperty.RegisterAttached("ParentTaskbarIcon", typeof (TaskbarIcon), typeof (TaskbarIcon), (PropertyMetadata) new FrameworkPropertyMetadata((object) null, FrameworkPropertyMetadataOptions.Inherits));
- private double scalingFactor = double.NaN;
- public const string CategoryName = "NotifyIcon";
- private NotifyIconData iconData;
- private readonly WindowMessageSink messageSink;
- private Action singleClickTimerAction;
- private readonly Timer singleClickTimer;
- private readonly Timer balloonCloseTimer;
- private Icon icon;
- public bool IsTaskbarIconCreated { get; private set; }
- public bool SupportsCustomToolTips
- {
- get
- {
- return this.messageSink.Version == NotifyIconVersion.Vista;
- }
- }
- private bool IsPopupOpen
- {
- get
- {
- Popup trayPopupResolved = this.TrayPopupResolved;
- ContextMenu contextMenu = this.ContextMenu;
- Popup customBalloon = this.CustomBalloon;
- if (trayPopupResolved != null && trayPopupResolved.IsOpen || contextMenu != null && contextMenu.IsOpen)
- return true;
- if (customBalloon != null)
- return customBalloon.IsOpen;
- return false;
- }
- }
- public bool IsDisposed { get; private set; }
- [Category("NotifyIcon")]
- public Popup TrayPopupResolved
- {
- get
- {
- return (Popup) this.GetValue(TaskbarIcon.TrayPopupResolvedProperty);
- }
- }
- [Browsable(true)]
- [Bindable(true)]
- [Category("NotifyIcon")]
- public ToolTip TrayToolTipResolved
- {
- get
- {
- return (ToolTip) this.GetValue(TaskbarIcon.TrayToolTipResolvedProperty);
- }
- }
- public Popup CustomBalloon
- {
- get
- {
- return (Popup) this.GetValue(TaskbarIcon.CustomBalloonProperty);
- }
- }
- [Browsable(false)]
- public Icon Icon
- {
- get
- {
- return this.icon;
- }
- set
- {
- this.icon = value;
- this.iconData.IconHandle = value == null ? IntPtr.Zero : this.icon.Handle;
- Util.WriteIconData(ref this.iconData, NotifyCommand.Modify, IconDataMembers.Icon);
- }
- }
- [Description("Sets the displayed taskbar icon.")]
- [Category("NotifyIcon")]
- public ImageSource IconSource
- {
- get
- {
- return (ImageSource) this.GetValue(TaskbarIcon.IconSourceProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.IconSourceProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Alternative to a fully blown ToolTip, which is only displayed on Vista and above.")]
- public string ToolTipText
- {
- get
- {
- return (string) this.GetValue(TaskbarIcon.ToolTipTextProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.ToolTipTextProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Custom UI element that is displayed as a tooltip. Only on Vista and above")]
- public UIElement TrayToolTip
- {
- get
- {
- return (UIElement) this.GetValue(TaskbarIcon.TrayToolTipProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.TrayToolTipProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Displayed as a Popup if the user clicks on the taskbar icon.")]
- public UIElement TrayPopup
- {
- get
- {
- return (UIElement) this.GetValue(TaskbarIcon.TrayPopupProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.TrayPopupProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Defines what mouse events display the context menu.")]
- public PopupActivationMode MenuActivation
- {
- get
- {
- return (PopupActivationMode) this.GetValue(TaskbarIcon.MenuActivationProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.MenuActivationProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Defines what mouse events display the TaskbarIconPopup.")]
- public PopupActivationMode PopupActivation
- {
- get
- {
- return (PopupActivationMode) this.GetValue(TaskbarIcon.PopupActivationProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.PopupActivationProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("A command that is being executed if the tray icon is being double-clicked.")]
- public ICommand DoubleClickCommand
- {
- get
- {
- return (ICommand) this.GetValue(TaskbarIcon.DoubleClickCommandProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.DoubleClickCommandProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("Parameter to submit to the DoubleClickCommand when the user double clicks on the NotifyIcon.")]
- public object DoubleClickCommandParameter
- {
- get
- {
- return this.GetValue(TaskbarIcon.DoubleClickCommandParameterProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.DoubleClickCommandParameterProperty, value);
- }
- }
- [Category("NotifyIcon")]
- [Description("The target of the command that is fired if the notify icon is double clicked.")]
- public IInputElement DoubleClickCommandTarget
- {
- get
- {
- return (IInputElement) this.GetValue(TaskbarIcon.DoubleClickCommandTargetProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.DoubleClickCommandTargetProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- [Description("A command that is being executed if the tray icon is being left-clicked.")]
- public ICommand LeftClickCommand
- {
- get
- {
- return (ICommand) this.GetValue(TaskbarIcon.LeftClickCommandProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.LeftClickCommandProperty, (object) value);
- }
- }
- [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button.")]
- [Category("NotifyIcon")]
- public object LeftClickCommandParameter
- {
- get
- {
- return this.GetValue(TaskbarIcon.LeftClickCommandParameterProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.LeftClickCommandParameterProperty, value);
- }
- }
- [Category("NotifyIcon")]
- [Description("The target of the command that is fired if the notify icon is clicked with the left mouse button.")]
- public IInputElement LeftClickCommandTarget
- {
- get
- {
- return (IInputElement) this.GetValue(TaskbarIcon.LeftClickCommandTargetProperty);
- }
- set
- {
- this.SetValue(TaskbarIcon.LeftClickCommandTargetProperty, (object) value);
- }
- }
- [Category("NotifyIcon")]
- public event RoutedEventHandler TrayLeftMouseDown
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayLeftMouseDownEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayLeftMouseDownEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayRightMouseDown
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayRightMouseDownEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayRightMouseDownEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayMiddleMouseDown
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayMiddleMouseDownEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayMiddleMouseDownEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayLeftMouseUp
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayLeftMouseUpEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayLeftMouseUpEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayRightMouseUp
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayRightMouseUpEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayRightMouseUpEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayMiddleMouseUp
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayMiddleMouseUpEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayMiddleMouseUpEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayMouseDoubleClick
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayMouseDoubleClickEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayMouseDoubleClickEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayMouseMove
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayMouseMoveEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayMouseMoveEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayBalloonTipShown
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayBalloonTipShownEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayBalloonTipShownEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayBalloonTipClosed
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayBalloonTipClosedEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayBalloonTipClosedEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayBalloonTipClicked
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayBalloonTipClickedEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayBalloonTipClickedEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayContextMenuOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayContextMenuOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayContextMenuOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler PreviewTrayContextMenuOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.PreviewTrayContextMenuOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.PreviewTrayContextMenuOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayPopupOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayPopupOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayPopupOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler PreviewTrayPopupOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.PreviewTrayPopupOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.PreviewTrayPopupOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayToolTipOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayToolTipOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayToolTipOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler PreviewTrayToolTipOpen
- {
- add
- {
- this.AddHandler(TaskbarIcon.PreviewTrayToolTipOpenEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.PreviewTrayToolTipOpenEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler TrayToolTipClose
- {
- add
- {
- this.AddHandler(TaskbarIcon.TrayToolTipCloseEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.TrayToolTipCloseEvent, (Delegate) value);
- }
- }
- public event RoutedEventHandler PreviewTrayToolTipClose
- {
- add
- {
- this.AddHandler(TaskbarIcon.PreviewTrayToolTipCloseEvent, (Delegate) value);
- }
- remove
- {
- this.RemoveHandler(TaskbarIcon.PreviewTrayToolTipCloseEvent, (Delegate) value);
- }
- }
- static TaskbarIcon()
- {
- PropertyMetadata typeMetadata1 = new PropertyMetadata((object) Visibility.Visible, new PropertyChangedCallback(TaskbarIcon.VisibilityPropertyChanged));
- UIElement.VisibilityProperty.OverrideMetadata(typeof (TaskbarIcon), typeMetadata1);
- PropertyMetadata typeMetadata2 = (PropertyMetadata) new FrameworkPropertyMetadata(new PropertyChangedCallback(TaskbarIcon.DataContextPropertyChanged));
- FrameworkElement.DataContextProperty.OverrideMetadata(typeof (TaskbarIcon), typeMetadata2);
- PropertyMetadata typeMetadata3 = (PropertyMetadata) new FrameworkPropertyMetadata(new PropertyChangedCallback(TaskbarIcon.ContextMenuPropertyChanged));
- FrameworkElement.ContextMenuProperty.OverrideMetadata(typeof (TaskbarIcon), typeMetadata3);
- }
- public TaskbarIcon()
- {
- this.messageSink = Util.IsDesignMode ? WindowMessageSink.CreateEmpty() : new WindowMessageSink(NotifyIconVersion.Win95);
- this.iconData = NotifyIconData.CreateDefault(this.messageSink.MessageWindowHandle);
- this.CreateTaskbarIcon();
- this.messageSink.MouseEventReceived += new Action<MouseEvent>(this.OnMouseEvent);
- this.messageSink.TaskbarCreated += new Action(this.OnTaskbarCreated);
- this.messageSink.ChangeToolTipStateRequest += new Action<bool>(this.OnToolTipChange);
- this.messageSink.BalloonToolTipChanged += new Action<bool>(this.OnBalloonToolTipChanged);
- this.singleClickTimer = new Timer(new TimerCallback(this.DoSingleClickAction));
- this.balloonCloseTimer = new Timer(new TimerCallback(this.CloseBalloonCallback));
- if (Application.Current == null)
- return;
- Application.Current.Exit += new ExitEventHandler(this.OnExit);
- }
- ~TaskbarIcon()
- {
- this.Dispose(false);
- }
- public void ShowCustomBalloon(UIElement balloon, PopupAnimation animation, int? timeout)
- {
- Dispatcher dispatcher = Util.GetDispatcher((DispatcherObject) this);
- if (!dispatcher.CheckAccess())
- {
- Action action = (Action) (() => this.ShowCustomBalloon(balloon, animation, timeout));
- dispatcher.Invoke(DispatcherPriority.Normal, (Delegate) action);
- }
- else
- {
- if (balloon == null)
- throw new ArgumentNullException("balloon");
- if (timeout.HasValue)
- {
- int? nullable = timeout;
- if ((nullable.GetValueOrDefault() >= 500 ? 0 : (nullable.HasValue ? 1 : 0)) != 0)
- throw new ArgumentOutOfRangeException("timeout", string.Format("Invalid timeout of {0} milliseconds. Timeout must be at least 500 ms", (object) timeout));
- }
- this.EnsureNotDisposed();
- lock (this)
- this.CloseBalloon();
- Popup popup1 = new Popup();
- popup1.AllowsTransparency = true;
- this.UpdateDataContext((FrameworkElement) popup1, (object) null, this.DataContext);
- popup1.PopupAnimation = animation;
- Popup popup2 = LogicalTreeHelper.GetParent((DependencyObject) balloon) as Popup;
- if (popup2 != null)
- popup2.Child = (UIElement) null;
- if (popup2 != null)
- throw new InvalidOperationException(string.Format("Cannot display control [{0}] in a new balloon popup - that control already has a parent. You may consider creating new balloons every time you want to show one.", (object) balloon));
- popup1.Child = balloon;
- popup1.Placement = PlacementMode.AbsolutePoint;
- popup1.StaysOpen = true;
- WinApp.Tray.RichNotifyIcon.Interop.Point deviceCoordinates = this.GetDeviceCoordinates(TrayInfo.GetTrayLocation());
- popup1.HorizontalOffset = (double) (deviceCoordinates.X - 1);
- popup1.VerticalOffset = (double) (deviceCoordinates.Y - 1);
- lock (this)
- this.SetCustomBalloon(popup1);
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) balloon, this);
- TaskbarIcon.RaiseBalloonShowingEvent((DependencyObject) balloon, this);
- popup1.IsOpen = true;
- if (!timeout.HasValue)
- return;
- this.balloonCloseTimer.Change(timeout.Value, -1);
- }
- }
- public void ResetBalloonCloseTimer()
- {
- if (this.IsDisposed)
- return;
- lock (this)
- this.balloonCloseTimer.Change(-1, -1);
- }
- public void CloseBalloon()
- {
- if (this.IsDisposed)
- return;
- Dispatcher dispatcher = Util.GetDispatcher((DispatcherObject) this);
- if (!dispatcher.CheckAccess())
- {
- Action action = new Action(this.CloseBalloon);
- dispatcher.Invoke(DispatcherPriority.Normal, (Delegate) action);
- }
- else
- {
- lock (this)
- {
- this.balloonCloseTimer.Change(-1, -1);
- Popup local_2 = this.CustomBalloon;
- if (local_2 == null)
- return;
- UIElement local_3 = local_2.Child;
- if (!TaskbarIcon.RaiseBalloonClosingEvent((DependencyObject) local_3, this).Handled)
- {
- local_2.IsOpen = false;
- local_2.Child = (UIElement) null;
- if (local_3 != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) local_3, (TaskbarIcon) null);
- }
- this.SetCustomBalloon((Popup) null);
- }
- }
- }
- private void CloseBalloonCallback(object state)
- {
- if (this.IsDisposed)
- return;
- Util.GetDispatcher((DispatcherObject) this).Invoke((Delegate) new Action(this.CloseBalloon));
- }
- private void OnMouseEvent(MouseEvent me)
- {
- if (this.IsDisposed)
- return;
- switch (me)
- {
- case MouseEvent.MouseMove:
- this.RaiseTrayMouseMoveEvent();
- return;
- case MouseEvent.IconRightMouseDown:
- this.RaiseTrayRightMouseDownEvent();
- break;
- case MouseEvent.IconLeftMouseDown:
- this.RaiseTrayLeftMouseDownEvent();
- break;
- case MouseEvent.IconRightMouseUp:
- this.RaiseTrayRightMouseUpEvent();
- break;
- case MouseEvent.IconLeftMouseUp:
- this.RaiseTrayLeftMouseUpEvent();
- break;
- case MouseEvent.IconMiddleMouseDown:
- this.RaiseTrayMiddleMouseDownEvent();
- break;
- case MouseEvent.IconMiddleMouseUp:
- this.RaiseTrayMiddleMouseUpEvent();
- break;
- case MouseEvent.IconDoubleClick:
- this.singleClickTimer.Change(-1, -1);
- this.RaiseTrayMouseDoubleClickEvent();
- break;
- case MouseEvent.BalloonToolTipClicked:
- this.RaiseTrayBalloonTipClickedEvent();
- break;
- default:
- throw new ArgumentOutOfRangeException("me", "Missing handler for mouse event flag: " + (object) me);
- }
- WinApp.Tray.RichNotifyIcon.Interop.Point cursorPosition = new WinApp.Tray.RichNotifyIcon.Interop.Point();
- if (this.messageSink.Version == NotifyIconVersion.Vista)
- WinApi.GetPhysicalCursorPos(ref cursorPosition);
- else
- WinApi.GetCursorPos(ref cursorPosition);
- cursorPosition = this.GetDeviceCoordinates(cursorPosition);
- bool flag = false;
- if (Util.IsMatch(me, this.PopupActivation))
- {
- if (me == MouseEvent.IconLeftMouseUp)
- {
- this.singleClickTimerAction = (Action) (() =>
- {
- Util.ExecuteIfEnabled(this.LeftClickCommand, this.LeftClickCommandParameter, this.LeftClickCommandTarget ?? (IInputElement) this);
- this.ShowTrayPopup(cursorPosition);
- });
- this.singleClickTimer.Change(WinApi.GetDoubleClickTime(), -1);
- flag = true;
- }
- else
- this.ShowTrayPopup(cursorPosition);
- }
- if (Util.IsMatch(me, this.MenuActivation))
- {
- if (me == MouseEvent.IconLeftMouseUp)
- {
- this.singleClickTimerAction = (Action) (() =>
- {
- Util.ExecuteIfEnabled(this.LeftClickCommand, this.LeftClickCommandParameter, this.LeftClickCommandTarget ?? (IInputElement) this);
- this.ShowContextMenu(cursorPosition);
- });
- this.singleClickTimer.Change(WinApi.GetDoubleClickTime(), -1);
- flag = true;
- }
- else
- this.ShowContextMenu(cursorPosition);
- }
- if (me != MouseEvent.IconLeftMouseUp || flag)
- return;
- this.singleClickTimerAction = (Action) (() => Util.ExecuteIfEnabled(this.LeftClickCommand, this.LeftClickCommandParameter, this.LeftClickCommandTarget ?? (IInputElement) this));
- this.singleClickTimer.Change(WinApi.GetDoubleClickTime(), -1);
- }
- private void OnToolTipChange(bool visible)
- {
- if (this.TrayToolTipResolved == null)
- return;
- if (visible)
- {
- if (this.IsPopupOpen || this.RaisePreviewTrayToolTipOpenEvent().Handled)
- return;
- this.TrayToolTipResolved.IsOpen = true;
- if (this.TrayToolTip != null)
- TaskbarIcon.RaiseToolTipOpenedEvent((DependencyObject) this.TrayToolTip);
- this.RaiseTrayToolTipOpenEvent();
- }
- else
- {
- if (this.RaisePreviewTrayToolTipCloseEvent().Handled)
- return;
- if (this.TrayToolTip != null)
- TaskbarIcon.RaiseToolTipCloseEvent((DependencyObject) this.TrayToolTip);
- this.TrayToolTipResolved.IsOpen = false;
- this.RaiseTrayToolTipCloseEvent();
- }
- }
- private void CreateCustomToolTip()
- {
- ToolTip toolTip = this.TrayToolTip as ToolTip;
- if (toolTip == null && this.TrayToolTip != null)
- {
- toolTip = new ToolTip();
- toolTip.Placement = PlacementMode.Mouse;
- toolTip.HasDropShadow = false;
- toolTip.BorderThickness = new Thickness(0.0);
- toolTip.Background = (System.Windows.Media.Brush) System.Windows.Media.Brushes.Transparent;
- toolTip.StaysOpen = true;
- toolTip.Content = (object) this.TrayToolTip;
- }
- else if (toolTip == null && !string.IsNullOrEmpty(this.ToolTipText))
- {
- toolTip = new ToolTip();
- toolTip.Content = (object) this.ToolTipText;
- }
- if (toolTip != null)
- this.UpdateDataContext((FrameworkElement) toolTip, (object) null, this.DataContext);
- this.SetTrayToolTipResolved(toolTip);
- }
- private void WriteToolTipSettings()
- {
- this.iconData.ToolTipText = this.ToolTipText;
- if (this.messageSink.Version == NotifyIconVersion.Vista && string.IsNullOrEmpty(this.iconData.ToolTipText) && this.TrayToolTipResolved != null)
- this.iconData.ToolTipText = "ToolTip";
- Util.WriteIconData(ref this.iconData, NotifyCommand.Modify, IconDataMembers.Tip);
- }
- private void CreatePopup()
- {
- Popup popup = this.TrayPopup as Popup;
- if (popup == null && this.TrayPopup != null)
- {
- popup = new Popup();
- popup.AllowsTransparency = true;
- popup.PopupAnimation = PopupAnimation.None;
- popup.Child = this.TrayPopup;
- popup.Placement = PlacementMode.AbsolutePoint;
- popup.StaysOpen = false;
- }
- if (popup != null)
- this.UpdateDataContext((FrameworkElement) popup, (object) null, this.DataContext);
- this.SetTrayPopupResolved(popup);
- }
- private void ShowTrayPopup(WinApp.Tray.RichNotifyIcon.Interop.Point cursorPosition)
- {
- if (this.IsDisposed || this.RaisePreviewTrayPopupOpenEvent().Handled || this.TrayPopup == null)
- return;
- this.TrayPopupResolved.Placement = PlacementMode.AbsolutePoint;
- this.TrayPopupResolved.HorizontalOffset = (double) cursorPosition.X;
- this.TrayPopupResolved.VerticalOffset = (double) cursorPosition.Y;
- this.TrayPopupResolved.IsOpen = true;
- IntPtr hWnd = IntPtr.Zero;
- if (this.TrayPopupResolved.Child != null)
- {
- HwndSource hwndSource = (HwndSource) PresentationSource.FromVisual((Visual) this.TrayPopupResolved.Child);
- if (hwndSource != null)
- hWnd = hwndSource.Handle;
- }
- if (hWnd == IntPtr.Zero)
- hWnd = this.messageSink.MessageWindowHandle;
- WinApi.SetForegroundWindow(hWnd);
- if (this.TrayPopup != null)
- TaskbarIcon.RaisePopupOpenedEvent((DependencyObject) this.TrayPopup);
- this.RaiseTrayPopupOpenEvent();
- }
- private void ShowContextMenu(WinApp.Tray.RichNotifyIcon.Interop.Point cursorPosition)
- {
- if (this.IsDisposed || this.RaisePreviewTrayContextMenuOpenEvent().Handled || this.ContextMenu == null)
- return;
- this.ContextMenu.Placement = PlacementMode.AbsolutePoint;
- this.ContextMenu.HorizontalOffset = (double) cursorPosition.X;
- this.ContextMenu.VerticalOffset = (double) cursorPosition.Y;
- this.ContextMenu.IsOpen = true;
- IntPtr hWnd = IntPtr.Zero;
- HwndSource hwndSource = (HwndSource) PresentationSource.FromVisual((Visual) this.ContextMenu);
- if (hwndSource != null)
- hWnd = hwndSource.Handle;
- if (hWnd == IntPtr.Zero)
- hWnd = this.messageSink.MessageWindowHandle;
- WinApi.SetForegroundWindow(hWnd);
- this.RaiseTrayContextMenuOpenEvent();
- }
- private void OnBalloonToolTipChanged(bool visible)
- {
- if (visible)
- this.RaiseTrayBalloonTipShownEvent();
- else
- this.RaiseTrayBalloonTipClosedEvent();
- }
- public void ShowBalloonTip(string title, string message, BalloonIcon symbol)
- {
- lock (this)
- this.ShowBalloonTip(title, message, Util.GetBalloonFlag(symbol), IntPtr.Zero);
- }
- public void ShowBalloonTip(string title, string message, Icon customIcon)
- {
- if (customIcon == null)
- throw new ArgumentNullException("customIcon");
- lock (this)
- this.ShowBalloonTip(title, message, BalloonFlags.User, customIcon.Handle);
- }
- private void ShowBalloonTip(string title, string message, BalloonFlags flags, IntPtr balloonIconHandle)
- {
- this.EnsureNotDisposed();
- this.iconData.BalloonText = message ?? string.Empty;
- this.iconData.BalloonTitle = title ?? string.Empty;
- this.iconData.BalloonFlags = flags;
- this.iconData.CustomBalloonIconHandle = balloonIconHandle;
- Util.WriteIconData(ref this.iconData, NotifyCommand.Modify, IconDataMembers.Icon | IconDataMembers.Info);
- }
- public void HideBalloonTip()
- {
- this.EnsureNotDisposed();
- this.iconData.BalloonText = this.iconData.BalloonTitle = string.Empty;
- Util.WriteIconData(ref this.iconData, NotifyCommand.Modify, IconDataMembers.Info);
- }
- private void DoSingleClickAction(object state)
- {
- if (this.IsDisposed)
- return;
- Action action = this.singleClickTimerAction;
- if (action == null)
- return;
- this.singleClickTimerAction = (Action) null;
- Util.GetDispatcher((DispatcherObject) this).Invoke((Delegate) action);
- }
- private void SetVersion()
- {
- this.iconData.VersionOrTimeout = 4U;
- bool flag = WinApi.Shell_NotifyIcon(NotifyCommand.SetVersion, ref this.iconData);
- if (!flag)
- {
- this.iconData.VersionOrTimeout = 3U;
- flag = Util.WriteIconData(ref this.iconData, NotifyCommand.SetVersion);
- }
- if (!flag)
- {
- this.iconData.VersionOrTimeout = 0U;
- flag = Util.WriteIconData(ref this.iconData, NotifyCommand.SetVersion);
- }
- int num = flag ? 1 : 0;
- }
- private void OnTaskbarCreated()
- {
- this.IsTaskbarIconCreated = false;
- this.CreateTaskbarIcon();
- }
- private void CreateTaskbarIcon()
- {
- lock (this)
- {
- if (this.IsTaskbarIconCreated || !Util.WriteIconData(ref this.iconData, NotifyCommand.Add, IconDataMembers.Message | IconDataMembers.Icon | IconDataMembers.Tip))
- return;
- this.SetVersion();
- this.messageSink.Version = (NotifyIconVersion) this.iconData.VersionOrTimeout;
- this.IsTaskbarIconCreated = true;
- }
- }
- private void RemoveTaskbarIcon()
- {
- lock (this)
- {
- if (!this.IsTaskbarIconCreated)
- return;
- Util.WriteIconData(ref this.iconData, NotifyCommand.Delete, IconDataMembers.Message);
- this.IsTaskbarIconCreated = false;
- }
- }
- private WinApp.Tray.RichNotifyIcon.Interop.Point GetDeviceCoordinates(WinApp.Tray.RichNotifyIcon.Interop.Point point)
- {
- if (double.IsNaN(this.scalingFactor))
- {
- PresentationSource presentationSource = PresentationSource.FromVisual((Visual) this);
- this.scalingFactor = presentationSource != null ? 1.0 / presentationSource.CompositionTarget.TransformToDevice.M11 : 1.0;
- }
- if (this.scalingFactor == 1.0)
- return point;
- return new WinApp.Tray.RichNotifyIcon.Interop.Point()
- {
- X = (int) ((double) point.X * this.scalingFactor),
- Y = (int) ((double) point.Y * this.scalingFactor)
- };
- }
- private void EnsureNotDisposed()
- {
- if (this.IsDisposed)
- throw new ObjectDisposedException(this.Name ?? this.GetType().FullName);
- }
- private void OnExit(object sender, EventArgs e)
- {
- this.Dispose();
- }
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize((object) this);
- }
- private void Dispose(bool disposing)
- {
- if (this.IsDisposed || !disposing)
- return;
- lock (this)
- {
- this.IsDisposed = true;
- if (Application.Current != null)
- Application.Current.Exit -= new ExitEventHandler(this.OnExit);
- this.singleClickTimer.Dispose();
- this.balloonCloseTimer.Dispose();
- this.messageSink.Dispose();
- this.RemoveTaskbarIcon();
- }
- }
- protected void SetTrayPopupResolved(Popup value)
- {
- this.SetValue(TaskbarIcon.TrayPopupResolvedPropertyKey, (object) value);
- }
- protected void SetTrayToolTipResolved(ToolTip value)
- {
- this.SetValue(TaskbarIcon.TrayToolTipResolvedPropertyKey, (object) value);
- }
- protected void SetCustomBalloon(Popup value)
- {
- this.SetValue(TaskbarIcon.CustomBalloonPropertyKey, (object) value);
- }
- private static void IconSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnIconSourcePropertyChanged(e);
- }
- private void OnIconSourcePropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- ImageSource imageSource = (ImageSource) e.NewValue;
- if (Util.IsDesignMode)
- return;
- this.Icon = Util.ToIcon(imageSource);
- }
- private static void ToolTipTextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnToolTipTextPropertyChanged(e);
- }
- private void OnToolTipTextPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if (this.TrayToolTip == null)
- {
- ToolTip trayToolTipResolved = this.TrayToolTipResolved;
- if (trayToolTipResolved == null)
- this.CreateCustomToolTip();
- else
- trayToolTipResolved.Content = e.NewValue;
- }
- this.WriteToolTipSettings();
- }
- private static void TrayToolTipPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnTrayToolTipPropertyChanged(e);
- }
- private void OnTrayToolTipPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- this.CreateCustomToolTip();
- if (e.OldValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.OldValue, (TaskbarIcon) null);
- if (e.NewValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- this.WriteToolTipSettings();
- }
- private static void TrayPopupPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnTrayPopupPropertyChanged(e);
- }
- private void OnTrayPopupPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.OldValue, (TaskbarIcon) null);
- if (e.NewValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- this.CreatePopup();
- }
- private static void VisibilityPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnVisibilityPropertyChanged(e);
- }
- private void OnVisibilityPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if ((Visibility) e.NewValue == Visibility.Visible)
- this.CreateTaskbarIcon();
- else
- this.RemoveTaskbarIcon();
- }
- private void UpdateDataContext(FrameworkElement target, object oldDataContextValue, object newDataContextValue)
- {
- if (target == null || Util.IsDataContextDataBound(target) || !object.ReferenceEquals((object) this, target.DataContext) && !object.Equals(oldDataContextValue, target.DataContext))
- return;
- target.DataContext = newDataContextValue ?? (object) this;
- }
- private static void DataContextPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnDataContextPropertyChanged(e);
- }
- private void OnDataContextPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- object newValue = e.NewValue;
- object oldValue = e.OldValue;
- this.UpdateDataContext((FrameworkElement) this.TrayPopupResolved, oldValue, newValue);
- this.UpdateDataContext((FrameworkElement) this.TrayToolTipResolved, oldValue, newValue);
- this.UpdateDataContext((FrameworkElement) this.ContextMenu, oldValue, newValue);
- }
- private static void ContextMenuPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- ((TaskbarIcon) d).OnContextMenuPropertyChanged(e);
- }
- private void OnContextMenuPropertyChanged(DependencyPropertyChangedEventArgs e)
- {
- if (e.OldValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.OldValue, (TaskbarIcon) null);
- if (e.NewValue != null)
- TaskbarIcon.SetParentTaskbarIcon((DependencyObject) e.NewValue, this);
- this.UpdateDataContext((FrameworkElement) e.NewValue, (object) null, this.DataContext);
- }
- protected RoutedEventArgs RaiseTrayLeftMouseDownEvent()
- {
- return TaskbarIcon.RaiseTrayLeftMouseDownEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayLeftMouseDownEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayLeftMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayRightMouseDownEvent()
- {
- return TaskbarIcon.RaiseTrayRightMouseDownEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayRightMouseDownEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayRightMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayMiddleMouseDownEvent()
- {
- return TaskbarIcon.RaiseTrayMiddleMouseDownEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayMiddleMouseDownEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayMiddleMouseDownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayLeftMouseUpEvent()
- {
- return TaskbarIcon.RaiseTrayLeftMouseUpEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayLeftMouseUpEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayLeftMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayRightMouseUpEvent()
- {
- return TaskbarIcon.RaiseTrayRightMouseUpEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayRightMouseUpEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayRightMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayMiddleMouseUpEvent()
- {
- return TaskbarIcon.RaiseTrayMiddleMouseUpEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayMiddleMouseUpEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayMiddleMouseUpEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayMouseDoubleClickEvent()
- {
- RoutedEventArgs routedEventArgs = TaskbarIcon.RaiseTrayMouseDoubleClickEvent((DependencyObject) this);
- Util.ExecuteIfEnabled(this.DoubleClickCommand, this.DoubleClickCommandParameter, this.DoubleClickCommandTarget ?? (IInputElement) this);
- return routedEventArgs;
- }
- internal static RoutedEventArgs RaiseTrayMouseDoubleClickEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayMouseDoubleClickEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayMouseMoveEvent()
- {
- return TaskbarIcon.RaiseTrayMouseMoveEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayMouseMoveEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayMouseMoveEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayBalloonTipShownEvent()
- {
- return TaskbarIcon.RaiseTrayBalloonTipShownEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayBalloonTipShownEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayBalloonTipShownEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayBalloonTipClosedEvent()
- {
- return TaskbarIcon.RaiseTrayBalloonTipClosedEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayBalloonTipClosedEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayBalloonTipClosedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayBalloonTipClickedEvent()
- {
- return TaskbarIcon.RaiseTrayBalloonTipClickedEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayBalloonTipClickedEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayBalloonTipClickedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayContextMenuOpenEvent()
- {
- return TaskbarIcon.RaiseTrayContextMenuOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayContextMenuOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayContextMenuOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent()
- {
- return TaskbarIcon.RaisePreviewTrayContextMenuOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaisePreviewTrayContextMenuOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.PreviewTrayContextMenuOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayPopupOpenEvent()
- {
- return TaskbarIcon.RaiseTrayPopupOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayPopupOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayPopupOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaisePreviewTrayPopupOpenEvent()
- {
- return TaskbarIcon.RaisePreviewTrayPopupOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaisePreviewTrayPopupOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.PreviewTrayPopupOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayToolTipOpenEvent()
- {
- return TaskbarIcon.RaiseTrayToolTipOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayToolTipOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayToolTipOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaisePreviewTrayToolTipOpenEvent()
- {
- return TaskbarIcon.RaisePreviewTrayToolTipOpenEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaisePreviewTrayToolTipOpenEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.PreviewTrayToolTipOpenEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaiseTrayToolTipCloseEvent()
- {
- return TaskbarIcon.RaiseTrayToolTipCloseEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaiseTrayToolTipCloseEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.TrayToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- protected RoutedEventArgs RaisePreviewTrayToolTipCloseEvent()
- {
- return TaskbarIcon.RaisePreviewTrayToolTipCloseEvent((DependencyObject) this);
- }
- internal static RoutedEventArgs RaisePreviewTrayToolTipCloseEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.PreviewTrayToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static void AddPopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, TaskbarIcon.PopupOpenedEvent, (Delegate) handler);
- }
- public static void RemovePopupOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, TaskbarIcon.PopupOpenedEvent, (Delegate) handler);
- }
- internal static RoutedEventArgs RaisePopupOpenedEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.PopupOpenedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static void AddToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, TaskbarIcon.ToolTipOpenedEvent, (Delegate) handler);
- }
- public static void RemoveToolTipOpenedHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, TaskbarIcon.ToolTipOpenedEvent, (Delegate) handler);
- }
- internal static RoutedEventArgs RaiseToolTipOpenedEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.ToolTipOpenedEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static void AddToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, TaskbarIcon.ToolTipCloseEvent, (Delegate) handler);
- }
- public static void RemoveToolTipCloseHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, TaskbarIcon.ToolTipCloseEvent, (Delegate) handler);
- }
- internal static RoutedEventArgs RaiseToolTipCloseEvent(DependencyObject target)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs();
- args.RoutedEvent = TaskbarIcon.ToolTipCloseEvent;
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static void AddBalloonShowingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, TaskbarIcon.BalloonShowingEvent, (Delegate) handler);
- }
- public static void RemoveBalloonShowingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, TaskbarIcon.BalloonShowingEvent, (Delegate) handler);
- }
- internal static RoutedEventArgs RaiseBalloonShowingEvent(DependencyObject target, TaskbarIcon source)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs(TaskbarIcon.BalloonShowingEvent, (object) source);
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static void AddBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.AddHandler(element, TaskbarIcon.BalloonClosingEvent, (Delegate) handler);
- }
- public static void RemoveBalloonClosingHandler(DependencyObject element, RoutedEventHandler handler)
- {
- RoutedEventHelper.RemoveHandler(element, TaskbarIcon.BalloonClosingEvent, (Delegate) handler);
- }
- internal static RoutedEventArgs RaiseBalloonClosingEvent(DependencyObject target, TaskbarIcon source)
- {
- if (target == null)
- return (RoutedEventArgs) null;
- RoutedEventArgs args = new RoutedEventArgs(TaskbarIcon.BalloonClosingEvent, (object) source);
- RoutedEventHelper.RaiseEvent(target, args);
- return args;
- }
- public static TaskbarIcon GetParentTaskbarIcon(DependencyObject d)
- {
- return (TaskbarIcon) d.GetValue(TaskbarIcon.ParentTaskbarIconProperty);
- }
- public static void SetParentTaskbarIcon(DependencyObject d, TaskbarIcon value)
- {
- d.SetValue(TaskbarIcon.ParentTaskbarIconProperty, (object) value);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.BalloonIcon
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon
- {
- public enum BalloonIcon
- {
- None,
- Info,
- Warning,
- Error,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Util
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.ComponentModel;
- using System.Drawing;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Resources;
- using System.Windows.Threading;
- using WinApp.Tray.RichNotifyIcon.Interop;
- namespace WinApp.Tray.RichNotifyIcon
- {
- internal static class Util
- {
- public static readonly object SyncRoot = new object();
- private static readonly bool isDesignMode = (bool) DependencyPropertyDescriptor.FromProperty(DesignerProperties.IsInDesignModeProperty, typeof (FrameworkElement)).Metadata.DefaultValue;
- public static bool IsDesignMode
- {
- get
- {
- return Util.isDesignMode;
- }
- }
- public static Window CreateHelperWindow()
- {
- Window window = new Window();
- window.Width = 0.0;
- window.Height = 0.0;
- window.ShowInTaskbar = false;
- window.WindowStyle = WindowStyle.None;
- window.AllowsTransparency = true;
- window.Opacity = 0.0;
- return window;
- }
- public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command)
- {
- return Util.WriteIconData(ref data, command, data.ValidMembers);
- }
- public static bool WriteIconData(ref NotifyIconData data, NotifyCommand command, IconDataMembers flags)
- {
- if (Util.IsDesignMode)
- return true;
- data.ValidMembers = flags;
- lock (Util.SyncRoot)
- return WinApi.Shell_NotifyIcon(command, ref data);
- }
- public static BalloonFlags GetBalloonFlag(this BalloonIcon icon)
- {
- switch (icon)
- {
- case BalloonIcon.None:
- return BalloonFlags.None;
- case BalloonIcon.Info:
- return BalloonFlags.Info;
- case BalloonIcon.Warning:
- return BalloonFlags.Warning;
- case BalloonIcon.Error:
- return BalloonFlags.Error;
- default:
- throw new ArgumentOutOfRangeException("icon");
- }
- }
- public static Icon ToIcon(this ImageSource imageSource)
- {
- if (imageSource == null)
- return (Icon) null;
- StreamResourceInfo resourceStream = Application.GetResourceStream(new Uri(imageSource.ToString()));
- if (resourceStream == null)
- throw new ArgumentException(string.Format("The supplied image source '{0}' could not be resolved.", (object) imageSource));
- return new Icon(resourceStream.Stream);
- }
- public static bool Is<T>(this T value, params T[] candidates)
- {
- if (candidates == null)
- return false;
- foreach (T obj in candidates)
- {
- if (value.Equals((object) obj))
- return true;
- }
- return false;
- }
- public static bool IsMatch(this MouseEvent me, PopupActivationMode activationMode)
- {
- switch (activationMode)
- {
- case PopupActivationMode.LeftClick:
- return me == MouseEvent.IconLeftMouseUp;
- case PopupActivationMode.RightClick:
- return me == MouseEvent.IconRightMouseUp;
- case PopupActivationMode.DoubleClick:
- return Util.Is<MouseEvent>(me, MouseEvent.IconDoubleClick);
- case PopupActivationMode.LeftOrRightClick:
- return Util.Is<MouseEvent>(me, MouseEvent.IconLeftMouseUp, MouseEvent.IconRightMouseUp);
- case PopupActivationMode.LeftOrDoubleClick:
- return Util.Is<MouseEvent>(me, MouseEvent.IconLeftMouseUp, MouseEvent.IconDoubleClick);
- case PopupActivationMode.MiddleClick:
- return me == MouseEvent.IconMiddleMouseUp;
- case PopupActivationMode.All:
- return me != MouseEvent.MouseMove;
- default:
- throw new ArgumentOutOfRangeException("activationMode");
- }
- }
- public static void ExecuteIfEnabled(this ICommand command, object commandParameter, IInputElement target)
- {
- if (command == null)
- return;
- RoutedCommand routedCommand = command as RoutedCommand;
- if (routedCommand != null)
- {
- if (!routedCommand.CanExecute(commandParameter, target))
- return;
- routedCommand.Execute(commandParameter, target);
- }
- else
- {
- if (!command.CanExecute(commandParameter))
- return;
- command.Execute(commandParameter);
- }
- }
- internal static Dispatcher GetDispatcher(this DispatcherObject source)
- {
- if (Application.Current != null)
- return Application.Current.Dispatcher;
- if (source.Dispatcher != null)
- return source.Dispatcher;
- return Dispatcher.CurrentDispatcher;
- }
- public static bool IsDataContextDataBound(this FrameworkElement element)
- {
- if (element == null)
- throw new ArgumentNullException("element");
- return element.GetBindingExpression(FrameworkElement.DataContextProperty) != null;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.NotifyIconData
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Runtime.InteropServices;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct NotifyIconData
- {
- public uint cbSize;
- public IntPtr WindowHandle;
- public uint TaskbarIconId;
- public IconDataMembers ValidMembers;
- public uint CallbackMessageId;
- public IntPtr IconHandle;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
- public string ToolTipText;
- public IconState IconState;
- public IconState StateMask;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
- public string BalloonText;
- public uint VersionOrTimeout;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
- public string BalloonTitle;
- public BalloonFlags BalloonFlags;
- public Guid TaskbarIconGuid;
- public IntPtr CustomBalloonIconHandle;
- public static NotifyIconData CreateDefault(IntPtr handle)
- {
- NotifyIconData notifyIconData = new NotifyIconData();
- if (Environment.OSVersion.Version.Major >= 6)
- {
- notifyIconData.cbSize = (uint) Marshal.SizeOf((object) notifyIconData);
- }
- else
- {
- notifyIconData.cbSize = 952U;
- notifyIconData.VersionOrTimeout = 10U;
- }
- notifyIconData.WindowHandle = handle;
- notifyIconData.TaskbarIconId = 0U;
- notifyIconData.CallbackMessageId = 1024U;
- notifyIconData.VersionOrTimeout = 0U;
- notifyIconData.IconHandle = IntPtr.Zero;
- notifyIconData.IconState = IconState.Hidden;
- notifyIconData.StateMask = IconState.Hidden;
- notifyIconData.ValidMembers = IconDataMembers.Message | IconDataMembers.Icon | IconDataMembers.Tip;
- notifyIconData.ToolTipText = notifyIconData.BalloonText = notifyIconData.BalloonTitle = string.Empty;
- return notifyIconData;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.Point
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public struct Point
- {
- public int X;
- public int Y;
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.WindowProcedureHandler
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public delegate IntPtr WindowProcedureHandler(IntPtr hwnd, uint uMsg, IntPtr wparam, IntPtr lparam);
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.WinApi
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Runtime.InteropServices;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- internal static class WinApi
- {
- [DllImport("shell32.Dll", CharSet = CharSet.Unicode)]
- public static extern bool Shell_NotifyIcon(NotifyCommand cmd, [In] ref NotifyIconData data);
- [DllImport("USER32.DLL", EntryPoint = "CreateWindowExW", SetLastError = true)]
- public static extern IntPtr CreateWindowEx(int dwExStyle, [MarshalAs(UnmanagedType.LPWStr)] string lpClassName, [MarshalAs(UnmanagedType.LPWStr)] string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, IntPtr hWndParent, IntPtr hMenu, IntPtr hInstance, IntPtr lpParam);
- [DllImport("USER32.DLL")]
- public static extern IntPtr DefWindowProc(IntPtr hWnd, uint msg, IntPtr wparam, IntPtr lparam);
- [DllImport("USER32.DLL", EntryPoint = "RegisterClassW", SetLastError = true)]
- public static extern short RegisterClass(ref WindowClass lpWndClass);
- [DllImport("User32.Dll", EntryPoint = "RegisterWindowMessageW")]
- public static extern uint RegisterWindowMessage([MarshalAs(UnmanagedType.LPWStr)] string lpString);
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool DestroyWindow(IntPtr hWnd);
- [DllImport("USER32.DLL")]
- public static extern bool SetForegroundWindow(IntPtr hWnd);
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- public static extern int GetDoubleClickTime();
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool GetPhysicalCursorPos(ref Point lpPoint);
- [DllImport("USER32.DLL", SetLastError = true)]
- public static extern bool GetCursorPos(ref Point lpPoint);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.MouseEvent
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public enum MouseEvent
- {
- MouseMove,
- IconRightMouseDown,
- IconLeftMouseDown,
- IconRightMouseUp,
- IconLeftMouseUp,
- IconMiddleMouseDown,
- IconMiddleMouseUp,
- IconDoubleClick,
- BalloonToolTipClicked,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.AppBarInfo
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Drawing;
- using System.Runtime.InteropServices;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- internal class AppBarInfo
- {
- private const int ABE_BOTTOM = 3;
- private const int ABE_LEFT = 0;
- private const int ABE_RIGHT = 2;
- private const int ABE_TOP = 1;
- private const int ABM_GETTASKBARPOS = 5;
- private const uint SPI_GETWORKAREA = 48;
- private AppBarInfo.APPBARDATA m_data;
- public AppBarInfo.ScreenEdge Edge
- {
- get
- {
- return (AppBarInfo.ScreenEdge) this.m_data.uEdge;
- }
- }
- public Rectangle WorkArea
- {
- get
- {
- AppBarInfo.RECT rect1 = new AppBarInfo.RECT();
- IntPtr num1 = Marshal.AllocHGlobal(Marshal.SizeOf((object) rect1));
- int num2 = AppBarInfo.SystemParametersInfo(48U, 0U, num1, 0U);
- AppBarInfo.RECT rect2 = (AppBarInfo.RECT) Marshal.PtrToStructure(num1, rect1.GetType());
- if (num2 != 1)
- return new Rectangle(0, 0, 0, 0);
- Marshal.FreeHGlobal(num1);
- return new Rectangle(rect2.left, rect2.top, rect2.right - rect2.left, rect2.bottom - rect2.top);
- }
- }
- [DllImport("user32.dll")]
- private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
- [DllImport("shell32.dll")]
- private static extern uint SHAppBarMessage(uint dwMessage, ref AppBarInfo.APPBARDATA data);
- [DllImport("user32.dll")]
- private static extern int SystemParametersInfo(uint uiAction, uint uiParam, IntPtr pvParam, uint fWinIni);
- public void GetPosition(string strClassName, string strWindowName)
- {
- this.m_data = new AppBarInfo.APPBARDATA();
- this.m_data.cbSize = (uint) Marshal.SizeOf(this.m_data.GetType());
- if (!(AppBarInfo.FindWindow(strClassName, strWindowName) != IntPtr.Zero))
- throw new Exception("Failed to find an AppBar that matched the given criteria");
- if ((int) AppBarInfo.SHAppBarMessage(5U, ref this.m_data) != 1)
- throw new Exception("Failed to communicate with the given AppBar");
- }
- public void GetSystemTaskBarPosition()
- {
- this.GetPosition("Shell_TrayWnd", (string) null);
- }
- public enum ScreenEdge
- {
- Undefined = -1,
- Left = 0,
- Top = 1,
- Right = 2,
- Bottom = 3,
- }
- private struct APPBARDATA
- {
- public uint cbSize;
- public IntPtr hWnd;
- public uint uCallbackMessage;
- public uint uEdge;
- public AppBarInfo.RECT rc;
- public int lParam;
- }
- private struct RECT
- {
- public int left;
- public int top;
- public int right;
- public int bottom;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.NotifyIconVersion
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public enum NotifyIconVersion
- {
- Win95 = 0,
- Win2000 = 3,
- Vista = 4,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.BalloonFlags
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public enum BalloonFlags
- {
- None = 0,
- Info = 1,
- Warning = 2,
- Error = 3,
- User = 4,
- NoSound = 16,
- LargeIcon = 32,
- RespectQuietTime = 128,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.IconState
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public enum IconState
- {
- Visible,
- Hidden,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.WindowClass
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Runtime.InteropServices;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public struct WindowClass
- {
- public uint style;
- public WindowProcedureHandler lpfnWndProc;
- public int cbClsExtra;
- public int cbWndExtra;
- public IntPtr hInstance;
- public IntPtr hIcon;
- public IntPtr hCursor;
- public IntPtr hbrBackground;
- [MarshalAs(UnmanagedType.LPWStr)]
- public string lpszMenuName;
- [MarshalAs(UnmanagedType.LPWStr)]
- public string lpszClassName;
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.WindowMessageSink
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.ComponentModel;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public class WindowMessageSink : IDisposable
- {
- public const int CallbackMessageId = 1024;
- private uint taskbarRestartMessageId;
- private bool isDoubleClick;
- private WindowProcedureHandler messageHandler;
- internal string WindowId { get; private set; }
- internal IntPtr MessageWindowHandle { get; private set; }
- public NotifyIconVersion Version { get; set; }
- public bool IsDisposed { get; private set; }
- public event Action<bool> ChangeToolTipStateRequest;
- public event Action<MouseEvent> MouseEventReceived;
- public event Action<bool> BalloonToolTipChanged;
- public event Action TaskbarCreated;
- public WindowMessageSink(NotifyIconVersion version)
- {
- this.Version = version;
- this.CreateMessageWindow();
- }
- private WindowMessageSink()
- {
- }
- ~WindowMessageSink()
- {
- this.Dispose(false);
- }
- internal static WindowMessageSink CreateEmpty()
- {
- return new WindowMessageSink()
- {
- MessageWindowHandle = IntPtr.Zero,
- Version = NotifyIconVersion.Vista
- };
- }
- private void CreateMessageWindow()
- {
- this.WindowId = "WPFTaskbarIcon_" + (object) DateTime.Now.Ticks;
- this.messageHandler = new WindowProcedureHandler(this.OnWindowMessageReceived);
- WindowClass lpWndClass;
- lpWndClass.style = 0U;
- lpWndClass.lpfnWndProc = this.messageHandler;
- lpWndClass.cbClsExtra = 0;
- lpWndClass.cbWndExtra = 0;
- lpWndClass.hInstance = IntPtr.Zero;
- lpWndClass.hIcon = IntPtr.Zero;
- lpWndClass.hCursor = IntPtr.Zero;
- lpWndClass.hbrBackground = IntPtr.Zero;
- lpWndClass.lpszMenuName = "";
- lpWndClass.lpszClassName = this.WindowId;
- int num = (int) WinApi.RegisterClass(ref lpWndClass);
- this.taskbarRestartMessageId = WinApi.RegisterWindowMessage("TaskbarCreated");
- this.MessageWindowHandle = WinApi.CreateWindowEx(0, this.WindowId, "", 0, 0, 0, 1, 1, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
- if (this.MessageWindowHandle == IntPtr.Zero)
- throw new Win32Exception("Message window handle was not a valid pointer");
- }
- private IntPtr OnWindowMessageReceived(IntPtr hwnd, uint messageId, IntPtr wparam, IntPtr lparam)
- {
- if ((int) messageId == (int) this.taskbarRestartMessageId)
- this.TaskbarCreated();
- this.ProcessWindowMessage(messageId, wparam, lparam);
- return WinApi.DefWindowProc(hwnd, messageId, wparam, lparam);
- }
- private void ProcessWindowMessage(uint msg, IntPtr wParam, IntPtr lParam)
- {
- if ((int) msg != 1024)
- return;
- switch (lParam.ToInt32())
- {
- case 512:
- this.MouseEventReceived(MouseEvent.MouseMove);
- break;
- case 513:
- this.MouseEventReceived(MouseEvent.IconLeftMouseDown);
- break;
- case 514:
- if (!this.isDoubleClick)
- this.MouseEventReceived(MouseEvent.IconLeftMouseUp);
- this.isDoubleClick = false;
- break;
- case 515:
- this.isDoubleClick = true;
- this.MouseEventReceived(MouseEvent.IconDoubleClick);
- break;
- case 516:
- this.MouseEventReceived(MouseEvent.IconRightMouseDown);
- break;
- case 517:
- this.MouseEventReceived(MouseEvent.IconRightMouseUp);
- break;
- case 519:
- this.MouseEventReceived(MouseEvent.IconMiddleMouseDown);
- break;
- case 520:
- this.MouseEventReceived(MouseEvent.IconMiddleMouseUp);
- break;
- case 1026:
- this.BalloonToolTipChanged(true);
- break;
- case 1027:
- case 1028:
- this.BalloonToolTipChanged(false);
- break;
- case 1029:
- this.MouseEventReceived(MouseEvent.BalloonToolTipClicked);
- break;
- case 1030:
- this.ChangeToolTipStateRequest(true);
- break;
- case 1031:
- this.ChangeToolTipStateRequest(false);
- break;
- }
- }
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize((object) this);
- }
- private void Dispose(bool disposing)
- {
- if (this.IsDisposed)
- return;
- this.IsDisposed = true;
- WinApi.DestroyWindow(this.MessageWindowHandle);
- this.messageHandler = (WindowProcedureHandler) null;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.TrayInfo
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Drawing;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public static class TrayInfo
- {
- public static Point GetTrayLocation()
- {
- AppBarInfo appBarInfo = new AppBarInfo();
- appBarInfo.GetSystemTaskBarPosition();
- Rectangle workArea = appBarInfo.WorkArea;
- int num1 = 0;
- int num2 = 0;
- if (appBarInfo.Edge == AppBarInfo.ScreenEdge.Left)
- {
- num1 = workArea.Left + 2;
- num2 = workArea.Bottom;
- }
- else if (appBarInfo.Edge == AppBarInfo.ScreenEdge.Bottom)
- {
- num1 = workArea.Right;
- num2 = workArea.Bottom;
- }
- else if (appBarInfo.Edge == AppBarInfo.ScreenEdge.Top)
- {
- num1 = workArea.Right;
- num2 = workArea.Top;
- }
- else if (appBarInfo.Edge == AppBarInfo.ScreenEdge.Right)
- {
- num1 = workArea.Right;
- num2 = workArea.Bottom;
- }
- return new Point()
- {
- X = num1,
- Y = num2
- };
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.IconDataMembers
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- [Flags]
- public enum IconDataMembers
- {
- Message = 1,
- Icon = 2,
- Tip = 4,
- State = 8,
- Info = 16,
- Realtime = 64,
- UseLegacyToolTips = 128,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Tray.RichNotifyIcon.Interop.NotifyCommand
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Tray.RichNotifyIcon.Interop
- {
- public enum NotifyCommand
- {
- Add,
- Modify,
- Delete,
- SetFocus,
- SetVersion,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.LoginState
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp
- {
- internal enum LoginState
- {
- NoLogin,
- Done,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.App
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using System;
- using System.CodeDom.Compiler;
- using System.Configuration;
- using System.Diagnostics;
- using System.IO;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.Windows;
- using System.Windows.Threading;
- using WinApp.ViewModel;
- namespace WinApp
- {
- internal class App : Application
- {
- private const string _appName = "KairosPlanet";
- private static Mutex _instanceMutex;
- private bool _contentLoaded;
- public App()
- {
- Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(this.Application_DispatcherUnhandledException);
- WinApp.Managers.Configuration.ConfigurationManager.Analyze();
- AppVM.Initialize();
- }
- protected override void OnStartup(StartupEventArgs e)
- {
- try
- {
- bool createdNew;
- App._instanceMutex = new Mutex(true, "KairosPlanet", out createdNew);
- if (!createdNew)
- {
- App.SendMessage();
- this.Shutdown();
- }
- else
- {
- this.SetOverrideLogFile();
- Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
- AppVM.Instance.OnStartUp();
- base.OnStartup(e);
- }
- }
- catch (FileLoadException ex)
- {
- Logger.WriteError((object) this, "FileLoadException", "?????? ??? ????????? ???????? , ??????: " + ex.Message, (Exception) ex);
- int num = (int) MessageBox.Show("?????? ??? ????????? ????????, ?????????? ?? ????? ????????? ????????, ??? ????? ???????");
- this.Shutdown();
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "UnhandledException", "???????????? ??????????, ????????? ??????: " + (object) e, ex);
- }
- }
- [DllImport("user32.dll", CharSet = CharSet.Auto)]
- private static extern int SendNotifyMessage(IntPtr hwnd, IntPtr wMsg, IntPtr wParam, IntPtr lParam);
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern uint RegisterWindowMessage(string lpString);
- private static void SendMessage()
- {
- App.SendNotifyMessage((IntPtr) ((int) ushort.MaxValue), (IntPtr) ((long) App.RegisterWindowMessage("KairosPlanetMessage")), Marshal.StringToHGlobalAuto("ShowMainWindow"), Marshal.StringToHGlobalAuto("another message"));
- }
- private static void SaveParametrToAppConfig(string strSettingsName, string value)
- {
- Configuration configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
- KeyValueConfigurationElement configurationElement = configuration.AppSettings.Settings[strSettingsName];
- if (configurationElement != null)
- {
- if (configurationElement.Value == value)
- return;
- configurationElement.Value = value;
- }
- else
- configuration.AppSettings.Settings.Add(strSettingsName, value);
- configuration.Save(ConfigurationSaveMode.Modified);
- }
- private void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
- {
- Logger.WriteError((object) this, "UnhandledException", "?????????? ?? ?????? ??????????. C???????? ??????: " + (object) e.Exception, e.Exception);
- e.Handled = true;
- }
- private void SetOverrideLogFile()
- {
- App.SaveParametrToAppConfig("OverrideLogFile", "True");
- }
- [DebuggerNonUserCode]
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- public void InitializeComponent()
- {
- if (this._contentLoaded)
- return;
- this._contentLoaded = true;
- Application.LoadComponent((object) this, new Uri("/KairosPlanet;component/app.xaml", UriKind.Relative));
- }
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [DebuggerNonUserCode]
- [STAThread]
- public static void Main()
- {
- App app = new App();
- app.InitializeComponent();
- app.Run();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Credentials
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Managers
- {
- public class Credentials
- {
- public string Login { get; private set; }
- public string Password { get; private set; }
- public Credentials(string login, string password)
- {
- this.Login = login;
- this.Password = password;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.IMainWindow
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using WinApp.ViewModel;
- namespace WinApp.Managers.Interfaces
- {
- internal interface IMainWindow
- {
- MainWindowVM ViewModel { get; }
- bool CloseToTray { get; set; }
- void Open();
- void Show();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.IModuleResolver
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using WinApp.Data.Model;
- using WinApp.Module;
- namespace WinApp.Managers.Interfaces
- {
- public interface IModuleResolver : IModuleCallback
- {
- IModuleManager GetModuleManager(ModuleInfo moduleInfo);
- ModuleInfo GetModuleInfo(long productId);
- bool DownloadModule(ModuleInfo moduleInfo);
- string GetActiveModuleSecureKey();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.IAppTray
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Windows;
- namespace WinApp.Managers.Interfaces
- {
- internal interface IAppTray
- {
- UIElement Tray { get; }
- void Refresh();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.ISessionManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using WinApp.Api.Data;
- using WinApp.Api.Interfaces;
- using WinApp.Data.Helpers;
- using WinApp.Data.Model;
- namespace WinApp.Managers.Interfaces
- {
- public interface ISessionManager
- {
- Man CurrentUser { get; }
- IApi Api { get; }
- LoginResponce Login(string user, string password);
- PingResponse PingSession(string activeModuleSecureKey);
- void CloseSession();
- Statistic[] GetStatistics();
- Statistic[] GetStatistics(DateTime periodStart, DateTime periodEnd);
- Purchase[] GetPurchases();
- string GetAppVersion();
- ModuleInfo GetModuleInfo(long productId);
- byte[] GetModuleContent(long productId);
- string Activation(long purchaseId);
- void UpdateUserAgentString();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.IApplicationSettings
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using WinApp.Managers.Localization;
- namespace WinApp.Managers.Interfaces
- {
- internal interface IApplicationSettings
- {
- string Email { get; set; }
- string Password { get; set; }
- string ProtectedEmail { get; set; }
- string ProtectedPassword { get; set; }
- bool IsRemeberMe { get; set; }
- bool RunAtStartup { get; set; }
- bool IsAutoLogin { get; set; }
- bool IsHttpUsed { get; set; }
- string LocalizationKey { get; set; }
- long ActiveProductId { get; set; }
- void Save();
- void SetLocalization(LocalizationObject localizationObject);
- void SetRunAtStartup(bool isRunAtStartup);
- void SetIsAutoLogin(bool isAutoLogin);
- void SetHttpPingUsed(bool isHttpPingUsed);
- LocalizationObject GetLocalizationObject();
- void RemeberMe(string email, string passwordHash);
- void ForgetMe();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.ICountriesManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Collections.Generic;
- namespace WinApp.Managers.Interfaces
- {
- internal interface ICountriesManager
- {
- List<string> GetAllCountries();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Interfaces.IScreenManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using WinApp.Module;
- using WinApp.View;
- using WinApp.ViewModel.Services;
- namespace WinApp.Managers.Interfaces
- {
- internal interface IScreenManager
- {
- MainViewUC MainView { get; }
- void DoVisualSafe(Action action);
- void ShowAlert(string message, string title);
- void SwitchToMain();
- void SwitchToLogin();
- void SwitchToInstall(InstallModuleUC installModuleUc, ServiceVM serviceVm, Action<bool> onInstalledAction);
- void SwitchToNewVersionAvailableWindow(Version appVersionOnSite, Version appVersionCurrent);
- Action ShowStatusMessage(string message, int timeInSeconds, bool isInProgress = false);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Network.NetworkStateEventArgs
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using WinApp;
- namespace WinApp.Managers.Network
- {
- internal class NetworkStateEventArgs : EventArgs
- {
- public NetworkState State { get; private set; }
- public NetworkStateEventArgs(NetworkState state)
- {
- this.State = state;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Network.NetworkMonitor
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Net;
- using System.Net.NetworkInformation;
- using System.Timers;
- using WinApp;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- namespace WinApp.Managers.Network
- {
- internal static class NetworkMonitor
- {
- private static NetworkState _networkState = NetworkState.None;
- private static bool _checkServerRecursion = true;
- private static bool _isHttpUsed = Map.Get<IApplicationSettings>().IsHttpUsed;
- private static int _failedPingAttemptsCount;
- private static System.Timers.Timer _networkMonitorTimer;
- public static NetworkState NetworkState
- {
- get
- {
- return NetworkMonitor._networkState;
- }
- private set
- {
- if (NetworkMonitor._networkState == value)
- return;
- NetworkMonitor._networkState = value;
- Logger.WriteInfo(typeof (NetworkMonitor), "NetworkState", "NetworkState changed status on '" + NetworkMonitor._networkState.ToString() + "'");
- if (NetworkMonitor.NetworkStateChanged == null)
- return;
- NetworkMonitor.NetworkStateChanged((object) typeof (NetworkMonitor), new NetworkStateEventArgs(value));
- }
- }
- public static event EventHandler<NetworkStateEventArgs> NetworkStateChanged;
- public static event EventHandler<EventArgs> ConnectionAttemptFailed;
- public static void StartNetworkMonitoring()
- {
- NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(NetworkMonitor.InternalNetworkAvailabilityChanged);
- NetworkMonitor.TransitNetworkStateChange(NetworkInterface.GetIsNetworkAvailable());
- }
- internal static void SetPingThrough(bool useHttpFlag)
- {
- NetworkMonitor._isHttpUsed = useHttpFlag;
- }
- internal static void CheckServerOff()
- {
- NetworkMonitor._checkServerRecursion = false;
- }
- internal static void CheckServerOn(bool immediately = false)
- {
- NetworkMonitor._checkServerRecursion = true;
- NetworkMonitor.StartNetworkMonitorTimer(immediately, true);
- }
- private static void InternalNetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
- {
- NetworkMonitor.TransitNetworkStateChange(e.IsAvailable);
- }
- private static void OnConnectionAttemptFailed()
- {
- if (NetworkMonitor.ConnectionAttemptFailed == null)
- return;
- NetworkMonitor.ConnectionAttemptFailed((object) null, new EventArgs());
- }
- private static void TransitNetworkStateChange(bool isNetworkAvailable)
- {
- NetworkMonitor._checkServerRecursion = true;
- if (isNetworkAvailable)
- {
- Logger.WriteInfo(typeof (NetworkMonitor), "TransitNetworkStateChange()", "???? ????????. ??????? ? ?????? ???????");
- NetworkMonitor.CheckServer();
- }
- else
- {
- NetworkMonitor.NetworkState = NetworkState.NetworkNotFound;
- Logger.WriteInfo(typeof (NetworkMonitor), "TransitNetworkStateChange()", "???? ?? ????????. ??????? ? ????? NetworkNotFound");
- }
- }
- private static void CheckServer()
- {
- bool flag = NetworkMonitor._isHttpUsed ? NetworkMonitor.HttpPingServer() : NetworkMonitor.PingServer();
- if (NetworkMonitor._failedPingAttemptsCount == 2)
- {
- NetworkMonitor.OnConnectionAttemptFailed();
- ++NetworkMonitor._failedPingAttemptsCount;
- }
- else if (!flag && NetworkMonitor._failedPingAttemptsCount < 2)
- ++NetworkMonitor._failedPingAttemptsCount;
- if (flag)
- {
- NetworkMonitor._failedPingAttemptsCount = 0;
- NetworkMonitor.NetworkState = NetworkState.ServerOnline;
- NetworkMonitor.StartNetworkMonitorTimer(false, false);
- }
- else
- {
- Logger.WriteInfo(typeof (NetworkMonitor), "CheckServer()", "?????? ?? ????????.");
- if (!NetworkInterface.GetIsNetworkAvailable())
- {
- Logger.WriteInfo(typeof (NetworkMonitor), "CheckServer()", "?????????, ??? ??????? ????.");
- NetworkMonitor.TransitNetworkStateChange(false);
- }
- else
- {
- NetworkMonitor.NetworkState = NetworkState.ServerNotFound;
- NetworkMonitor.CheckServerOn(false);
- }
- }
- }
- private static void StartNetworkMonitorTimer(bool immediatelyTick = false, bool isShortInterval = false)
- {
- if (!NetworkMonitor._checkServerRecursion)
- return;
- if (NetworkMonitor._networkMonitorTimer == null)
- {
- NetworkMonitor._networkMonitorTimer = new System.Timers.Timer(10000.0);
- NetworkMonitor._networkMonitorTimer.Elapsed += new ElapsedEventHandler(NetworkMonitor.OnNetworkMonitorTimerTick);
- Logger.WriteInfo(typeof (NetworkMonitor), "StartNetworkMonitorTimer()", "??????? ?????? ????? ???????");
- }
- NetworkMonitor._networkMonitorTimer.Interval = isShortInterval ? 1000.0 : 10000.0;
- if (!immediatelyTick)
- {
- NetworkMonitor._networkMonitorTimer.Start();
- }
- else
- {
- NetworkMonitor._networkMonitorTimer.Stop();
- NetworkMonitor.OnNetworkMonitorTimerTick();
- }
- }
- private static void OnNetworkMonitorTimerTick(object sender, ElapsedEventArgs e)
- {
- NetworkMonitor.OnNetworkMonitorTimerTick();
- }
- private static void OnNetworkMonitorTimerTick()
- {
- NetworkMonitor._networkMonitorTimer.Stop();
- NetworkMonitor.CheckServer();
- }
- private static bool PingServer()
- {
- Ping ping = new Ping();
- Uri uri = new Uri(ApplicationSettings.ServiceUri);
- try
- {
- PingReply pingReply = ping.Send(uri.Host, 2000);
- return pingReply != null && pingReply.Status == IPStatus.Success;
- }
- catch (PingException ex)
- {
- Logger.WriteError((object) typeof (NetworkMonitor), "PingServer", "PingException when pinging the host " + uri.Host + ": " + ex.Message);
- return false;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) typeof (NetworkMonitor), "PingServer", "Exception when pinging the host " + uri.Host + ": " + ex.Message);
- return false;
- }
- }
- private static bool HttpPingServer()
- {
- Uri requestUri = new Uri(ApplicationSettings.ServiceUri);
- try
- {
- HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(requestUri);
- httpWebRequest.Timeout = 2000;
- httpWebRequest.AllowAutoRedirect = false;
- HttpWebResponse httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
- return true;
- }
- catch (PingException ex)
- {
- Logger.WriteError((object) typeof (NetworkMonitor), "PingServer", "PingException when pinging the host " + requestUri.Host + ": " + ex.Message);
- return false;
- }
- catch (WebException ex)
- {
- if (ex.Status == WebExceptionStatus.TrustFailure)
- return true;
- Logger.WriteError((object) typeof (NetworkMonitor), "PingServer", "Exception when pinging the host " + requestUri.Host + ": " + ex.Message);
- return false;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Configuration.ConfigurationManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using Microsoft.Win32;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Windows;
- using WinApp.ViewModel;
- namespace WinApp.Managers.Configuration
- {
- public static class ConfigurationManager
- {
- private const int VER_NT_WORKSTATION = 1;
- private const int VER_NT_DOMAIN_CONTROLLER = 2;
- private const int VER_NT_SERVER = 3;
- private const int VER_SUITE_SMALLBUSINESS = 1;
- private const int VER_SUITE_ENTERPRISE = 2;
- private const int VER_SUITE_TERMINAL = 16;
- private const int VER_SUITE_DATACENTER = 128;
- private const int VER_SUITE_SINGLEUSERTS = 256;
- private const int VER_SUITE_PERSONAL = 512;
- private const int VER_SUITE_BLADE = 1024;
- private static string _userAgentCache;
- public static void Analyze()
- {
- Logger.WriteInfo((object) typeof (ConfigurationManager), "Analyze()", "???????????? ???????", string.Format("\n\t\t\t\t\t?????????? ????: {0}\n\t\t\t\t\t???????????? ???????: {1}\n\t\t\t\t\t?????? .Net Framework: {2}", (object) Environment.ProcessorCount, (object) ConfigurationManager.GetOsInfo(), (object) ConfigurationManager.GetFrameworkVersion()));
- Logger.WriteInfo((object) typeof (ConfigurationManager), "Analyze()", "???????????? ????????????", string.Format("\n\t\t\t\t\t??? ??????: {0}\n\t\t\t\t\t?????: {1}\n\t\t\t\t\t??? ????????????: {2}", (object) Environment.MachineName, (object) Environment.UserDomainName, (object) Environment.UserName));
- Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
- Logger.WriteInfo((object) typeof (ConfigurationManager), "Analyze()", "???????????? ??????", string.Format("\n\t\t\t\t\t?????????? ??????: {0}x{1}\n\t\t\t\t\tDpi X: {2}\n\t\t\t\t\tDpi Y: {3}", (object) (SystemParameters.PrimaryScreenWidth / 96.0 * (double) graphics.DpiX), (object) (SystemParameters.PrimaryScreenHeight / 96.0 * (double) graphics.DpiY), (object) graphics.DpiX, (object) graphics.DpiY));
- }
- public static void UpdateUserAgent()
- {
- ConfigurationManager._userAgentCache = string.Empty;
- }
- public static string GetUserAgent()
- {
- if (!string.IsNullOrEmpty(ConfigurationManager._userAgentCache))
- return ConfigurationManager._userAgentCache;
- Version currentAppVersion = AppVM.Instance.GetCurrentAppVersion();
- string str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Modules\\Rent module\\RentModule.dll");
- Version version = (Version) null;
- if (File.Exists(str))
- version = AssemblyName.GetAssemblyName(str).Version;
- string format = "KairosPlanet/{0} ({1}; .Net Framework {2}) {3}";
- object[] objArray = new object[4]
- {
- (object) currentAppVersion,
- (object) ConfigurationManager.GetOsInfo(),
- (object) ConfigurationManager.GetFrameworkVersion(),
- version == (Version) null ? (object) string.Empty : (object) ("RentModule/" + (object) version)
- };
- return ConfigurationManager._userAgentCache = string.Format(format, objArray);
- }
- private static string GetFrameworkVersion()
- {
- try
- {
- using (RegistryKey registryKey1 = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, string.Empty).OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\"))
- {
- if (registryKey1 == null)
- return "?? ????????";
- List<string> list = new List<string>();
- foreach (string name1 in registryKey1.GetSubKeyNames())
- {
- if (name1.StartsWith("v"))
- {
- RegistryKey registryKey2 = registryKey1.OpenSubKey(name1);
- if (registryKey2 != null)
- {
- string str1 = (string) registryKey2.GetValue("Version", (object) string.Empty);
- string str2 = registryKey2.GetValue("SP", (object) string.Empty).ToString();
- string str3 = registryKey2.GetValue("Install", (object) string.Empty).ToString();
- if (!string.IsNullOrEmpty(str3) && !string.IsNullOrEmpty(str2) && str3 == "1")
- list.Add(string.Format("{0} {1} SP{2}", (object) name1, (object) str1, (object) str2));
- if (string.IsNullOrEmpty(str1))
- {
- foreach (string name2 in registryKey2.GetSubKeyNames())
- {
- RegistryKey registryKey3 = registryKey2.OpenSubKey(name2);
- if (registryKey3 != null)
- {
- string str4 = (string) registryKey3.GetValue("Version", (object) string.Empty);
- if (!string.IsNullOrEmpty(str4))
- str2 = registryKey3.GetValue("SP", (object) string.Empty).ToString();
- string str5 = registryKey3.GetValue("Install", (object) string.Empty).ToString();
- if (string.IsNullOrEmpty(str5))
- list.Add(string.Format("{0} {1}", (object) name1, (object) str4));
- else if (!string.IsNullOrEmpty(str2) && str5 == "1")
- list.Add(string.Format("{0} {1} SP{2}", (object) name1, (object) str4, (object) str2));
- else if (str5 == "1")
- list.Add(string.Format("v{0} {1}", (object) str4, (object) name2));
- }
- }
- }
- }
- }
- }
- return Enumerable.FirstOrDefault<string>((IEnumerable<string>) Enumerable.OrderByDescending<string, string>((IEnumerable<string>) list, (Func<string, string>) (x => x)));
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ConfigurationManager), "GetFrameworkVersion()", "?? ??????? ???????? ?????? framework", ex);
- return "?? ????????";
- }
- }
- private static string GetOsInfo()
- {
- StringBuilder stringBuilder = new StringBuilder(string.Format("{0} ({1}) - version: {2}", (object) ConfigurationManager.GetOsName(), (object) ConfigurationManager.GetProcessorArchitecture(), (object) Environment.OSVersion.Version));
- string osServicePack = ConfigurationManager.GetOsServicePack();
- if (!string.IsNullOrEmpty(osServicePack))
- stringBuilder.AppendFormat(" {0}", (object) osServicePack);
- string osProductType = ConfigurationManager.GetOsProductType();
- if (!string.IsNullOrEmpty(osProductType))
- stringBuilder.AppendFormat(" - {0}", (object) osProductType);
- return stringBuilder.ToString();
- }
- private static string GetProcessorArchitecture()
- {
- string environmentVariable = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
- if (string.IsNullOrEmpty(environmentVariable))
- return "?? ????????";
- return environmentVariable == "AMD64" ? "x64" : "x86";
- }
- private static string GetOsName()
- {
- try
- {
- OperatingSystem osVersion = Environment.OSVersion;
- switch (osVersion.Platform)
- {
- case PlatformID.Win32Windows:
- switch (osVersion.Version.Minor)
- {
- case 0:
- return "Windows 95";
- case 10:
- return osVersion.Version.Revision.ToString() == "2222A" ? "Windows 98 Second Edition" : "Windows 98";
- case 90:
- return "Windows Me";
- }
- case PlatformID.Win32NT:
- switch (osVersion.Version.Major)
- {
- case 3:
- return "Windows NT 3.51";
- case 4:
- return "Windows NT 4.0";
- case 5:
- switch (osVersion.Version.Minor)
- {
- case 0:
- return "Windows 2000";
- case 1:
- return "Windows XP";
- case 2:
- return "Windows Server 2003";
- }
- case 6:
- OSVERSIONINFOEX? osVersionInfo = ConfigurationManager.GetOsVersionInfo();
- switch (osVersion.Version.Minor)
- {
- case 0:
- if (!osVersionInfo.HasValue)
- return "Windows Vista/Windows Server 2008";
- return (int) osVersionInfo.Value.wProductType == 1 ? "Windows Vista" : "Windows Server 2008";
- case 1:
- if (!osVersionInfo.HasValue)
- return "Windows 7/Windows Server 2008 R2";
- return (int) osVersionInfo.Value.wProductType == 1 ? "Windows 7" : "Windows Server 2008 R2";
- case 2:
- if (!osVersionInfo.HasValue)
- return "Windows 8/Windows Server 2012";
- return (int) osVersionInfo.Value.wProductType == 1 ? "Windows 8" : "Windows Server 2012";
- case 3:
- if (!osVersionInfo.HasValue)
- return "Windows 8.1/Windows Server 2012 R2";
- return (int) osVersionInfo.Value.wProductType == 1 ? "Windows 8.1" : "Windows Server 2012 R2";
- }
- case 10:
- return "Windows 10";
- }
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ConfigurationManager), "GetOsName()", "?? ??????? ???????? ???????? ??", ex);
- }
- return "?? ????????";
- }
- private static string GetOsServicePack()
- {
- try
- {
- OSVERSIONINFOEX? osVersionInfo = ConfigurationManager.GetOsVersionInfo();
- if (!osVersionInfo.HasValue)
- return string.Empty;
- return osVersionInfo.Value.szCSDVersion;
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ConfigurationManager), "GetOsServicePack()", "?? ??????? ???????? ????????? ????? ??", ex);
- }
- return "?? ????????";
- }
- private static string GetOsProductType()
- {
- try
- {
- OSVERSIONINFOEX? osVersionInfo = ConfigurationManager.GetOsVersionInfo();
- if (!osVersionInfo.HasValue)
- return string.Empty;
- OperatingSystem osVersion = Environment.OSVersion;
- if (osVersion.Version.Major == 4)
- {
- if ((int) osVersionInfo.Value.wProductType == 1)
- return "Workstation";
- if ((int) osVersionInfo.Value.wProductType == 3)
- return "Server";
- return string.Empty;
- }
- if (osVersion.Version.Major == 5)
- {
- if ((int) osVersionInfo.Value.wProductType == 1)
- return ((int) osVersionInfo.Value.wSuiteMask & 512) == 512 ? "Home Edition" : "Professional";
- if ((int) osVersionInfo.Value.wProductType == 3)
- {
- if (osVersion.Version.Minor == 0)
- {
- if (((int) osVersionInfo.Value.wSuiteMask & 128) == 128)
- return "Datacenter Server";
- return ((int) osVersionInfo.Value.wSuiteMask & 2) == 2 ? "Advanced Server" : "Server";
- }
- }
- else
- {
- if (((int) osVersionInfo.Value.wSuiteMask & 128) == 128)
- return "Datacenter Edition";
- if (((int) osVersionInfo.Value.wSuiteMask & 2) == 2)
- return "Enterprise Edition";
- return ((int) osVersionInfo.Value.wSuiteMask & 1024) == 1024 ? "Web Edition" : "Standard Edition";
- }
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ConfigurationManager), "GetOsProductType()", "?? ??????? ???????? ??? ???????? ??", ex);
- }
- return string.Empty;
- }
- private static OSVERSIONINFOEX? GetOsVersionInfo()
- {
- OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX()
- {
- dwOSVersionInfoSize = Marshal.SizeOf(typeof (OSVERSIONINFOEX))
- };
- if (!ConfigurationManager.GetVersionEx(ref osVersionInfo))
- return new OSVERSIONINFOEX?();
- return new OSVERSIONINFOEX?(osVersionInfo);
- }
- [DllImport("kernel32.dll")]
- private static extern bool GetVersionEx(ref OSVERSIONINFOEX osVersionInfo);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Configuration.OSVERSIONINFOEX
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Runtime.InteropServices;
- namespace WinApp.Managers.Configuration
- {
- public struct OSVERSIONINFOEX
- {
- public int dwOSVersionInfoSize;
- public int dwMajorVersion;
- public int dwMinorVersion;
- public int dwBuildNumber;
- public int dwPlatformId;
- [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
- public string szCSDVersion;
- public short wServicePackMajor;
- public short wServicePackMinor;
- public short wSuiteMask;
- public byte wProductType;
- public byte wReserved;
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Localization.ILocalizationManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Collections.ObjectModel;
- namespace WinApp.Managers.Localization
- {
- public interface ILocalizationManager
- {
- ObservableCollection<LocalizationObject> LanguagesCollection { get; }
- void ApplyLocalization();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Localization.LocalizationObject
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Managers.Localization
- {
- public class LocalizationObject
- {
- public string LocalizationKey { get; set; }
- public string LanguageName { get; set; }
- public string CountryName { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.Localization.LocalizationManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers.Localization;
- using System;
- using System.Collections.ObjectModel;
- using System.Globalization;
- using System.Threading;
- using WinApp.Managers.Interfaces;
- namespace WinApp.Managers.Localization
- {
- public class LocalizationManager : ILocalizationManager
- {
- public ObservableCollection<LocalizationObject> LanguagesCollection { get; private set; }
- public LocalizationManager()
- {
- this.Initialize();
- }
- public void ApplyLocalization()
- {
- string localizationKey1 = Map.Get<IApplicationSettings>().LocalizationKey;
- Logger.WriteInfo(typeof (LocalizationManager), "ApplyLocalization()", "?????????? ??????????? ?? ????? ApplicationSettings...");
- try
- {
- Thread.CurrentThread.CurrentCulture = (CultureInfo) new UnifyCultureInfo(localizationKey1);
- Thread.CurrentThread.CurrentUICulture = (CultureInfo) new UnifyCultureInfo(localizationKey1);
- Logger.WriteInfo(typeof (LocalizationManager), "ApplyLocalization()", string.Format("??????????? '{0}' ??????? ?????????", (object) localizationKey1));
- }
- catch (Exception ex1)
- {
- Logger.WriteWarning(typeof (LocalizationManager), "ApplyLocalization()", string.Format("?????? ??? ?????????? ??????????? '{0}'. ????? ????????? ??????????? ???????????", (object) localizationKey1));
- try
- {
- string localizationKey2 = this.LanguagesCollection[0].LocalizationKey;
- Map.Get<IApplicationSettings>().LocalizationKey = localizationKey2;
- Thread.CurrentThread.CurrentCulture = (CultureInfo) new UnifyCultureInfo(localizationKey2);
- Thread.CurrentThread.CurrentUICulture = (CultureInfo) new UnifyCultureInfo(localizationKey2);
- Logger.WriteInfo(typeof (LocalizationManager), "ApplyLocalization()", string.Format("??????????? '{0}' ??????? ?????????", (object) localizationKey2));
- }
- catch (Exception ex2)
- {
- Logger.WriteError(typeof (LocalizationManager), "ApplyLocalization()", string.Format("?????? ??? ?????????? ???????????"), ex2);
- }
- }
- }
- private void Initialize()
- {
- Logger.WriteInfo(typeof (LocalizationManager), "Initialize()", "????????????? ?????? ???????????...");
- this.LanguagesCollection = new ObservableCollection<LocalizationObject>();
- this.LanguagesCollection.Add(new LocalizationObject()
- {
- LanguageName = "English",
- LocalizationKey = "en-US",
- CountryName = "USA"
- });
- this.LanguagesCollection.Add(new LocalizationObject()
- {
- LanguageName = "???????",
- LocalizationKey = "ru-RU",
- CountryName = "??????"
- });
- Logger.WriteInfo(typeof (LocalizationManager), "Initialize()", "?????? ??????????? ??????? ???????????????");
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.PingEventArgs
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp.Managers
- {
- public class PingEventArgs
- {
- public long LifeTime { get; private set; }
- public PingEventArgs(long lifeTime)
- {
- this.LifeTime = lifeTime;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.ModuleResolver
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using Ionic.Zip;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.Serialization;
- using WinApp.Data.Model;
- using WinApp.Managers.Interfaces;
- using WinApp.Module;
- namespace WinApp.Managers
- {
- public class ModuleResolver : IModuleResolver, IModuleCallback
- {
- private static Dictionary<string, IModuleManager> _moduleManagerDictionary = new Dictionary<string, IModuleManager>();
- private Dictionary<long, ModuleInfo> _moduleInfoDictionary = new Dictionary<long, ModuleInfo>();
- public IModuleManager GetModuleManager(ModuleInfo moduleInfo)
- {
- if (moduleInfo == null)
- throw new ArgumentException("Module info is null", "moduleInfo");
- Logger.WriteInfo((object) this, "GetModuleManager()", string.Format("?????? ????????? ?????? - {0}", (object) moduleInfo.Title));
- string str = Path.Combine(ModuleResolver.GetModulesFolderPath(), ModuleResolver.GetModuleInfoFileName(moduleInfo));
- bool flag = true;
- if (File.Exists(str))
- {
- Logger.WriteInfo((object) this, "GetModuleManager()", "Module already exist");
- Version version1 = new Version(ModuleResolver.ReadModuleInfo(str).Version);
- Version version2 = new Version(moduleInfo.Version);
- flag = version2 != version1;
- Logger.WriteInfo((object) this, "GetModuleManager()", string.Format("Module version on site: '{0}' and version local: '{1}'", (object) version2, (object) version1));
- }
- if (flag)
- {
- Logger.WriteInfo((object) this, "GetModuleManager()", "Module need update");
- if (!this.DownloadModule(moduleInfo))
- {
- Logger.WriteError((object) this, "GetModuleManager", "Module is not downloaded");
- return (IModuleManager) null;
- }
- if (!ModuleResolver.DeployedModule(moduleInfo))
- {
- Logger.WriteError((object) this, "GetModuleManager", "Module is not deployed");
- return (IModuleManager) null;
- }
- Map.Get<ISessionManager>().UpdateUserAgentString();
- }
- return ModuleResolver.GetInstanceModuleManager(moduleInfo);
- }
- public ModuleInfo GetModuleInfoFromSite(long productId)
- {
- Logger.WriteInfo((object) this, "GetModuleInfoFromSite", "Get module info for productId = " + (object) productId);
- ModuleInfo moduleInfo = Map.Get<ISessionManager>().GetModuleInfo(productId);
- if (moduleInfo == null)
- {
- Logger.WriteError((object) this, "GetModuleInfoFromSite", "Module info from site is not received");
- return (ModuleInfo) null;
- }
- if (this._moduleInfoDictionary.ContainsKey(productId))
- this._moduleInfoDictionary[productId] = moduleInfo;
- else
- this._moduleInfoDictionary.Add(productId, moduleInfo);
- return moduleInfo;
- }
- public ModuleInfo GetModuleInfo(long productId)
- {
- if (this._moduleInfoDictionary.ContainsKey(productId))
- return this._moduleInfoDictionary[productId];
- return this.GetModuleInfoFromSite(productId);
- }
- public bool DownloadModule(ModuleInfo moduleInfo)
- {
- try
- {
- Logger.WriteInfo((object) this, "DownloadModule", "Start download module " + moduleInfo.Title);
- long productId = moduleInfo.ProductId;
- ModuleInfo moduleInfo1 = Map.Get<ISessionManager>().GetModuleInfo(productId);
- byte[] moduleContent = Map.Get<ISessionManager>().GetModuleContent(productId);
- Logger.WriteInfo((object) this, "DownloadModule", "Content for module " + moduleInfo.Title + " downloaded");
- ModuleResolver.SaveModuleFile(moduleContent, moduleInfo);
- Logger.WriteInfo((object) this, "DownloadModule", "Content for module " + moduleInfo.Title + " saved");
- string filePath = Path.Combine(ModuleResolver.GetDownloadsModuleFolderPath(moduleInfo), ModuleResolver.GetModuleInfoFileName(moduleInfo));
- ModuleResolver.SaveModuleInfo(moduleInfo1, filePath);
- Logger.WriteInfo((object) this, "DownloadModule", "ModuleInfo for module " + moduleInfo.Title + " saved");
- Logger.WriteInfo((object) this, "DownloadModule", "Module " + moduleInfo.Title + " downloaded successful");
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "DownloadModule", "Error throw download module", ex);
- return false;
- }
- }
- public string GetActiveModuleSecureKey()
- {
- try
- {
- long activeProductId = Map.Get<IApplicationSettings>().ActiveProductId;
- if (activeProductId == 0L)
- return string.Empty;
- ModuleInfo moduleInfo = this.GetModuleInfo(activeProductId);
- if (moduleInfo == null)
- return string.Empty;
- IModuleManager moduleManager = this.GetModuleManager(moduleInfo);
- if (moduleManager == null)
- return string.Empty;
- return moduleManager.GetSecurityKey((IModuleCallback) this);
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetActiveModuleSecureKey()", "Error by GetActiveModuleSecureKey", ex);
- return string.Empty;
- }
- }
- public ModuleSettings GetModuleSettings(string moduleId)
- {
- return SettingsForAllModules.GetModuleSettings(moduleId);
- }
- public void SaveModuleSettings(ModuleSettings moduleSettings)
- {
- SettingsForAllModules.SaveModuleSettings(moduleSettings);
- }
- private static bool DeployedModule(ModuleInfo moduleInfo)
- {
- try
- {
- Logger.WriteInfo(typeof (ModuleResolver), "DeployedModule", "Start deploy for module " + moduleInfo.Title);
- string moduleFolderPath1 = ModuleResolver.GetDownloadsModuleFolderPath(moduleInfo);
- string moduleFolderPath2 = ModuleResolver.GetModuleFolderPath(moduleInfo);
- string moduleFolderPath3 = ModuleResolver.GetBackupModuleFolderPath(moduleInfo);
- if (Directory.Exists(moduleFolderPath2))
- {
- string[] files = Directory.GetFiles(moduleFolderPath2);
- if (files != null && files.Length > 0)
- {
- if (Directory.Exists(moduleFolderPath3))
- Directory.Delete(moduleFolderPath3, true);
- DirectoryInfo directoryInfo = new DirectoryInfo(moduleFolderPath3);
- if (!directoryInfo.Parent.Exists)
- directoryInfo.Parent.Create();
- Directory.Move(moduleFolderPath2, moduleFolderPath3);
- }
- Logger.WriteInfo(typeof (ModuleResolver), "DeployedModule", "Backup module " + moduleInfo.Title + " execute successful");
- }
- if (!Directory.Exists(moduleFolderPath2))
- Directory.CreateDirectory(moduleFolderPath2);
- new ZipFile(ModuleResolver.GetDownloadsModuleFilePath(moduleInfo)).ExtractAll(moduleFolderPath2);
- Logger.WriteInfo(typeof (ModuleResolver), "DeployedModule", "Module " + moduleInfo.Title + " unziped to folder " + moduleFolderPath2);
- File.Copy(Path.Combine(moduleFolderPath1, ModuleResolver.GetModuleInfoFileName(moduleInfo)), Path.Combine(ModuleResolver.GetModulesFolderPath(), ModuleResolver.GetModuleInfoFileName(moduleInfo)), true);
- Logger.WriteInfo(typeof (ModuleResolver), "DeployedModule", "ModuleInfo for module " + moduleInfo.Title + " moved to work folder");
- Logger.WriteInfo(typeof (ModuleResolver), "DeployedModule", "Module " + moduleInfo.Title + " deployed successful");
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ModuleResolver), "DeployedModule", "Deploy module error", ex);
- return false;
- }
- }
- private static void SaveModuleFile(byte[] content, ModuleInfo moduleInfo)
- {
- string downloadsModuleFilePath = ModuleResolver.GetDownloadsModuleFilePath(moduleInfo);
- FileInfo fileInfo = new FileInfo(downloadsModuleFilePath);
- if (!fileInfo.Directory.Exists)
- fileInfo.Directory.Create();
- using (FileStream fileStream = File.Open(downloadsModuleFilePath, FileMode.Create))
- fileStream.Write(content, 0, content.Length);
- }
- private static IModuleManager GetInstanceModuleManager(ModuleInfo moduleInfo)
- {
- try
- {
- if (ModuleResolver._moduleManagerDictionary.ContainsKey(moduleInfo.Title))
- return ModuleResolver._moduleManagerDictionary[moduleInfo.Title];
- string moduleFolderPath = ModuleResolver.GetModuleFolderPath(moduleInfo);
- string title = moduleInfo.Title;
- if (!Directory.Exists(moduleFolderPath))
- return (IModuleManager) null;
- foreach (string path in Directory.GetFiles(moduleFolderPath, "*.dll"))
- {
- IModuleManager imoduleManager = (IModuleManager) null;
- Assembly assembly = Assembly.LoadFile(path);
- Type type1 = (Type) null;
- try
- {
- foreach (Type type2 in assembly.GetTypes())
- {
- if (Enumerable.Contains<Type>((IEnumerable<Type>) type2.GetInterfaces(), typeof (IModuleManager)))
- {
- type1 = type2;
- break;
- }
- }
- if (type1 == null)
- continue;
- }
- catch (ReflectionTypeLoadException ex)
- {
- Logger.WriteError(typeof (ModuleResolver), "GetModuleManager()", string.Format("?? ??????? ???????? ???? ?????????? '{0}'", (object) title), (Exception) ex);
- continue;
- }
- try
- {
- imoduleManager = (IModuleManager) Activator.CreateInstance(type1);
- if (!ModuleResolver._moduleManagerDictionary.ContainsKey(moduleInfo.Title))
- ModuleResolver._moduleManagerDictionary.Add(moduleInfo.Title, imoduleManager);
- return imoduleManager;
- }
- catch (InvalidCastException ex)
- {
- Logger.WriteError(typeof (ModuleResolver), "GetModuleManager()", "?? ??????? ???????? ?????? ? ???? 'IModuleManager'", (Exception) ex);
- }
- if (imoduleManager != null)
- Logger.WriteInfo(typeof (ModuleResolver), "GetModuleManager()", string.Format("?????? ??????? ???????? - {0}", (object) title));
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ModuleResolver), "GetInstanceModuleManager", "Instance of module manager not loaded", ex);
- }
- return (IModuleManager) null;
- }
- private static string GetDownloadsModuleFilePath(ModuleInfo moduleInfo)
- {
- return Path.Combine(ModuleResolver.GetDownloadsModuleFolderPath(moduleInfo), moduleInfo.Filename);
- }
- private static string GetModuleInfoFileName(ModuleInfo moduleInfo)
- {
- return string.Format("{0}.ModuleInfo.xml", (object) moduleInfo.Title);
- }
- private static void SaveModuleInfo(ModuleInfo moduleInfo, string filePath)
- {
- using (FileStream fileStream = File.Open(filePath, FileMode.Create))
- new DataContractSerializer(typeof (ModuleInfo)).WriteObject((Stream) fileStream, (object) moduleInfo);
- }
- private static ModuleInfo ReadModuleInfo(string filePath)
- {
- if (!File.Exists(filePath))
- return (ModuleInfo) null;
- try
- {
- using (FileStream fileStream = File.Open(filePath, FileMode.Open))
- return (ModuleInfo) new DataContractSerializer(typeof (ModuleInfo)).ReadObject((Stream) fileStream);
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ModuleResolver), "ReadModuleInfo()", "Error: ", ex);
- return (ModuleInfo) null;
- }
- }
- private static string GetDownloadsModuleFolderPath(ModuleInfo moduleInfo)
- {
- return Path.Combine(Environment.CurrentDirectory, string.Format("DownloadedModules\\{0}", (object) moduleInfo.Title));
- }
- private static string GetBackupModuleFolderPath(ModuleInfo moduleInfo)
- {
- return Path.Combine(Environment.CurrentDirectory, string.Format("BackupModules\\{0}", (object) moduleInfo.Title));
- }
- private static string GetModuleFolderPath(ModuleInfo moduleInfo)
- {
- return Path.Combine(ModuleResolver.GetModulesFolderPath(), moduleInfo.Title);
- }
- private static string GetModulesFolderPath()
- {
- return Path.Combine(Environment.CurrentDirectory, "Modules");
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.CountriesManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Xml.Serialization;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Localization;
- namespace WinApp.Managers
- {
- internal class CountriesManager : ICountriesManager
- {
- private List<string> _deserializedCountries = new List<string>();
- protected string FilePath
- {
- get
- {
- return Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WinApp"), string.Format("countries.xml"));
- }
- }
- public CountriesManager()
- {
- this.DeserializeCountries();
- this._deserializedCountries = new List<string>(Enumerable.Select<LocalizationObject, string>((IEnumerable<LocalizationObject>) Map.Get<ILocalizationManager>().LanguagesCollection, (Func<LocalizationObject, string>) (x => x.CountryName)));
- }
- public List<string> GetAllCountries()
- {
- return this._deserializedCountries;
- }
- private List<string> DeserializeCountries()
- {
- Logger.WriteError((object) typeof (CountriesManager), "DeserializeCountries()", "????????? ?????? ????? ?? ?????");
- if (!File.Exists(this.FilePath))
- {
- Logger.WriteWarning(typeof (CountriesManager), "DeserializeCountries()", "???? ?? ??????? ????? ?? ??????");
- return (List<string>) null;
- }
- List<string> list;
- try
- {
- XmlSerializer xmlSerializer = new XmlSerializer(typeof (List<string>));
- TextReader textReader = (TextReader) new StreamReader(this.FilePath);
- list = (List<string>) xmlSerializer.Deserialize(textReader);
- textReader.Close();
- Logger.WriteWarning(typeof (CountriesManager), "DeserializeCountries()", "?????? ????? ??????? ???????");
- }
- catch (Exception ex)
- {
- list = (List<string>) null;
- Logger.WriteError(typeof (CountriesManager), "DeserializeCountries()", "?????? ??? ????????? ????? ?? ?????", ex);
- }
- return list;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.SessionManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers.Network;
- using KairosPlanet.Properties;
- using System;
- using System.Net;
- using System.ServiceModel;
- using System.Windows;
- using WinApp.Api;
- using WinApp.Api.Data;
- using WinApp.Api.Interfaces;
- using WinApp.Data.Helpers;
- using WinApp.Data.Model;
- using WinApp.Managers.Configuration;
- using WinApp.Managers.Interfaces;
- namespace WinApp.Managers
- {
- public class SessionManager : ISessionManager
- {
- private IAuthApi _api;
- private Man _currentUser;
- public Man CurrentUser
- {
- get
- {
- return this._currentUser;
- }
- }
- public IApi Api
- {
- get
- {
- return (IApi) this._api;
- }
- }
- public LoginResponce Login(string user, string password)
- {
- CheckPoint checkPoint = Logger.CheckPointStart("Login(user, password)");
- Logger.WriteInfo((object) this, "Login()", "Connect to service " + ApplicationSettings.ServiceUri);
- this._api = Map.Get<IClientFactory>().CreateChannel(user, password, ApplicationSettings.ServiceUri, ConfigurationManager.GetUserAgent());
- this._api.SetUserData(user, password);
- try
- {
- UserResponse user1 = this._api.GetUser();
- if (user1.User == null)
- return LoginResponce.NoResponce;
- if (user1.User.Email != user)
- {
- Logger.WriteError((object) this, "Login()", "?????? ?????? ????? ??????? ????????????.");
- user1 = this._api.GetUser();
- if (string.Equals(user1.User.Name, user, StringComparison.InvariantCultureIgnoreCase))
- {
- Logger.WriteError((object) this, "Login()", "?????? ?????? ?????? ????? ??????? ????????????.");
- SessionMonitor.Instance.SetSessionStateToSuspended();
- int num = (int) MessageBox.Show(Resources.Error_ServerReturnIncorrectData, "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
- throw new ApiException("?????? ?????? ????? ??????? ????????????.", HttpStatusCode.InternalServerError, "");
- }
- }
- this._currentUser = user1.User;
- SessionMonitor.Instance.SetSessionStateToLogon();
- return LoginResponce.Pass(this.CurrentUser);
- }
- catch (ApiException ex)
- {
- if (ex.ErrorCode == HttpStatusCode.Unauthorized)
- return LoginResponce.WrongInput;
- }
- finally
- {
- checkPoint.Close();
- }
- return LoginResponce.NoResponce;
- }
- public PingResponse PingSession(string activeModuleSecureKey)
- {
- try
- {
- Logger.WriteInfo((object) this, "PingSession()", "???????? Ping");
- bool flag;
- try
- {
- return this._api.Ping(activeModuleSecureKey);
- }
- catch (ApiException ex)
- {
- if (ex.ErrorCode == HttpStatusCode.NotFound || ex.ErrorCode == HttpStatusCode.Unauthorized)
- {
- if (string.Equals(ex.StatusDescription, "Secret key not found"))
- throw;
- else
- flag = true;
- }
- else
- throw;
- }
- if (flag)
- {
- Logger.WriteInfo((object) this, "PingSession()", "????????? ??????? ????????? ????????????(api.GetUser())");
- if (this._api.GetUser().User.Id != this.CurrentUser.Id)
- {
- Logger.WriteError((object) this, "PingSession()", "?????? ?????? ????? ??????? ????????????.");
- SessionMonitor.Instance.SetSessionStateToSuspended();
- int num = (int) MessageBox.Show(Resources.Error_ServerReturnIncorrectData, "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
- throw new ApiException("?????? ?????? ????? ??????? ????????????.", HttpStatusCode.InternalServerError, "");
- }
- return this._api.Ping(activeModuleSecureKey);
- }
- }
- catch (ApiException ex)
- {
- if (string.Equals(ex.StatusDescription, "Secret key not found"))
- throw;
- else
- Logger.WriteError((object) this, "PingSession()", "Error during operation Ping", (Exception) ex);
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "PingSession()", "Error during operation Ping", ex);
- }
- return (PingResponse) null;
- }
- public void CloseSession()
- {
- if (this._api != null)
- this._api.Close();
- this._api = (IAuthApi) null;
- this._currentUser = (Man) null;
- }
- public Statistic[] GetStatistics()
- {
- Logger.WriteInfo((object) this, "GetStatistics()", "Get Statistics from server");
- try
- {
- return this._api.GetStatistics().Statistics;
- }
- catch (ApiException ex)
- {
- return new Statistic[0];
- }
- catch (EndpointNotFoundException ex)
- {
- return (Statistic[]) null;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetStatistics()", "?????? ??? ????????? ??????????: " + ex.Message, ex);
- return (Statistic[]) null;
- }
- }
- public Statistic[] GetStatistics(DateTime periodStart, DateTime periodEnd)
- {
- Logger.WriteInfo((object) this, "GetStatistics(periodStart, periodEnd)", "Get Statistics from server for period");
- try
- {
- StatisticsResponse statistics = this._api.GetStatistics(periodStart, periodEnd);
- return statistics == null ? new Statistic[0] : statistics.Statistics;
- }
- catch (ApiException ex)
- {
- return new Statistic[0];
- }
- }
- public Purchase[] GetPurchases()
- {
- PurchaseResponse purchases;
- try
- {
- purchases = this._api.GetPurchases();
- }
- catch (ApiException ex)
- {
- return (Purchase[]) null;
- }
- catch (EndpointNotFoundException ex)
- {
- return (Purchase[]) null;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetStatistics()", "?????? ??? ????????? ???????: " + ex.Message, ex);
- return (Purchase[]) null;
- }
- return purchases.Purchases;
- }
- public string Activation(long purchaseId)
- {
- try
- {
- return this._api.Activation(new ActivationRequest()
- {
- PurchaseId = purchaseId
- }).PackageSecureKey;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "Activation()", "Error by activation", ex);
- throw;
- }
- }
- public string GetAppVersion()
- {
- try
- {
- return this._api.GetAppVersion().Version;
- }
- catch (ApiException ex)
- {
- Logger.WriteError((object) this, "GetAppVersion()", "Error: ", (Exception) ex);
- return string.Empty;
- }
- }
- public ModuleInfo GetModuleInfo(long productId)
- {
- ModuleInfo moduleInfo1 = new ModuleInfo();
- try
- {
- ModuleInfoResponse moduleInfo2 = this._api.GetModuleInfo(productId);
- moduleInfo1.Id = moduleInfo2.Id;
- moduleInfo1.ProductId = moduleInfo2.ProductId;
- moduleInfo1.Title = moduleInfo2.Title;
- moduleInfo1.Version = moduleInfo2.Version;
- moduleInfo1.Description = moduleInfo2.Description;
- moduleInfo1.Filename = moduleInfo2.Filename;
- moduleInfo1.Url = moduleInfo2.Url;
- }
- catch (ApiException ex)
- {
- Logger.WriteError((object) this, "GetModuleInfo(productId)", "Error: ", (Exception) ex);
- return (ModuleInfo) null;
- }
- return moduleInfo1;
- }
- public byte[] GetModuleContent(long productId)
- {
- CheckPoint checkPoint = Logger.CheckPointStart("GetModuleContent");
- try
- {
- ModuleContentResponse moduleContent = this._api.GetModuleContent(productId);
- if (moduleContent != null && !string.IsNullOrEmpty(moduleContent.Source))
- return Convert.FromBase64String(moduleContent.Source);
- Logger.WriteWarning((object) this, "GetModuleContent()", "the module contents is not received");
- return (byte[]) null;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetModuleContent(productId)", "Error: ", ex);
- return (byte[]) null;
- }
- finally
- {
- checkPoint.Close();
- }
- }
- public void UpdateUserAgentString()
- {
- ConfigurationManager.UpdateUserAgent();
- string userAgent = ConfigurationManager.GetUserAgent();
- ApiAccess apiAccess = this._api as ApiAccess;
- if (apiAccess == null)
- return;
- string login = string.Empty;
- string password = string.Empty;
- if (apiAccess.ClientCredentials != null)
- {
- login = apiAccess.ClientCredentials.UserName.UserName;
- password = apiAccess.ClientCredentials.UserName.Password;
- }
- this._api = Map.Get<IClientFactory>().CreateChannel(login, password, ApplicationSettings.ServiceUri, userAgent);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.ApplicationSettings
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using Microsoft.Win32;
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Threading;
- using System.Xml.Serialization;
- using WinApp.Data.Security;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Localization;
- namespace WinApp.Managers
- {
- public class ApplicationSettings : IApplicationSettings
- {
- private static readonly string _configFileName = "\\ApplicationSettings.cfg";
- private static readonly string _configPath = Environment.CurrentDirectory;
- private static object _lockObject = new object();
- private static string _serviceUri;
- public static string ServiceUri
- {
- get
- {
- if (string.IsNullOrEmpty(ApplicationSettings._serviceUri))
- {
- string str = ConfigurationManager.AppSettings["ServiceUri"];
- if (string.IsNullOrEmpty(str))
- {
- Logger.WriteError((object) typeof (ApplicationSettings), "ServiceUri", "ServiceUri not specified in settings app.config");
- str = "https://cabinet.kairosplanet.com";
- }
- ApplicationSettings._serviceUri = str;
- }
- return ApplicationSettings._serviceUri;
- }
- }
- public bool IsHttpUsed { get; set; }
- public string LocalizationKey { get; set; }
- [XmlIgnore]
- public string Email
- {
- get
- {
- return Cryptography.UnprotectUserData(this.ProtectedEmail);
- }
- set
- {
- this.ProtectedEmail = Cryptography.ProtectedUserData(value);
- }
- }
- [XmlIgnore]
- public string Password
- {
- get
- {
- return Cryptography.UnprotectUserData(this.ProtectedPassword);
- }
- set
- {
- this.ProtectedPassword = Cryptography.ProtectedUserData(value);
- }
- }
- public string ProtectedEmail { get; set; }
- public string ProtectedPassword { get; set; }
- public bool IsAutoLogin { get; set; }
- public long ActiveProductId { get; set; }
- public bool UseHttpPing { get; set; }
- [XmlIgnore]
- public bool RunAtStartup
- {
- get
- {
- return this.GetRunAtStartup();
- }
- set
- {
- this.SetRunAtStartup(value);
- }
- }
- public bool IsRemeberMe { get; set; }
- private static string ConfigFileFullName
- {
- get
- {
- return ApplicationSettings._configPath + ApplicationSettings._configFileName;
- }
- }
- public ApplicationSettings()
- {
- Logger.WriteInfo(typeof (ApplicationSettings), "ApplicationSettings()", "????????????? ????? ????????...");
- this.LocalizationKey = CultureInfo.CurrentUICulture.Name;
- Logger.WriteInfo(typeof (ApplicationSettings), "ApplicationSettings()", "????? ????????? ????????????????");
- }
- public static ApplicationSettings GetClientSettings()
- {
- return ApplicationSettings.ReadConfigSettingFromFile(true);
- }
- public void SetLocalization(LocalizationObject localizationObject)
- {
- this.LocalizationKey = localizationObject.LocalizationKey;
- Logger.WriteInfo(typeof (ApplicationSettings), "SetLocalization()", string.Format("??????????? ???????? ?? {0}", (object) this.LocalizationKey));
- this.Save();
- }
- public void SetRunAtStartup(bool isRunAtStartup)
- {
- Logger.WriteInfo(typeof (ApplicationSettings), "SetRunAtStartup()", "????? ???????? ??????? ??? ??????...");
- RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
- if (registryKey == null)
- {
- Logger.WriteWarning(typeof (ApplicationSettings), "SetRunAtStartup()", "??????????? ???? null");
- }
- else
- {
- Assembly executingAssembly = Assembly.GetExecutingAssembly();
- try
- {
- if (isRunAtStartup)
- {
- registryKey.SetValue(executingAssembly.GetName().Name, (object) executingAssembly.Location);
- Logger.WriteInfo(typeof (ApplicationSettings), "SetRunAtStartup()", "?????? ?????????? ??? ?????? ???????");
- }
- else
- {
- registryKey.DeleteValue(executingAssembly.GetName().Name, false);
- Logger.WriteInfo(typeof (ApplicationSettings), "SetRunAtStartup()", "?????? ?????????? ??? ?????? ????????");
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ApplicationSettings), "SetRunAtStartup()", "?????? ??? ????? ????????? ??????? ?????????? ??? ??????", ex);
- }
- }
- }
- public bool GetRunAtStartup()
- {
- Logger.WriteInfo(typeof (ApplicationSettings), "GetRunAtStartup()", "????????? ???????? ??????? ??? ??????...");
- RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", false);
- if (registryKey == null)
- {
- Logger.WriteWarning(typeof (ApplicationSettings), "GetRunAtStartup()", "??????????? ???? null");
- return false;
- }
- Assembly executingAssembly = Assembly.GetExecutingAssembly();
- try
- {
- return registryKey.GetValue(executingAssembly.GetName().Name) != null;
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ApplicationSettings), "GetRunAtStartup()", "?????? ??? ????????? ????????? ??????? ?????????? ??? ??????", ex);
- return false;
- }
- }
- public void SetIsAutoLogin(bool isAutoLogin)
- {
- this.IsAutoLogin = isAutoLogin;
- Logger.WriteInfo(typeof (ApplicationSettings), "SetIsAutoLogin()", string.Format("???????? ?????????? ???????? ?? {0}", (object) (bool) (isAutoLogin ? 1 : 0)));
- this.Save();
- }
- public void SetHttpPingUsed(bool isHttpPingUsed)
- {
- this.IsHttpUsed = isHttpPingUsed;
- Logger.WriteInfo(typeof (ApplicationSettings), "SetHttpPingUsed()", string.Format("???????? ????????????? http ping'a ?? {0}", (object) (bool) (isHttpPingUsed ? 1 : 0)));
- this.Save();
- }
- public LocalizationObject GetLocalizationObject()
- {
- return Enumerable.SingleOrDefault<LocalizationObject>((IEnumerable<LocalizationObject>) Map.Get<ILocalizationManager>().LanguagesCollection, (Func<LocalizationObject, bool>) (lco => lco.LocalizationKey.Contains(this.LocalizationKey))) ?? Map.Get<ILocalizationManager>().LanguagesCollection[0];
- }
- public void RemeberMe(string email, string password)
- {
- this.Email = email;
- this.Password = password;
- this.IsRemeberMe = true;
- Logger.WriteInfo(typeof (ApplicationSettings), "RememberMe()", "????????? ?????? ??? ?????");
- this.Save();
- }
- public void ForgetMe()
- {
- this.IsAutoLogin = false;
- this.IsRemeberMe = false;
- this.Password = string.Empty;
- Logger.WriteInfo(typeof (ApplicationSettings), "ForgetMe()", "???????? ?????????, ?????? ??????");
- this.Save();
- }
- public void Save()
- {
- Logger.WriteInfo(typeof (ApplicationSettings), "SaveCredential()", "?????????? ????? ????????...");
- string configFileFullName = ApplicationSettings.ConfigFileFullName;
- try
- {
- lock (ApplicationSettings._lockObject)
- {
- using (FileStream resource_0 = new FileStream(configFileFullName, FileMode.Create))
- {
- new XmlSerializer(typeof (ApplicationSettings)).Serialize((Stream) resource_0, (object) this);
- Logger.WriteInfo(typeof (ApplicationSettings), "SaveCredential()", "????????? ??????? ?????????");
- }
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ApplicationSettings), "SaveCredential()", "?????? ??? ?????????? ????? ???????? ??????????", ex);
- }
- }
- private static ApplicationSettings CreateNewSettings()
- {
- Logger.WriteInfo(typeof (ApplicationSettings), "CreateNewSettings()", "???????? ?????? ????? ????????...");
- ApplicationSettings applicationSettings = new ApplicationSettings();
- applicationSettings.Save();
- Logger.WriteInfo(typeof (ApplicationSettings), "CreateNewSettings()", "????? ???? ???????? ??????");
- return applicationSettings;
- }
- private static ApplicationSettings ReadConfigSettingFromFile(bool isEnableTryRead)
- {
- try
- {
- string configFileFullName = ApplicationSettings.ConfigFileFullName;
- if (!File.Exists(configFileFullName))
- return ApplicationSettings.CreateNewSettings();
- lock (ApplicationSettings._lockObject)
- {
- using (FileStream resource_0 = File.OpenRead(configFileFullName))
- {
- Logger.WriteError((object) typeof (ApplicationSettings), "ReadConfigSettingFromFile()", "file opened. Start XmlSerializer.");
- return (ApplicationSettings) new XmlSerializer(typeof (ApplicationSettings)).Deserialize((Stream) resource_0);
- }
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (ApplicationSettings), "ReadConfigSettingFromFile()", "?????? ??? ????????? ???????? , ??????: " + ex.Message, ex);
- if (!isEnableTryRead)
- throw new FileLoadException("?????? ??? ????????? ????????");
- Thread.Sleep(1000);
- return ApplicationSettings.ReadConfigSettingFromFile(false);
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Managers.ScreenManager
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Threading;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Forms;
- using System.Windows.Interop;
- using Telerik.Windows.Controls;
- using WinApp.Data.Model;
- using WinApp.Managers.Interfaces;
- using WinApp.Module;
- using WinApp.Service.Repository.Interface;
- using WinApp.View;
- using WinApp.View.Base;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Services;
- namespace WinApp.Managers
- {
- internal class ScreenManager : IScreenManager
- {
- private readonly Stack<System.Windows.Controls.UserControl> _controlsHistory = new Stack<System.Windows.Controls.UserControl>();
- private Thread _statusEndThread;
- public MainViewUC MainView { get; private set; }
- public void DoVisualSafe(Action action)
- {
- System.Windows.Application.Current.Dispatcher.BeginInvoke((Delegate) action);
- }
- public void SwitchBack()
- {
- Logger.WriteInfo(typeof (ScreenManager), "SwitchBack()", "??????????? ??????? ?? ?????????? ????????...");
- if (!this.CanSwitchBack())
- {
- Logger.WriteWarning(typeof (ScreenManager), "SwitchBack()", "??? ??????????? ????????? ?? ?????????? ????????");
- }
- else
- {
- this._controlsHistory.Pop();
- MainWindowVM viewModel = Map.Get<IMainWindow>().ViewModel;
- if (viewModel == null)
- {
- Logger.WriteWarning(typeof (ScreenManager), "SwitchBack()", "???????? ?????? ???? ???????????");
- }
- else
- {
- viewModel.Content = this._controlsHistory.Peek();
- Logger.WriteInfo(typeof (ScreenManager), "SwitchBack()", "??????? ?? ?????????? ???????? ???????? ???????");
- }
- }
- }
- public bool CanSwitchBack()
- {
- return this._controlsHistory.Count > 1;
- }
- public void SwitchToLogin()
- {
- try
- {
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToLogin()", "?????????? ???????? ?? ???????? ??????...");
- this.MainView = (MainViewUC) null;
- this._controlsHistory.Clear();
- this.SwitchTo((System.Windows.Controls.UserControl) new LoginUC(), false);
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToLogin()", "??????? ?? ???????? ?????? ??????? ????????");
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "SwitchToLogin()", "?????? ??? ???????? ?? ????? ??????: " + ex.Message);
- }
- }
- public void SwitchToNewVersionAvailableWindow(Version appVersionOnSite, Version appVersionCurrent)
- {
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToNewVersionAvailableWindow()", "?????????? ???????? ?? ???? ??????????? ??????????? ????? ??????");
- this.MainView = (MainViewUC) null;
- this._controlsHistory.Clear();
- this.SwitchTo((System.Windows.Controls.UserControl) new VersionUC(appVersionOnSite, appVersionCurrent), false);
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToNewVersionAvailableWindow()", "??????? ?? ???? ??????????? ??????????? ????? ?????? ??????? ????????");
- }
- public void SwitchToMain()
- {
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToMain()", "?????????? ???????? ?? ??????? ????????...");
- this.MainView = new MainViewUC();
- this.SwitchTo((System.Windows.Controls.UserControl) this.MainView, true);
- Logger.WriteInfo(typeof (ScreenManager), "SwitchToMain()", "??????? ?? ??????? ???????? ??????? ????????");
- }
- public void SwitchToInstall(InstallModuleUC installModuleUc, ServiceVM serviceVm, Action<bool> onInstalledAction)
- {
- Logger.WriteInfo((object) this, "SwitchToInstall", "Action to install started");
- System.Windows.Controls.Control oldControl = this.MainView.ViewModel.Content;
- this.MainView.ViewModel.Content = (System.Windows.Controls.Control) installModuleUc;
- installModuleUc.get_ViewModel().set_CloseAction((Action) (() =>
- {
- if (!installModuleUc.get_ViewModel().get_IsInstalled())
- {
- Logger.WriteInfo((object) this, "Install", "Action to install closed without installed");
- }
- else
- {
- Logger.WriteInfo((object) this, "Install", "Action to install closed with successful");
- this.MainView.ViewModel.Content = oldControl;
- Module moduleByProductId = Map.Get<IModuleRepository>().GetModuleByProductId(serviceVm.ProductId);
- moduleByProductId.StateEnum = ModuleState.Installed;
- Map.Get<IModuleRepository>().Save(moduleByProductId);
- serviceVm.RefreshButtonContent();
- onInstalledAction(installModuleUc.get_ViewModel().get_IsInstalled());
- }
- }));
- }
- public void ShowAlert(string message, string title)
- {
- TextBlock textBlock1 = new TextBlock();
- textBlock1.Text = message;
- textBlock1.TextWrapping = TextWrapping.Wrap;
- textBlock1.Width = 400.0;
- TextBlock textBlock2 = textBlock1;
- DialogParameters dialogParameters = new DialogParameters();
- dialogParameters.set_Content((object) textBlock2);
- dialogParameters.set_Header((object) title);
- dialogParameters.set_DialogStartupLocation(WindowStartupLocation.CenterOwner);
- dialogParameters.set_OkButtonContent((object) "OK");
- RadWindow.Alert(dialogParameters);
- }
- public Action ShowStatusMessage(string message, int timeInSeconds, bool isInProgress)
- {
- if (this.MainView == null)
- return (Action) (() => {});
- this.MainView.ViewModel.StatusMessage = message;
- if (this._statusEndThread != null && this._statusEndThread.IsAlive)
- this._statusEndThread.Abort();
- if (isInProgress)
- {
- this.DoVisualSafe((Action) (() => this.MainView.ViewModel.IsStatusInProgress = Visibility.Visible));
- return (Action) (() => this.DoVisualSafe((Action) (() =>
- {
- this.MainView.ViewModel.IsStatusInProgress = Visibility.Collapsed;
- this.MainView.ViewModel.StatusMessage = string.Empty;
- })));
- }
- this._statusEndThread = new Thread((ThreadStart) (() =>
- {
- Thread.Sleep(1000 * timeInSeconds);
- if (this.MainView == null)
- return;
- this.DoVisualSafe((Action) (() => this.MainView.ViewModel.StatusMessage = string.Empty));
- }));
- this._statusEndThread.Start();
- this.DoVisualSafe((Action) (() => this.MainView.ViewModel.IsStatusInProgress = Visibility.Collapsed));
- return (Action) (() => {});
- }
- private void SwitchTo(System.Windows.Controls.UserControl control, bool pushToHistory = true)
- {
- CheckPoint checkPoint = Logger.CheckPointStart("SwithTo " + control.Name);
- try
- {
- MainWindowVM viewModel = Map.Get<IMainWindow>().ViewModel;
- if (viewModel == null)
- return;
- IWindowArrangeView windowArrangeView = control as IWindowArrangeView;
- if (windowArrangeView != null)
- {
- WindowCommon windowCommon = Map.Get<IMainWindow>() as WindowCommon;
- if (windowCommon != null)
- {
- ((UIElement) windowCommon).Visibility = Visibility.Hidden;
- ((UIElement) windowCommon).UpdateLayout();
- ((FrameworkElement) windowCommon).Width = windowArrangeView.WindowWidth;
- ((FrameworkElement) windowCommon).Height = windowArrangeView.WindowHeight;
- ((WindowBase) windowCommon).set_ResizeMode(windowArrangeView.ResizeMode);
- ((UIElement) windowCommon).UpdateLayout();
- Screen screen = Screen.FromHandle(new WindowInteropHelper(windowCommon.ParentWindow).Handle);
- Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
- double num1 = 96.0 / (double) graphics.DpiX;
- double num2 = 96.0 / (double) graphics.DpiY;
- ((WindowBase) windowCommon).set_Left(Math.Round(((double) screen.Bounds.X + ((double) screen.WorkingArea.Width - ((FrameworkElement) windowCommon).ActualWidth / num1) / 2.0) * num1));
- ((WindowBase) windowCommon).set_Top(Math.Round(((double) screen.Bounds.Y + ((double) screen.WorkingArea.Height - ((FrameworkElement) windowCommon).ActualHeight / num2) / 2.0) * num2));
- ((UIElement) windowCommon).Visibility = Visibility.Visible;
- }
- }
- viewModel.Content = control;
- if (!pushToHistory)
- return;
- this._controlsHistory.Push(control);
- }
- finally
- {
- checkPoint.Close();
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Bootstrapper
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers.Data;
- using KairosPlanet.Managers.Interfaces;
- using System;
- using WinApp.Api;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Localization;
- using WinApp.Service;
- using WinApp.View;
- namespace WinApp
- {
- internal class Bootstrapper
- {
- public static void Bootstrap()
- {
- Logger.WriteInfo(typeof (Bootstrapper), "Bootstrap()", "????????????? ??????????? Bootstrapper...");
- Map.Inject<IApplicationSettings>((IApplicationSettings) ApplicationSettings.GetClientSettings());
- Map.Inject<IScreenManager>((IScreenManager) new ScreenManager());
- Map.InjectLazy<IAppTray>((Func<object>) (() => (object) new AppTray()));
- Map.InjectLazy<IMainWindow>((Func<object>) (() => (object) new MainWindow()));
- Map.Inject<ILocalizationManager>((ILocalizationManager) new LocalizationManager());
- Map.Inject<ICountriesManager>((ICountriesManager) new CountriesManager());
- Map.Inject<IModuleResolver>((IModuleResolver) new ModuleResolver());
- Map.Inject<ISessionManager>((ISessionManager) new SessionManager());
- Map.Inject<IPurchaseManager>((IPurchaseManager) new PurchaseManager());
- Logger.WriteInfo(typeof (Bootstrapper), "Bootstrap()", "?????????? Bootstrapper ??????? ???????????????");
- ServiceBootstrapper.Bootstrap();
- ApiBootstrapper.Bootstrap();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Tray.TrayStateVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using KairosPlanet.Properties;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Tray
- {
- public class TrayStateVM : ViewModelBase
- {
- public static TrayStateVM None = new TrayStateVM(Resources.NetworkState_None, "/Assets/Images/None.ico");
- public static TrayStateVM Offline = new TrayStateVM(Resources.NetworkState_Offline, "/Assets/Images/Offline.ico");
- public static TrayStateVM Online = new TrayStateVM(Resources.NetworkState_Online, "/Assets/Images/Online.ico");
- public string ToolTipText { get; private set; }
- public string IconPath { get; private set; }
- private TrayStateVM(string toolTipText, string iconPath)
- {
- this.ToolTipText = toolTipText;
- this.IconPath = iconPath;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Tray.AppTrayVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using IncMap;
- using System;
- using System.Linq.Expressions;
- using System.Windows.Controls;
- using System.Windows.Input;
- using WinApp;
- using WinApp.Managers.Interfaces;
- using WinApp.View;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- using WinApp.ViewModel.MainMenu;
- namespace WinApp.ViewModel.Tray
- {
- public class AppTrayVM : ViewModelBase
- {
- public TrayStateVM TrayState
- {
- get
- {
- switch (AppVM.Instance.NetworkState)
- {
- case NetworkState.None:
- return TrayStateVM.None;
- case NetworkState.NetworkNotFound:
- case NetworkState.ServerNotFound:
- return TrayStateVM.Offline;
- case NetworkState.ServerOnline:
- return TrayStateVM.Online;
- default:
- return (TrayStateVM) null;
- }
- }
- }
- public ICommand ShowWindowCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.ShowWindowCommand), new Action(Map.Get<IMainWindow>().Open));
- }
- }
- public ICommand ServicesCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.ServicesCommand), (Action) (() => this.SwitchToMenuItem((Func<MainMenuCollection, MainMenuItem>) (x => (MainMenuItem) x.Services))));
- }
- }
- public ICommand StatisticsCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.StatisticsCommand), (Action) (() => this.SwitchToMenuItem((Func<MainMenuCollection, MainMenuItem>) (x => (MainMenuItem) x.Statistics))));
- }
- }
- public ICommand ProfileCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.ProfileCommand), (Action) (() => this.SwitchToMenuItem((Func<MainMenuCollection, MainMenuItem>) (x => (MainMenuItem) x.Profile))));
- }
- }
- public ICommand SettingsCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.SettingsCommand), (Action) (() => this.SwitchToMenuItem((Func<MainMenuCollection, MainMenuItem>) (x => (MainMenuItem) x.Settings))));
- }
- }
- public ICommand LogInCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.LogInCommand), new Action(Map.Get<IMainWindow>().Open));
- }
- }
- public ICommand LogOutCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.LogOutCommand), new Action(this.LogOutAction));
- }
- }
- public ICommand ExitCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.ExitCommand), new Action(Map.Get<IMainWindow>().ViewModel.Exit));
- }
- }
- public ContextMenu ContextMenu
- {
- get
- {
- switch (AppVM.Instance.LoginState)
- {
- case LoginState.NoLogin:
- return this.NoLoginContextMenu;
- case LoginState.Done:
- return this.FullContextMenu;
- default:
- return (ContextMenu) null;
- }
- }
- }
- public ContextMenu NoLoginContextMenu { get; set; }
- public ContextMenu FullContextMenu { get; set; }
- public void Refresh()
- {
- this.OnPropertyChanged("TrayState");
- this.OnPropertyChanged("ContextMenu");
- }
- private void SwitchToMenuItem(Func<MainMenuCollection, MainMenuItem> selector)
- {
- MainViewUC mainView = Map.Get<IScreenManager>().MainView;
- mainView.ViewModel.SwithToMenuItem(selector(mainView.ViewModel.MenuItems));
- Map.Get<IMainWindow>().Open();
- }
- private void LogOutAction()
- {
- Map.Get<IApplicationSettings>().ForgetMe();
- AppVM.Instance.ProcedeLogOut();
- Map.Get<IMainWindow>().Open();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Base.EntityVM`1
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System.Collections.Generic;
- using WinApp.Data.Model;
- namespace WinApp.ViewModel.Base
- {
- public abstract class EntityVM<T> : ViewModelBase where T : Entity, new()
- {
- private T _model;
- public long Id
- {
- get
- {
- return this.Model.Id;
- }
- }
- public T Model
- {
- get
- {
- return this._model;
- }
- set
- {
- this._model = value;
- this.OnPropertyChanged("Model");
- foreach (string propertyName in this.GetFieldNames())
- this.OnPropertyChanged(propertyName);
- }
- }
- protected EntityVM(T model)
- {
- this.Model = model;
- }
- protected abstract IEnumerable<string> GetFieldNames();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Base.SymbolHelpers
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Linq.Expressions;
- namespace WinApp.ViewModel.Base
- {
- public static class SymbolHelpers
- {
- public static string GetPropertyName<T>(Expression<Func<T>> propertyExpression)
- {
- if (propertyExpression == null || propertyExpression.Body == null)
- return string.Empty;
- return (propertyExpression.Body as MemberExpression).Member.Name;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Base.CommandHolder
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Windows.Input;
- namespace WinApp.ViewModel.Base
- {
- public class CommandHolder
- {
- private readonly Dictionary<string, ICommand> _commands = new Dictionary<string, ICommand>();
- public ICommand GetOrCreateCommand<T>(Expression<Func<T>> commandNameExpression, Action executeCommandAction)
- {
- return this.GetOrCreateCommand<T>(commandNameExpression, executeCommandAction, (Func<bool>) (() => true));
- }
- public ICommand GetOrCreateCommand<T>(Expression<Func<T>> commandNameExpression, Action<object> executeCommandAction)
- {
- string propertyName = SymbolHelpers.GetPropertyName<T>(commandNameExpression);
- if (!this._commands.ContainsKey(propertyName))
- {
- RelayCommand relayCommand = new RelayCommand(executeCommandAction);
- this._commands.Add(propertyName, (ICommand) relayCommand);
- }
- return this._commands[propertyName];
- }
- public ICommand GetOrCreateCommand<T>(Expression<Func<T>> commandNameExpression, Action executeCommandAction, Func<bool> canExecutePredicate)
- {
- return this.GetOrCreateCommand<T>(commandNameExpression, (Action<object>) (parameter => executeCommandAction()), (Func<object, bool>) (parameter => canExecutePredicate()));
- }
- public ICommand GetOrCreateCommand<T>(Expression<Func<T>> commandNameExpression, Action<object> executeCommandAction, Func<object, bool> canExecutePredicate)
- {
- string propertyName = SymbolHelpers.GetPropertyName<T>(commandNameExpression);
- if (!this._commands.ContainsKey(propertyName))
- {
- RelayCommand relayCommand = new RelayCommand(executeCommandAction, canExecutePredicate);
- this._commands.Add(propertyName, (ICommand) relayCommand);
- }
- return this._commands[propertyName];
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Base.ViewModelBase
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.ComponentModel;
- namespace WinApp.ViewModel.Base
- {
- public class ViewModelBase : INotifyPropertyChanged, IDataErrorInfo
- {
- private CommandHolder _commands;
- public CommandHolder Commands
- {
- get
- {
- return this._commands ?? (this._commands = new CommandHolder());
- }
- }
- public virtual string Error
- {
- get
- {
- return string.Empty;
- }
- }
- public virtual string this[string columnName]
- {
- get
- {
- return string.Empty;
- }
- }
- public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string propertyName)
- {
- if (this.PropertyChanged == null)
- return;
- try
- {
- this.PropertyChanged((object) this, new PropertyChangedEventArgs(propertyName));
- }
- catch (Exception ex)
- {
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Base.RelayCommand
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Threading;
- namespace WinApp.ViewModel.Base
- {
- public class RelayCommand : ICommand
- {
- private readonly Action<object> _execute;
- private readonly Func<object, bool> _canExecute;
- private EventHandler _internalCanExecuteChanged;
- public event EventHandler CanExecuteChanged
- {
- add
- {
- this._internalCanExecuteChanged += value;
- CommandManager.RequerySuggested += value;
- }
- remove
- {
- this._internalCanExecuteChanged += value;
- CommandManager.RequerySuggested -= value;
- }
- }
- public RelayCommand(Action<object> execute)
- : this(execute, (Func<object, bool>) null)
- {
- }
- public RelayCommand(Action<object> execute, Func<object, bool> canExecute)
- {
- if (execute == null)
- throw new ArgumentNullException("execute");
- this._execute = execute;
- this._canExecute = canExecute;
- }
- public bool CanExecute(object parameter)
- {
- if (this._canExecute != null)
- return this._canExecute(parameter);
- return true;
- }
- public void Execute(object parameter)
- {
- this._execute(parameter);
- }
- public void RaiseCanExecuteChanged()
- {
- if (this._canExecute == null)
- return;
- Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate) (() => this.OnCanExecuteChanged()));
- }
- protected virtual void OnCanExecuteChanged()
- {
- EventHandler eventHandler = this._internalCanExecuteChanged;
- if (eventHandler == null)
- return;
- eventHandler((object) this, EventArgs.Empty);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Services.ServiceVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet;
- using KairosPlanet.Managers.Interfaces;
- using KairosPlanet.Properties;
- using KairosPlanet.ViewModel.Services;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Globalization;
- using System.IO;
- using System.Threading;
- using System.Windows;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Markup;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Threading;
- using Telerik.Windows.Controls;
- using WinApp.Data.Model;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- using WinApp.Module;
- using WinApp.Service.Repository.Interface;
- using WinApp.View.Helpers;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Services
- {
- internal class ServiceVM : ViewModelBase
- {
- private static object _lockObject = new object();
- private readonly Product _product;
- private Purchase _purchase;
- private Module _module;
- private bool _isDisabledProduct;
- private TileViewItemState _state;
- private FlowDocument _richDescription;
- private ImageSource _image;
- private IModuleManager _manager;
- private IModuleResolver _moduleResolver;
- public long ProductId
- {
- get
- {
- return this._product.Id;
- }
- }
- public Purchase Purchase
- {
- get
- {
- return this._purchase;
- }
- }
- public string ServiceButtonContent
- {
- get
- {
- if (!this._isDisabledProduct)
- {
- switch (this._module.StateEnum)
- {
- case ModuleState.Buy:
- return Resources.ServiceVM_Buy;
- case ModuleState.Install:
- return Resources.ServiceVM_Install;
- case ModuleState.Installed:
- return Resources.ServiceVM_Activate;
- case ModuleState.InstalledAndActivated:
- case ModuleState.ValidityCompleted:
- case ModuleState.Blocked:
- return Resources.ServiceVM_Details;
- case ModuleState.Order:
- return Resources.ServiceVM_Order;
- }
- }
- return Resources.ServiceVM_Details;
- }
- }
- public TileViewItemState State
- {
- get
- {
- return this._state;
- }
- set
- {
- this._state = value;
- this.OnPropertyChanged("State");
- this.OnPropertyChanged("RichDescription");
- }
- }
- public string Title
- {
- get
- {
- return this._product.Title;
- }
- set
- {
- this._product.Title = value;
- this.OnPropertyChanged("Title");
- }
- }
- public double Price
- {
- get
- {
- return this._product.Price;
- }
- set
- {
- this._product.Price = value;
- this.OnPropertyChanged("Price");
- }
- }
- public ImageSource Image
- {
- get
- {
- return this._image;
- }
- private set
- {
- this._image = value;
- this.OnPropertyChanged("Image");
- }
- }
- public DateTime? PurchaseDate
- {
- get
- {
- if (this._purchase == null)
- return new DateTime?();
- return this._purchase.Date;
- }
- }
- public string BackgroundColor
- {
- get
- {
- if (this._module.StateEnum == ModuleState.ValidityCompleted || this._isDisabledProduct)
- return "#253A516B";
- if (this._module.StateEnum == ModuleState.Order)
- return "#55A3AD1D";
- return this._module.StateEnum != ModuleState.Buy ? "#553A516B" : "Transparent";
- }
- }
- public double EnableOpacity
- {
- get
- {
- return this._module.StateEnum != ModuleState.ValidityCompleted && !this._isDisabledProduct ? 1.0 : 0.65;
- }
- }
- public bool IsEnableMainButton
- {
- get
- {
- if (this._module.StateEnum != ModuleState.ValidityCompleted)
- return !this._isDisabledProduct;
- return false;
- }
- }
- public ICommand RestoreStateCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.RestoreStateCommand), (Action) (() => this.State = (TileViewItemState) 0));
- }
- }
- public FlowDocument RichDescription
- {
- get
- {
- if (this._richDescription == null && this._state == 1)
- new Thread(new ThreadStart(this.GetDetailedDescription))
- {
- CurrentCulture = Thread.CurrentThread.CurrentCulture,
- CurrentUICulture = Thread.CurrentThread.CurrentUICulture,
- IsBackground = true
- }.Start();
- return this._richDescription;
- }
- }
- public ICommand MainCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.MainCommand), new Action(this.MainAction));
- }
- }
- public ServiceVM(Product product, Purchase purchase)
- {
- this._product = product;
- this._purchase = purchase;
- this._module = this.GetModule();
- this.UpdateByInnerPurchase();
- new Thread(new ThreadStart(this.GetImageFromUrl))
- {
- IsBackground = true
- }.Start();
- }
- public void RefreshButtonContent()
- {
- this.OnPropertyChanged("ServiceButtonContent");
- this.OnPropertyChanged("IsEnableMainButton");
- this.OnPropertyChanged("EnableOpacity");
- this.OnPropertyChanged("BackgroundColor");
- }
- public void DisableProduct()
- {
- this._isDisabledProduct = true;
- }
- public void Update(Purchase purchase)
- {
- if (purchase.ProductId != this.ProductId)
- return;
- lock (ServiceVM._lockObject)
- {
- if (this._module == null)
- return;
- this._purchase = purchase;
- this.UpdateByInnerPurchase();
- }
- }
- internal void UpdateByInnerPurchase()
- {
- if (this._module == null)
- return;
- lock (ServiceVM._lockObject)
- {
- ModuleState local_0 = this._module.StateEnum;
- bool local_1 = true;
- if (this._purchase == null)
- this._module.StateEnum = this._product.Price <= AppVM.Instance.ActivePackagePrice ? ModuleState.Blocked : ModuleState.Buy;
- else if ((this._purchase.PackageStatus == 1 || this._purchase.PackageStatus == 3) && this._purchase.Status == 1)
- {
- if (AppVM.Instance.ModuleErrorState == ModuleErrorState.CrashOrNotFoundMainFile || AppVM.Instance.ModuleErrorState == ModuleErrorState.ModuleNotInstalledMessage)
- {
- this._module.StateEnum = ModuleState.Install;
- Logger.WriteInfo((object) this, "UpdateByInnerPurchase", string.Concat(new object[4]
- {
- (object) "Update product '",
- (object) this._product.Title,
- (object) "': ModuleErrorState = ",
- (object) AppVM.Instance.ModuleErrorState
- }));
- local_1 = false;
- }
- else
- this._module.StateEnum = this.ProductIsInstalledAndActivated() ? ModuleState.InstalledAndActivated : ModuleState.Install;
- }
- else if ((this._purchase.PackageStatus == 1 || this._purchase.PackageStatus == 3) && this._purchase.Status == 3)
- this._module.StateEnum = ModuleState.Order;
- else if (this._purchase.PackageStatus == 4)
- this._module.StateEnum = ModuleState.ValidityCompleted;
- else if (this._purchase.PackageStatus == 5)
- this._module.StateEnum = ModuleState.Blocked;
- if (local_1 && this._module.StateEnum != local_0)
- {
- Map.Get<IModuleRepository>().Save(this._module);
- Logger.WriteInfo((object) this, "UpdateByInnerPurchase", "Module status changed and saved from '" + (object) local_0 + "' to '" + (string) (object) this._module.StateEnum + "'");
- }
- this.RefreshButtonContent();
- }
- }
- private bool ProductIsInstalledAndActivated()
- {
- lock (ServiceVM._lockObject)
- {
- try
- {
- return Map.Get<IModuleRepository>().IsInstalledAndActivated(this._product.Id);
- }
- catch (Exception exception_0)
- {
- Logger.WriteError((object) this, "ProductIsInstalledAndActivated", "Error by read module info from DB for product '" + this._product.Title + "'", exception_0);
- return false;
- }
- }
- }
- private Module GetModule()
- {
- Module moduleByProductId = Map.Get<IModuleRepository>().GetModuleByProductId(this.ProductId);
- if (moduleByProductId != null)
- return moduleByProductId;
- Module entity = new Module()
- {
- ProductId = this.ProductId,
- StateEnum = ModuleState.Buy
- };
- Map.Get<IModuleRepository>().Save(entity);
- return entity;
- }
- private void GetImageFromUrl()
- {
- Uri uri;
- try
- {
- Logger.WriteInfo((object) this, "GetImageFromUrl()", "Product " + this._product.Title + " ImageUrl = " + this._product.ImageUrl);
- uri = new Uri(string.IsNullOrEmpty(this._product.ImageUrl) ? string.Format("{0}/main/img/{1}.png", (object) ApplicationSettings.ServiceUri, (object) this._product.Title.ToLowerInvariant()) : this._product.ImageUrl);
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetImageFromUrl()", "Error get uri for product '" + this._product.Title + "'. product.ImageUrl = '" + this._product.ImageUrl + "'", ex);
- uri = new Uri(string.Format("{0}/main/img/{1}.png", (object) ApplicationSettings.ServiceUri, (object) this._product.Title.ToLowerInvariant()));
- }
- try
- {
- BitmapImage image = new BitmapImage();
- image.BeginInit();
- image.StreamSource = WebHelper.DownloadImage(uri, Environment.ExpandEnvironmentVariables(string.Format("%TEMP%\\Kairos\\{0}_img.png", (object) this._product.Title.ToLowerInvariant())));
- image.EndInit();
- image.Freeze();
- Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate) (() => this.Image = (ImageSource) image));
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "GetImageFromUrl()", "Error get uri for product '" + this._product.Title + "'. url = '" + uri.AbsolutePath + "'", ex);
- }
- }
- private void GetDetailedDescription()
- {
- lock (ServiceVM._lockObject)
- {
- Stream local_0 = this.GetRtfTextDescription(this._product);
- FlowDocument local_1 = new FlowDocument();
- new TextRange(local_1.ContentStart, local_1.ContentEnd).Load(local_0, DataFormats.Rtf);
- MemoryStream stream = new MemoryStream();
- XamlWriter.Save((object) local_1, (Stream) stream);
- stream.Position = 0L;
- Application.Current.Dispatcher.BeginInvoke((Delegate) (() =>
- {
- this._richDescription = (FlowDocument) XamlReader.Load((Stream) stream);
- this.OnPropertyChanged("RichDescription");
- }));
- }
- }
- private Stream GetRtfTextDescription(Product product)
- {
- lock (ServiceVM._lockObject)
- {
- string local_4 = RtfReplaseser.Replase(new StreamReader(Application.GetResourceStream(new Uri(Resources.ServicesVM_ProductDescriptionFileName, UriKind.Relative)).Stream).ReadToEnd(), new Dictionary<string, string>()
- {
- {
- "<%ProductTitle%>",
- product.Title
- },
- {
- "<%ProductPrice%>",
- product.Price.ToString((IFormatProvider) CultureInfo.CurrentCulture)
- },
- {
- "<%Available%>",
- product.Attributes.Available
- },
- {
- "<%BasicIncome%>",
- product.Attributes.BasicIncome
- },
- {
- "<%BasicIncomePeriod%>",
- product.Attributes.BasicIncomePeriod
- },
- {
- "<%DiscSpace%>",
- product.Attributes.DiscSpace.ToString()
- },
- {
- "<%InvestmentPeriod%>",
- product.Attributes.InvestmentPeriod
- },
- {
- "<%Profit%>",
- product.Attributes.Profit
- },
- {
- "<%Start%>",
- product.Attributes.Start
- },
- {
- "<%TimeOnline%>",
- product.Attributes.TimeOnline
- }
- });
- MemoryStream local_5 = new MemoryStream();
- new StreamWriter((Stream) local_5).Write(local_4);
- local_5.Position = 0L;
- return (Stream) local_5;
- }
- }
- private void MainAction()
- {
- lock (ServiceVM._lockObject)
- {
- if (this._module == null)
- return;
- switch (this._module.StateEnum)
- {
- case ModuleState.Buy:
- Process.Start(this._product.ProductUrl);
- break;
- case ModuleState.Install:
- this.InstallModule();
- break;
- case ModuleState.Installed:
- this.ActivateInstalledModule(true);
- break;
- case ModuleState.InstalledAndActivated:
- case ModuleState.ValidityCompleted:
- case ModuleState.Blocked:
- case ModuleState.Order:
- this.State = (TileViewItemState) 1;
- break;
- }
- }
- }
- private void InstallModule()
- {
- lock (ServiceVM._lockObject)
- {
- try
- {
- WinApp.Data.Model.ModuleInfo local_0 = Map.Get<IModuleResolver>().GetModuleInfo(this._product.Id);
- if (local_0 == null)
- {
- Logger.WriteError((object) this, "InstallModule", "Module Info not found. exit from install");
- }
- else
- {
- if (this._moduleResolver == null)
- this._moduleResolver = Map.Get<IModuleResolver>();
- if (this._manager == null)
- {
- Logger.WriteWarning((object) this, "InstallModule", "Module not found. Start get it");
- this._manager = this._moduleResolver.GetModuleManager(local_0);
- }
- if (this._manager == null)
- return;
- Map.Get<IScreenManager>().SwitchToInstall(this._manager.Install((InvestmentType) 3, this._product.Attributes.DiscSpace, (IModuleCallback) this._moduleResolver), this, new Action<bool>(this.ActivateInstalledModule));
- }
- }
- catch (Exception exception_0)
- {
- Logger.WriteError((object) this, "InstallModule", "Install module for product '" + this._product.Title + "' error:" + exception_0.Message);
- int temp_27 = (int) MessageBox.Show("Product not installed", "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
- }
- }
- }
- private void ActivateInstalledModule(bool isInstalled)
- {
- lock (ServiceVM._lockObject)
- {
- try
- {
- if (isInstalled)
- {
- this._module.StateEnum = ModuleState.Installed;
- this.RefreshButtonContent();
- }
- Logger.WriteInfo((object) this, "ActivateInstalledModule", "Start action of activation");
- if (Map.Get<IPurchaseManager>().ActivateModule(this._purchase))
- {
- this._module.StateEnum = ModuleState.InstalledAndActivated;
- AppVM.Instance.SetActivePackage(this._purchase.ProductId);
- Logger.WriteInfo((object) this, "ActivateInstalledModule", string.Format(Resources.ScreenManager_ModuleInstalled, (object) this._product.Title));
- IScreenManager local_1 = Map.Get<IScreenManager>();
- local_1.DoVisualSafe(local_1.ShowStatusMessage(string.Format(Resources.ScreenManager_ModuleInstalled, (object) this._product.Title), 15, false));
- }
- else
- {
- this._module.StateEnum = ModuleState.Install;
- Map.Get<IScreenManager>().ShowStatusMessage(Resources.ActivationError_TryReinstallModule, 5, false);
- }
- }
- catch (Exception exception_0)
- {
- Logger.WriteError((object) this, "ModuleInstalled", "Activate module after install for product '" + this._product.Title + "' error:", exception_0);
- int temp_32 = (int) MessageBox.Show("Activate installed product problem", "Error", MessageBoxButton.OK, MessageBoxImage.Hand);
- }
- }
- this.RefreshButtonContent();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.LoginVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Input;
- using WinApp;
- using WinApp.Data.Helpers;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Network;
- namespace WinApp.ViewModel
- {
- internal class LoginVM : LoginBaseVM
- {
- private Visibility _visibleCheckBoxChangePing = Visibility.Hidden;
- private Visibility _visibleHttpWarning = Visibility.Hidden;
- private bool _remeberMeEnabled;
- private byte _countPing;
- private bool _isCheckHttpPing;
- public bool RemeberMeEnabled
- {
- get
- {
- return this._remeberMeEnabled;
- }
- set
- {
- this._remeberMeEnabled = value;
- if (this._remeberMeEnabled)
- Map.Get<IApplicationSettings>().IsAutoLogin = true;
- this.OnPropertyChanged("RemeberMeEnabled");
- }
- }
- public bool IsConnectionAvailable
- {
- get
- {
- bool flag = NetworkMonitor.NetworkState == NetworkState.ServerOnline;
- if (flag)
- this.VisibleCheckBoxChangePing = Visibility.Hidden;
- return flag;
- }
- }
- public bool IsCheckHttpPing
- {
- get
- {
- this._isCheckHttpPing = Map.Get<IApplicationSettings>().IsHttpUsed;
- return this._isCheckHttpPing;
- }
- set
- {
- this._isCheckHttpPing = value;
- NetworkMonitor.SetPingThrough(this._isCheckHttpPing);
- Map.Get<IApplicationSettings>().SetHttpPingUsed(this._isCheckHttpPing);
- this.OnPropertyChanged("IsCheckHttpPing");
- this.OnPropertyChanged("IsCheckIcmpPing");
- this.OnPropertyChanged("VisibleHttpWarning");
- }
- }
- public bool IsCheckIcmpPing
- {
- get
- {
- return !this.IsCheckHttpPing;
- }
- set
- {
- this.IsCheckHttpPing = false;
- }
- }
- public Visibility VisibleCheckBoxChangePing
- {
- get
- {
- if (Map.Get<IApplicationSettings>().IsHttpUsed)
- this._visibleCheckBoxChangePing = Visibility.Visible;
- return this._visibleCheckBoxChangePing;
- }
- set
- {
- this._visibleCheckBoxChangePing = value;
- this.OnPropertyChanged("VisibleCheckBoxChangePing");
- }
- }
- public Visibility VisibleHttpWarning
- {
- get
- {
- return !this.IsCheckHttpPing ? Visibility.Hidden : Visibility.Visible;
- }
- set
- {
- this.OnPropertyChanged("VisibleHttpWarning");
- }
- }
- public ICommand DoRegister
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.DoRegister), (Action) (() => Process.Start(ApplicationSettings.ServiceUri + "/register/")));
- }
- }
- public ICommand DoRestorePassword
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.DoRestorePassword), (Action) (() => Process.Start(ApplicationSettings.ServiceUri + "/resetting/request")));
- }
- }
- public LoginVM()
- {
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.NetworkMonitor_NetworkStateChanged);
- NetworkMonitor.ConnectionAttemptFailed += new EventHandler<EventArgs>(this.NetworkMonitorOnConnectionAttemptFailed);
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline)
- return;
- this.TryAutoLogin();
- }
- public LoginVM(string email, string password)
- : base(email, password)
- {
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.NetworkMonitor_NetworkStateChanged);
- NetworkMonitor.ConnectionAttemptFailed += new EventHandler<EventArgs>(this.NetworkMonitorOnConnectionAttemptFailed);
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline)
- return;
- this.TryAutoLogin();
- }
- public void Initialize()
- {
- try
- {
- this._remeberMeEnabled = Map.Get<IApplicationSettings>().IsRemeberMe;
- this.OnPropertyChanged("RemeberMeEnabled");
- string email = Map.Get<IApplicationSettings>().Email;
- this.EmailEditable = string.IsNullOrEmpty(email) || !AppVM.Instance.ActivePackageId.HasValue || AppVM.Instance.ActivePackageId.Value < 1L;
- this.Email = email;
- if (string.IsNullOrEmpty(this.Email) || !this.RemeberMeEnabled)
- return;
- this.Password = Map.Get<IApplicationSettings>().Password;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "Initialize()", "??????: " + ex.Message);
- }
- }
- protected override void PassAction(bool isAutoLogin)
- {
- if (!isAutoLogin)
- {
- if (this.RemeberMeEnabled)
- {
- Map.Get<IApplicationSettings>().RemeberMe(this.Email, this.Password);
- }
- else
- {
- Map.Get<IApplicationSettings>().ForgetMe();
- Map.Get<IApplicationSettings>().Email = this.Email;
- Map.Get<IApplicationSettings>().Save();
- }
- }
- AppVM.Instance.LogIn();
- }
- protected override LoginResponce RequestLogin(string email, string password)
- {
- Logger.WriteInfo(typeof (LoginVM), "RequestLogin()", "?????? ?? ???? ? ???????");
- LoginResponce loginResponce = Map.Get<ISessionManager>().Login(email.ToLower(), password);
- Logger.WriteInfo(typeof (LoginVM), "RequestLogin()", string.Format("????? ?? ??????: '{0}'", (object) loginResponce.Result));
- return loginResponce;
- }
- private void NetworkMonitor_NetworkStateChanged(object sender, NetworkStateEventArgs e)
- {
- this.OnPropertyChanged("IsConnectionAvailable");
- if (!this.IsConnectionAvailable)
- return;
- this.TryAutoLogin();
- }
- private void TryAutoLogin()
- {
- try
- {
- if (!Map.Get<IApplicationSettings>().IsAutoLogin)
- return;
- Logger.WriteInfo((object) this, "TryAutoLogin()", "??????? ?????????. ????? ??????? ????? ? ???????");
- Application.Current.Dispatcher.BeginInvoke((Delegate) (() => this.ExecuteLogin(true)));
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "TryAutoLogin()", "?????? ??? ??????? ?????????? ??????" + ex.ToString(), ex);
- }
- }
- private void NetworkMonitorOnConnectionAttemptFailed(object sender, EventArgs eventArgs)
- {
- this.VisibleCheckBoxChangePing = Visibility.Visible;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.SessionChartItemVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel
- {
- public class SessionChartItemVM : ViewModelBase
- {
- private DateTime _date;
- private double _duration;
- public DateTime Date
- {
- get
- {
- return this._date;
- }
- set
- {
- this._date = value;
- this.OnPropertyChanged("EndTime");
- }
- }
- public double Duration
- {
- get
- {
- return this._duration;
- }
- set
- {
- this._duration = value;
- this.OnPropertyChanged("Duration");
- }
- }
- public SessionChartItemVM(DateTime date, double minutes)
- {
- this._date = date;
- this._duration = minutes;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.SessionStatisticsVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers;
- using KairosPlanet.Managers.Network;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using System.Timers;
- using System.Windows;
- using System.Windows.Input;
- using WinApp;
- using WinApp.Api.Data;
- using WinApp.Data.Helpers;
- using WinApp.Managers;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Network;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class SessionStatisticsVM : ViewModelBase
- {
- private static object _lockObject = new object();
- private TimeSpan _sessionTime = new TimeSpan();
- private object _sessionTimeLock = new object();
- private System.Timers.Timer _timer;
- private TimeSpan _allSessionTime;
- private TimeSpan _today;
- private TimeSpan _yesterday;
- private TimeSpan _currentMonth;
- private TimeSpan _lastMonth;
- private TimeSpan _total;
- private bool _isStartPing;
- private DateTime _lastDateTimeUpdateSessionTime;
- private DateTime _currentDate;
- private Thread _loadThread;
- public string CurrentSession
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this.SessionTime, "{0:00}:{1:00}:{2:00}");
- }
- }
- public string Today
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this._today.Add(this.SessionTime), "{0:00}:{1:00}");
- }
- }
- public string Yesterday
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this._yesterday, "{0:00}:{1:00}");
- }
- }
- public string CurrentMonth
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this._currentMonth.Add(this.SessionTime), "{0:00}:{1:00}");
- }
- }
- public string LastMonth
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this._lastMonth, "{0:00}:{1:00}");
- }
- }
- public string Total
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(this._total.Add(this.SessionTime), "{0:00}:{1:00}");
- }
- }
- public string TimeLeftToEarnMoney
- {
- get
- {
- return TimeSpanExtention.TotalTimeString(TimeSpan.FromHours(500.0).Subtract(this._currentMonth.Add(this.SessionTime)), "{0:00}:{1:00}");
- }
- }
- public Visibility NotPingVisibility
- {
- get
- {
- return !this._isStartPing && !AppVM.Instance.ActivePackageId.HasValue ? Visibility.Visible : Visibility.Collapsed;
- }
- }
- public Visibility NotPingAndRetrievingDataVisibility
- {
- get
- {
- return this._isStartPing || !AppVM.Instance.ActivePackageId.HasValue ? Visibility.Collapsed : Visibility.Visible;
- }
- }
- public Visibility PingVisibility
- {
- get
- {
- return !this._isStartPing ? Visibility.Collapsed : Visibility.Visible;
- }
- }
- public ICommand RefreshCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.RefreshCommand), new Action(this.DoRefresh), new Func<bool>(this.CanRefresh));
- }
- }
- private TimeSpan SessionTime
- {
- get
- {
- return this._sessionTime;
- }
- set
- {
- if (this._sessionTime == value)
- return;
- TimeSpan timeSpan = this._sessionTime;
- this._sessionTime = value;
- this.OnPropertyChanged("CurrentSession");
- if (timeSpan.Minutes == this._sessionTime.Minutes)
- return;
- this.OnPropertyChanged("Today");
- this.OnPropertyChanged("CurrentMonth");
- this.OnPropertyChanged("Total");
- }
- }
- public SessionStatisticsVM()
- {
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.OnNetworkStateChanged);
- this.InitializeTimer();
- this.OnNetworkStateChanged((object) this, new NetworkStateEventArgs(AppVM.Instance.NetworkState));
- Map.Get<ISessionManager>();
- SessionMonitor.Instance.PingEvent += new SessionMonitor.PingEventHandler(this.OnPingEvent);
- SessionMonitor.Instance.SessionStateChanged += new EventHandler<SessionStateEventArgs>(this.OnSessionStateChanged);
- if (SessionMonitor.Instance.FirstSessionPing == null)
- return;
- SessionMonitor.Instance.InvokePingEvent(SessionMonitor.Instance.FirstSessionPing.Lifetime);
- }
- private bool CanRefresh()
- {
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline)
- return false;
- if (this._loadThread != null)
- return !this._loadThread.IsAlive;
- return true;
- }
- private void DoRefresh()
- {
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline)
- return;
- Logger.WriteInfo((object) this, "DoRefresh", "?????? ?????? ???????? ??????????");
- this.UpdateStatisticsAndStatisticCashe();
- }
- private void UpdateStatisticsAndStatisticCashe()
- {
- if (this._loadThread != null && this._loadThread.IsAlive)
- return;
- Logger.WriteInfo((object) this, "UpdateStatisticsAndStatisticCashe", "????? ???? ? ?????????? ?????????? ? ???????");
- this._loadThread = new Thread((ThreadStart) (() =>
- {
- Action action = Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_IsRefreshing, 5, true);
- Thread.Sleep(1000);
- StatisticManager.Instance.SetNeedRefreshStatistics();
- this.UpdateStatistics(true);
- action();
- }))
- {
- CurrentUICulture = Thread.CurrentThread.CurrentUICulture,
- IsBackground = true
- };
- this._loadThread.Start();
- }
- private void OnPingEvent(object sender, PingEventArgs e)
- {
- lock (this._sessionTimeLock)
- {
- if (!this._isStartPing)
- {
- this._isStartPing = true;
- this._timer.Start();
- this.OnPropertyChanged("NotPingVisibility");
- this.OnPropertyChanged("PingVisibility");
- this.OnPropertyChanged("NotPingAndRetrievingDataVisibility");
- }
- this._lastDateTimeUpdateSessionTime = DateTime.Now;
- this.SessionTime = new TimeSpan(0, 0, (int) e.LifeTime);
- }
- this.InitializeTimer();
- }
- private void UpdateStatistics(bool isRefreshCommand = false)
- {
- Logger.WriteInfo(typeof (SessionStatisticsVM), "UpdateStatistics()", "????????? ? ?????????? ?????? ??????????...");
- if (!isRefreshCommand)
- this._currentDate = DateTime.Today;
- DateTime dateTime = this._currentDate;
- Statistic[] totalStatistics = StatisticManager.Instance.GetStatistics();
- if (isRefreshCommand && totalStatistics == null)
- {
- Logger.WriteError((object) typeof (SessionStatisticsVM), "UpdateStatistics()", "??? ?????????? ??????? ?????????? ?????? ?? ?????????? ?? ???????? ??-?? ?????? ?????????? ? ????????. ??????????? ????????? ????????? ????????? ???????????");
- SessionMonitor.Instance.SetSessionStateToSuspended();
- }
- else
- {
- if (totalStatistics == null)
- totalStatistics = new Statistic[0];
- this._today = this.GetTotalTimeByPeriod(new DateTime?(dateTime.Date), new DateTime?(dateTime.Date.AddDays(1.0)), totalStatistics);
- this._yesterday = this.GetTotalTimeByPeriod(new DateTime?(dateTime.Date.AddDays(-1.0)), new DateTime?(dateTime.Date), totalStatistics);
- this._currentMonth = this.GetTotalTimeByPeriod(new DateTime?(dateTime.Date.AddDays((double) (1 - dateTime.Day))), new DateTime?(dateTime.Date.AddDays((double) (1 - dateTime.Day)).AddMonths(1)), totalStatistics);
- this._lastMonth = this.GetTotalTimeByPeriod(new DateTime?(dateTime.Date.AddDays((double) (1 - dateTime.Day)).AddMonths(-1)), new DateTime?(dateTime.Date.AddDays((double) (1 - dateTime.Day))), totalStatistics);
- this._total = this.GetTotalTimeByPeriod(new DateTime?(), new DateTime?(), totalStatistics);
- Logger.WriteInfo(typeof (SessionStatisticsVM), "UpdateStatistics()", "??? ?????? ???????? ? ?????????");
- this.RefreshProperties();
- }
- }
- private void RefreshProperties()
- {
- this.OnPropertyChanged("CurrentSession");
- this.OnPropertyChanged("Today");
- this.OnPropertyChanged("Yesterday");
- this.OnPropertyChanged("CurrentMonth");
- this.OnPropertyChanged("LastMonth");
- this.OnPropertyChanged("Total");
- this.OnPropertyChanged("TimeLeftToEarnMoney");
- this.OnPropertyChanged("NotPingVisibility");
- this.OnPropertyChanged("NotPingAndRetrievingDataVisibility");
- this.OnPropertyChanged("PingVisibility");
- this.RefreshButtonCanExecuteUpdate();
- }
- private void RefreshButtonCanExecuteUpdate()
- {
- RelayCommand relayCommand = this.RefreshCommand as RelayCommand;
- if (relayCommand == null)
- return;
- relayCommand.RaiseCanExecuteChanged();
- }
- private TimeSpan GetTotalTimeByPeriod(DateTime? timeFrom, DateTime? timeTo, Statistic[] totalStatistics)
- {
- try
- {
- Statistic[] statisticArray = !timeTo.HasValue || !timeFrom.HasValue ? totalStatistics : Enumerable.ToArray<Statistic>(Enumerable.Where<Statistic>((IEnumerable<Statistic>) totalStatistics, (Func<Statistic, bool>) (ts =>
- {
- if (ts.CreatedDate >= timeFrom.Value)
- return ts.CreatedDate.AddSeconds((double) ts.Lifetime) <= timeTo.Value;
- return false;
- })));
- if (statisticArray == null || statisticArray.Length == 0)
- return new TimeSpan(0L);
- long num = 0;
- foreach (Statistic statistic in statisticArray)
- {
- if (!statistic.Actual)
- num += statistic.Lifetime;
- }
- return new TimeSpan(0, 0, (int) num);
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "InitializeTotalSessionTime", "?????? ??? ????????? ? ???????? ??????? ?? ???? ???????", ex);
- return new TimeSpan(0L);
- }
- }
- private void OnNetworkStateChanged(object sender, NetworkStateEventArgs e)
- {
- switch (e.State)
- {
- case NetworkState.None:
- case NetworkState.NetworkNotFound:
- case NetworkState.ServerNotFound:
- Logger.WriteInfo(typeof (SessionStatisticsVM), "OnNetworkStateChanged()", "???? ??????? ? ????????? Offline");
- this.StopTimer();
- this.RefreshProperties();
- break;
- case NetworkState.ServerOnline:
- Logger.WriteInfo(typeof (SessionStatisticsVM), "OnNetworkStateChanged()", "???? ??????? ? ????????? Online");
- lock (this._sessionTimeLock)
- {
- this.UpdateStatistics(false);
- if (!this._isStartPing)
- break;
- this._timer.Start();
- break;
- }
- }
- }
- private void OnSessionStateChanged(object sender, SessionStateEventArgs e)
- {
- if (e.State == SessionState.Suspended && this._isStartPing)
- {
- Logger.WriteInfo(typeof (SessionStatisticsVM), "OnSessionStateChanged()", "?????? ??????? ? ????????? Suspended");
- this.StopTimer();
- }
- else
- {
- if (e.State != SessionState.InAccrual || !this._isStartPing)
- return;
- Logger.WriteInfo(typeof (SessionStatisticsVM), "OnSessionStateChanged()", "?????? ??????? ? ????????? Accrual");
- this._timer.Start();
- }
- }
- private void StopTimer()
- {
- if (this._timer == null)
- return;
- this._timer.Enabled = false;
- }
- private void InitializeTimer()
- {
- Logger.WriteInfo(typeof (SessionStatisticsVM), "InitializeTimer()", "????????????? ??????? ?????????? ??????????...");
- this._timer = new System.Timers.Timer(40.0);
- this._timer.Elapsed += new ElapsedEventHandler(this.TimeTick);
- this._timer.AutoReset = false;
- Logger.WriteInfo(typeof (SessionStatisticsVM), "InitializeTimer()", "?????? ?????????? ?????????? ???????????????");
- }
- private void TimeTick(object source, ElapsedEventArgs e)
- {
- lock (this._sessionTimeLock)
- {
- DateTime local_0 = DateTime.Now;
- if (this._currentDate.Date < local_0.Date)
- this.UpdateStatistics(false);
- this.SessionTime += local_0.Subtract(this._lastDateTimeUpdateSessionTime);
- this._lastDateTimeUpdateSessionTime = local_0;
- this._timer.Enabled = true;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.VersionControlVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Diagnostics;
- using System.Linq.Expressions;
- using System.Windows.Input;
- using WinApp.Managers;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class VersionControlVM : ViewModelBase
- {
- private Version _appVersionOnSite;
- private Version _appVersionCurrent;
- public string AppVersionOnSiteText
- {
- get
- {
- return this._appVersionOnSite.ToString();
- }
- }
- public string AppVersionCurrentText
- {
- get
- {
- return this._appVersionCurrent.ToString();
- }
- }
- public ICommand OpenAppDownloadPageCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.OpenAppDownloadPageCommand), new Action(this.OpenAppDownloadPage));
- }
- }
- public ICommand DownloadNewAppVersionCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.DownloadNewAppVersionCommand), new Action(this.DownloadNewAppVersion));
- }
- }
- public ICommand CloseCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.CloseCommand), new Action(this.CloseWindow));
- }
- }
- public VersionControlVM(Version appVersionOnSite, Version appVersionCurrent)
- {
- this._appVersionOnSite = appVersionOnSite;
- this._appVersionCurrent = appVersionCurrent;
- }
- public void ButtonOkClick()
- {
- this.CloseWindow();
- }
- private void OpenAppDownloadPage()
- {
- Process.Start(ApplicationSettings.ServiceUri + "/products/my-purchases/");
- }
- private void DownloadNewAppVersion()
- {
- Process.Start(ApplicationSettings.ServiceUri + "/products/installer/main/downloader/");
- }
- private void CloseWindow()
- {
- AppVM.Instance.ShowMainWindow();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.PersonalInformationVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Linq.Expressions;
- using System.Windows.Input;
- using WinApp.Data.Model;
- using WinApp.Managers.Interfaces;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class PersonalInformationVM : ViewModelBase
- {
- private bool _hasErrors;
- private bool _isInEdit;
- private string _email;
- private string _name;
- private int _genderId;
- private string _phoneNumber;
- private DateTime _birthDate;
- public bool IsInEdit
- {
- get
- {
- return this._isInEdit;
- }
- set
- {
- this._isInEdit = value;
- this.OnPropertyChanged("IsInEdit");
- this.OnPropertyChanged("SaveEditButtonText");
- }
- }
- public List<string> CountriesCollection { get; private set; }
- public string Name
- {
- get
- {
- return this._name;
- }
- set
- {
- this._name = value;
- this.OnPropertyChanged("Name");
- }
- }
- public string Country { get; set; }
- public int GenderId
- {
- get
- {
- return this._genderId;
- }
- set
- {
- this._genderId = value;
- this.OnPropertyChanged("Gender");
- this.OnPropertyChanged("GenderName");
- }
- }
- public string GenderName
- {
- get
- {
- if (this.GenderId != 1)
- return Resources.MaleGender;
- return Resources.FemaleGender;
- }
- }
- public DateTime CreatedDate { get; set; }
- public int UserStatusId { get; set; }
- public DateTime BirthDate
- {
- get
- {
- return this._birthDate;
- }
- set
- {
- this._birthDate = value;
- this.OnPropertyChanged("BirthDate");
- }
- }
- public string Email
- {
- get
- {
- return this._email;
- }
- set
- {
- this._email = value;
- this.OnPropertyChanged("Email");
- }
- }
- public string PhoneNumber
- {
- get
- {
- return this._phoneNumber;
- }
- set
- {
- this._phoneNumber = value;
- this.OnPropertyChanged("PhoneNumber");
- }
- }
- public string SaveEditButtonText
- {
- get
- {
- if (!this.IsInEdit)
- return Resources.SaveEditButton_Edit;
- return Resources.SaveEditButton_Save;
- }
- }
- public ICommand SaveEditButtonCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.SaveEditButtonCommand), new Action(this.SaveEditButtonAction));
- }
- }
- public PersonalInformationVM(Man man)
- {
- this.Name = man.Name;
- this.Email = man.Email;
- this.CreatedDate = DateTime.Parse(man.CreatedDate);
- this.BirthDate = DateTime.Parse(man.BirthDate);
- this.GenderId = man.Gender;
- this.PhoneNumber = man.PhoneNumber;
- this.UserStatusId = man.UserStatus;
- this.InitializeCountries();
- this.Country = man.Country;
- }
- private void SaveEditButtonAction()
- {
- if (this.IsInEdit)
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ?????????? ? ?????? ?????????????? ???????????? ??????????");
- this.HideErrors();
- this.CheckFields();
- if (this._hasErrors)
- {
- Logger.WriteWarning(typeof (ContactInformationVM), "SaveEditButtonAction()", "?????? ??? ????? ?????? ? ?????? ?????????????? ???????????? ??????????");
- }
- else
- {
- this.Save();
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ? ????? ????????? ???????????? ??????????");
- this.IsInEdit = false;
- }
- }
- else
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ? ????? ?????????????? ???????????? ??????????");
- this.IsInEdit = true;
- }
- }
- private void Save()
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveCredential()", "?????????? ????????? ???????????? ??????????...");
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveCredential()", "????????? ???????????? ?????????? ??????? ?????????");
- }
- private void CheckFields()
- {
- }
- private void HideErrors()
- {
- }
- private void InitializeCountries()
- {
- this.CountriesCollection = Map.Get<ICountriesManager>().GetAllCountries();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.ChangePasswordVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using KairosPlanet.Properties;
- using System;
- using System.Windows;
- using System.Windows.Input;
- using WinApp.Data.Helpers;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class ChangePasswordVM : ViewModelBase
- {
- private Visibility _currentPasswordErrorVisibility = Visibility.Hidden;
- private Visibility _newPasswordErrorVisibility = Visibility.Hidden;
- private Visibility _confirmNewPasswordErrorVisibility = Visibility.Hidden;
- private string _currentPassword;
- private string _newPassword;
- private string _confirmNewPassword;
- private string _currentPasswordError;
- private string _newPasswordError;
- private string _confirmNewPasswordError;
- public string CurrentPassword
- {
- get
- {
- return this._currentPassword;
- }
- set
- {
- this._currentPassword = value;
- this.OnPropertyChanged("CurrentPassword");
- }
- }
- public string NewPassword
- {
- get
- {
- return this._newPassword;
- }
- set
- {
- this._newPassword = value;
- this.OnPropertyChanged("NewPassword");
- }
- }
- public string ConfirmNewPassword
- {
- get
- {
- return this._confirmNewPassword;
- }
- set
- {
- this._confirmNewPassword = value;
- this.OnPropertyChanged("ConfirmNewPassword");
- }
- }
- public string CurrentPasswordError
- {
- get
- {
- return this._currentPasswordError;
- }
- set
- {
- this._currentPasswordError = value;
- this.OnPropertyChanged("CurrentPasswordError");
- }
- }
- public string NewPasswordError
- {
- get
- {
- return this._newPasswordError;
- }
- set
- {
- this._newPasswordError = value;
- this.OnPropertyChanged("NewPasswordError");
- }
- }
- public string ConfirmNewPasswordError
- {
- get
- {
- return this._confirmNewPasswordError;
- }
- set
- {
- this._confirmNewPasswordError = value;
- this.OnPropertyChanged("ConfirmNewPasswordError");
- }
- }
- public Visibility CurrentPasswordErrorVisibility
- {
- get
- {
- return this._currentPasswordErrorVisibility;
- }
- set
- {
- this._currentPasswordErrorVisibility = value;
- this.OnPropertyChanged("CurrentPasswordErrorVisibility");
- }
- }
- public Visibility NewPasswordErrorVisibility
- {
- get
- {
- return this._newPasswordErrorVisibility;
- }
- set
- {
- this._newPasswordErrorVisibility = value;
- this.OnPropertyChanged("NewPasswordErrorVisibility");
- }
- }
- public Visibility ConfirmNewPasswordErrorVisibility
- {
- get
- {
- return this._confirmNewPasswordErrorVisibility;
- }
- set
- {
- this._confirmNewPasswordErrorVisibility = value;
- this.OnPropertyChanged("ConfirmNewPasswordErrorVisibility");
- }
- }
- public ICommand ChangePasswordCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.ChangePasswordCommand), (Action) (() => this.ExecuteChangePassword()));
- }
- }
- public bool ExecuteChangePassword()
- {
- Logger.WriteInfo(typeof (ChangePasswordVM), "ExecuteChangePassword()", "??????? ????????? ??????...");
- this.HideAllErrors();
- if (!this.CheckPasswords())
- {
- Logger.WriteWarning(typeof (ChangePasswordVM), "ExecuteChangePassword()", "?????? ??? ????? ?????? ??? ????? ??????");
- return false;
- }
- if (!true)
- {
- Logger.WriteWarning(typeof (ChangePasswordVM), "ExecuteChangePassword()", "?????? ??? ????????? ??????");
- this.ShowCurrentPasswordError(Resources.Error_UserPasswordIncorrect);
- return false;
- }
- Logger.WriteInfo(typeof (ChangePasswordVM), "ExecuteChangePassword()", "?????? ??? ??????? ???????");
- return true;
- }
- public bool Cancel()
- {
- return true;
- }
- internal bool CheckPasswords()
- {
- bool flag = false;
- if (StringUtil.IsNullOrWhiteSpace(this.CurrentPassword))
- {
- this.ShowCurrentPasswordError(Resources.Error_EnterCurrentPasswordToChange);
- flag = true;
- }
- if (StringUtil.IsNullOrWhiteSpace(this.NewPassword))
- {
- this.ShowNewPasswordError(Resources.Error_NewPasswordIsEmpty);
- flag = true;
- }
- if (StringUtil.IsNullOrWhiteSpace(this.ConfirmNewPassword))
- {
- this.ShowConfirmNewPasswordError(Resources.Error_ConfirmNewPasswordIsEmpty);
- flag = true;
- }
- if (flag)
- return false;
- if (this.NewPassword.Equals(this.ConfirmNewPassword))
- return true;
- this.ShowConfirmNewPasswordError(Resources.Error_PasswordsNotIdentical);
- return false;
- }
- private void HideAllErrors()
- {
- this.CurrentPasswordErrorVisibility = Visibility.Hidden;
- this.NewPasswordErrorVisibility = Visibility.Hidden;
- this.ConfirmNewPasswordErrorVisibility = Visibility.Hidden;
- }
- private void ShowCurrentPasswordError(string errorText)
- {
- this.CurrentPasswordErrorVisibility = Visibility.Visible;
- this.CurrentPasswordError = errorText;
- }
- private void ShowNewPasswordError(string errorText)
- {
- this.NewPasswordErrorVisibility = Visibility.Visible;
- this.NewPasswordError = errorText;
- }
- private void ShowConfirmNewPasswordError(string errorText)
- {
- this.ConfirmNewPasswordErrorVisibility = Visibility.Visible;
- this.ConfirmNewPasswordError = errorText;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.ContactInformationVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using KairosPlanet.Properties;
- using System;
- using System.Linq.Expressions;
- using System.Windows.Input;
- using WinApp.Data.Model;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class ContactInformationVM : ViewModelBase
- {
- private bool _hasErrors;
- private bool _isInEdit;
- private string _email1;
- private string _email2;
- private string _telephone1;
- private string _telephone2;
- private string _city;
- private string _zipcode;
- private string _address;
- public bool IsInEdit
- {
- get
- {
- return this._isInEdit;
- }
- set
- {
- this._isInEdit = value;
- this.OnPropertyChanged("IsInEdit");
- this.OnPropertyChanged("SaveEditButtonText");
- }
- }
- public string Email1
- {
- get
- {
- return this._email1;
- }
- set
- {
- this._email1 = value;
- this.OnPropertyChanged("Email1");
- }
- }
- public string Email2
- {
- get
- {
- return this._email2;
- }
- set
- {
- this._email2 = value;
- this.OnPropertyChanged("Email2");
- }
- }
- public string Telephone1
- {
- get
- {
- return this._telephone1;
- }
- set
- {
- this._telephone1 = value;
- this.OnPropertyChanged("Telephone1");
- }
- }
- public string Telephone2
- {
- get
- {
- return this._telephone2;
- }
- set
- {
- this._telephone2 = value;
- this.OnPropertyChanged("Telephone2");
- }
- }
- public string City
- {
- get
- {
- return this._city;
- }
- set
- {
- this._city = value;
- this.OnPropertyChanged("City");
- }
- }
- public string Zipcode
- {
- get
- {
- return this._zipcode;
- }
- set
- {
- this._zipcode = value;
- this.OnPropertyChanged("Zipcode");
- }
- }
- public string Address
- {
- get
- {
- return this._address;
- }
- set
- {
- this._address = value;
- this.OnPropertyChanged("Address");
- }
- }
- public string SaveEditButtonText
- {
- get
- {
- if (!this.IsInEdit)
- return Resources.SaveEditButton_Edit;
- return Resources.SaveEditButton_Save;
- }
- }
- public ICommand SaveEditButtonCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.SaveEditButtonCommand), new Action(this.SaveEditButtonAction));
- }
- }
- public ContactInformationVM(Man man)
- {
- this.Email1 = man.Email;
- this.Telephone1 = man.PhoneNumber;
- }
- private void SaveEditButtonAction()
- {
- if (this.IsInEdit)
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ?????????? ? ?????? ?????????????? ?????????? ??????????");
- this.HideErrors();
- this.CheckFields();
- if (this._hasErrors)
- {
- Logger.WriteWarning(typeof (ContactInformationVM), "SaveEditButtonAction()", "?????? ??? ????? ?????? ? ?????? ?????????????? ?????????? ??????????");
- }
- else
- {
- this.Save();
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ? ????? ????????? ?????????? ??????????");
- this.IsInEdit = false;
- }
- }
- else
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveEditButtonAction()", "??????? ? ????? ?????????????? ?????????? ??????????");
- this.IsInEdit = true;
- }
- }
- private void Save()
- {
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveCredential()", "?????????? ????????? ?????????? ??????????...");
- Logger.WriteInfo(typeof (ContactInformationVM), "SaveCredential()", "????????? ?????????? ?????????? ??????? ?????????");
- }
- private void CheckFields()
- {
- }
- private void HideErrors()
- {
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.ServicesControlVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Managers.Interfaces;
- using KairosPlanet.Properties;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Collections.Specialized;
- using System.Linq;
- using System.Threading;
- using System.Windows;
- using System.Windows.Input;
- using System.Windows.Threading;
- using WinApp;
- using WinApp.Api;
- using WinApp.Data.Model;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Network;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- using WinApp.ViewModel.Services;
- namespace WinApp.ViewModel.Controls
- {
- internal class ServicesControlVM : ViewModelBase
- {
- private static object _lockObject = new object();
- private Thread _loadThread;
- public ObservableCollection<ServiceVM> Services { get; private set; }
- public ICommand RefreshCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.RefreshCommand), new Action(this.DoRefresh), new Func<bool>(this.CanRefresh));
- }
- }
- public ServicesControlVM()
- {
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.OnNetworkStateChanged);
- this.Services = new ObservableCollection<ServiceVM>();
- Map.Get<IPurchaseManager>().Purchases.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnPurchasesChanged);
- AppVM.Instance.ErrorStateChanged += new EventHandler(this.AppVmInstance_ErrorStateChanged);
- this.DoRefresh();
- }
- private bool CanRefresh()
- {
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline)
- return false;
- return !this._loadThread.IsAlive;
- }
- private void OnNetworkStateChanged(object sender, NetworkStateEventArgs e)
- {
- this.RefreshProperties();
- }
- private void RefreshProperties()
- {
- this.RefreshButtonCanExecuteUpdate();
- }
- private void RefreshButtonCanExecuteUpdate()
- {
- RelayCommand relayCommand = this.RefreshCommand as RelayCommand;
- if (relayCommand == null)
- return;
- relayCommand.RaiseCanExecuteChanged();
- }
- private void LoadServices()
- {
- lock (ServicesControlVM._lockObject)
- {
- Action local_0 = Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_ServicesLoading, 5, true);
- try
- {
- Product[] local_1 = Map.Get<ISessionManager>().Api.GetProducts();
- Purchase[] local_2 = Enumerable.ToArray<Purchase>((IEnumerable<Purchase>) Map.Get<IPurchaseManager>().Purchases);
- List<ServiceVM> serviceVms = new List<ServiceVM>();
- if (local_1 == null)
- {
- Logger.WriteWarning((object) this, "LoadServices()", "Products is not loaded");
- Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_CanNotLoadServices, 5, false);
- return;
- }
- Logger.WriteInfo((object) this, "LoadServices()", "Loaded products count: " + (object) local_1.Length);
- this.SetActivePackagePrice(local_1);
- int local_3 = -1;
- foreach (Product item_0 in local_1)
- {
- Product product = item_0;
- Purchase local_4 = Enumerable.FirstOrDefault<Purchase>((IEnumerable<Purchase>) local_2, (Func<Purchase, bool>) (p => p.ProductId == product.Id));
- serviceVms.Add(new ServiceVM(product, local_4));
- if (local_4 == null)
- {
- Logger.WriteInfo((object) this, "LoadServices()", string.Format("Product : {0} (product.Status={1}) purchase is not founded", (object) product.Title, (object) product.Status));
- }
- else
- {
- if (local_4.PackageStatus == 3)
- local_3 = (int) local_4.Price;
- Logger.WriteInfo((object) this, "LoadServices()", string.Format("Product : {0} (product.Status={1}) purchase: purchase.PackageStatus={2}, purchase.Status={3}", (object) product.Title, (object) product.Status, (object) local_4.PackageStatus, (object) local_4.Status));
- }
- }
- if (local_3 != -1)
- {
- foreach (ServiceVM item_1 in serviceVms)
- {
- if ((double) local_3 > item_1.Price && item_1.Purchase == null)
- item_1.DisableProduct();
- }
- }
- Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Delegate) (() => Enumerable.ToList<ServiceVM>((IEnumerable<ServiceVM>) Enumerable.OrderBy<ServiceVM, double>((IEnumerable<ServiceVM>) serviceVms, (Func<ServiceVM, double>) (s => s.Price))).ForEach((Action<ServiceVM>) (x => this.Services.Add(x)))));
- }
- catch (ApiException exception_0)
- {
- Logger.WriteError((object) this, "LoadServices()", "Error: ", (Exception) exception_0);
- }
- local_0();
- }
- }
- private void SetActivePackagePrice(Product[] products)
- {
- lock (ServicesControlVM._lockObject)
- {
- if (!AppVM.Instance.ActivePackageId.HasValue)
- {
- AppVM.Instance.ActivePackagePrice = 0.0;
- }
- else
- {
- Product local_0 = (Product) null;
- if (products != null)
- local_0 = Enumerable.FirstOrDefault<Product>((IEnumerable<Product>) products, (Func<Product, bool>) (p => p.Id == AppVM.Instance.ActivePackageId.Value));
- AppVM.Instance.ActivePackagePrice = local_0 == null ? 0.0 : local_0.Price;
- }
- }
- }
- private void DoRefresh()
- {
- if (NetworkMonitor.NetworkState != NetworkState.ServerOnline || this._loadThread != null && this._loadThread.IsAlive)
- return;
- if (this.Services.Count == 0)
- {
- this._loadThread = new Thread(new ThreadStart(this.LoadServices))
- {
- CurrentUICulture = Thread.CurrentThread.CurrentUICulture,
- IsBackground = true
- };
- this._loadThread.Start();
- }
- else
- {
- this._loadThread = new Thread((ThreadStart) (() =>
- {
- Action action = Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_IsRefreshing, 5, true);
- Map.Get<IPurchaseManager>().UpdatePurchases();
- this.RefreshServicesState();
- action();
- this.RefreshProperties();
- }))
- {
- CurrentUICulture = Thread.CurrentThread.CurrentUICulture,
- IsBackground = true
- };
- this._loadThread.Start();
- }
- }
- private void RefreshServicesState()
- {
- lock (ServicesControlVM._lockObject)
- {
- Logger.WriteInfo((object) this, "RefreshServicesState", "Execute refresh state for services");
- Enumerable.ToList<ServiceVM>((IEnumerable<ServiceVM>) this.Services).ForEach((Action<ServiceVM>) (s => s.UpdateByInnerPurchase()));
- }
- }
- private void AppVmInstance_ErrorStateChanged(object sender, EventArgs e)
- {
- this.RefreshServicesState();
- }
- private void ShowUpdateMessage(string productTitle)
- {
- IScreenManager manager = Map.Get<IScreenManager>();
- manager.DoVisualSafe((Action) (() => manager.ShowAlert(string.Format(Resources.Message_NewPackageIsAvailable + productTitle), Resources.Refresh_NewPackage)));
- }
- private void OnPurchasesChanged(object sender, NotifyCollectionChangedEventArgs e)
- {
- if (e.Action != NotifyCollectionChangedAction.Add && e.Action != NotifyCollectionChangedAction.Replace)
- return;
- lock (ServicesControlVM._lockObject)
- {
- Action local_0 = Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_IsRefreshing, 5, true);
- try
- {
- if (e.NewItems.Count > 0)
- {
- foreach (Purchase item_0 in (IEnumerable) e.NewItems)
- {
- Purchase purchase = item_0;
- ServiceVM local_1 = Enumerable.Single<ServiceVM>((IEnumerable<ServiceVM>) this.Services, (Func<ServiceVM, bool>) (x => x.ProductId == purchase.ProductId));
- local_1.Update(purchase);
- if (purchase.PackageStatus == 1)
- this.ShowUpdateMessage(local_1.Title);
- }
- }
- else
- local_0 = Map.Get<IScreenManager>().ShowStatusMessage(Resources.StatusMessage_NoNewPurchases, 5, false);
- }
- catch (ApiException exception_0)
- {
- Logger.WriteError((object) this, "OnPurchasesChanged()", "Error: ", (Exception) exception_0);
- }
- local_0();
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.SessionHistoryVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using KairosPlanet.Managers;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Windows.Input;
- using WinApp.Api.Data;
- using WinApp.Data.Helpers;
- using WinApp.ViewModel;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- public class SessionHistoryVM : ViewModelBase
- {
- private DateTime _periodStart;
- private DateTime _periodEnd;
- private string _periodTotalString;
- private ObservableCollection<SessionRecordVM> _items;
- private ObservableCollection<SessionChartItemVM> _chartItems;
- public DateTime PeriodStart
- {
- get
- {
- return this._periodStart;
- }
- set
- {
- this._periodStart = value;
- this.OnPropertyChanged("PeriodStart");
- }
- }
- public DateTime PeriodEnd
- {
- get
- {
- return this._periodEnd;
- }
- set
- {
- this._periodEnd = value.AddDays(1.0).AddSeconds(-1.0);
- this.OnPropertyChanged("PeriodEnd");
- }
- }
- public string PeriodTotalString
- {
- get
- {
- return this._periodTotalString;
- }
- private set
- {
- this._periodTotalString = value;
- this.OnPropertyChanged("PeriodTotalString");
- }
- }
- public ObservableCollection<SessionRecordVM> Items
- {
- get
- {
- return this._items;
- }
- private set
- {
- this._items = value;
- this.OnPropertyChanged("Items");
- }
- }
- public ObservableCollection<SessionChartItemVM> ChartItems
- {
- get
- {
- return this._chartItems;
- }
- private set
- {
- this._chartItems = value;
- this.OnPropertyChanged("Items");
- }
- }
- public ICommand ShowPeriodCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.ShowPeriodCommand), new Action(this.ExecuteShowPeriodCommand));
- }
- }
- public SessionHistoryVM()
- {
- this.PeriodStart = DateTime.Now.Date.AddDays(-7.0);
- this.PeriodEnd = DateTime.Now.Date;
- this.ExecuteShowPeriodCommand();
- }
- private void ExecuteShowPeriodCommand()
- {
- Logger.WriteInfo(typeof (SessionHistoryVM), "ExecuteShowPeriodCommand()", "??????? ???????? ?????? ?? ????????? ??????");
- Statistic[] statisticArray = Enumerable.ToArray<Statistic>(Enumerable.Where<Statistic>((IEnumerable<Statistic>) (StatisticManager.Instance.GetStatistics() ?? new Statistic[0]), (Func<Statistic, bool>) (x => x.Lifetime != 0L)));
- this.Items = new ObservableCollection<SessionRecordVM>(Enumerable.Where<SessionRecordVM>(Enumerable.Select<Statistic, SessionRecordVM>((IEnumerable<Statistic>) Enumerable.OrderByDescending<Statistic, DateTime>((IEnumerable<Statistic>) statisticArray, (Func<Statistic, DateTime>) (r => r.CreatedDate)), (Func<Statistic, SessionRecordVM>) (x => new SessionRecordVM(x))), (Func<SessionRecordVM, bool>) (y =>
- {
- DateTime? endTime = y.EndTime;
- DateTime periodEnd = this.PeriodEnd;
- if ((endTime.HasValue ? (endTime.GetValueOrDefault() < periodEnd ? 1 : 0) : 0) != 0)
- return y.StartTime > this.PeriodStart;
- return false;
- })));
- this.ChartItems = new ObservableCollection<SessionChartItemVM>(Enumerable.Select<IGrouping<DateTime, Statistic>, SessionChartItemVM>(Enumerable.GroupBy<Statistic, DateTime>((IEnumerable<Statistic>) statisticArray, (Func<Statistic, DateTime>) (x => x.CreatedDate.Date)), (Func<IGrouping<DateTime, Statistic>, SessionChartItemVM>) (x => new SessionChartItemVM(x.Key, Enumerable.Sum<Statistic>((IEnumerable<Statistic>) x, (Func<Statistic, double>) (y => (double) y.Lifetime / 60.0))))));
- Logger.WriteInfo(typeof (SessionHistoryVM), "ExecuteShowPeriodCommand()", "????????? ?????? ??????? ?? ??????...");
- string str = TimeSpanExtention.TotalTimeString(TimeSpan.FromMinutes(Enumerable.Sum<SessionChartItemVM>((IEnumerable<SessionChartItemVM>) this.ChartItems, (Func<SessionChartItemVM, double>) (x => x.Duration))), "{0:00}:{1:00}:{2:00}");
- Logger.WriteInfo(typeof (SessionHistoryVM), "ExecuteShowPeriodCommand()", "??????? ???????? ????? ????? ?? ????????? ??????");
- this.PeriodTotalString = string.Format("{0} {1}", (object) Resources.SessionHistoryUC_Total, (object) str);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.SettingsVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Windows;
- using System.Windows.Input;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Localization;
- using WinApp.Managers.Network;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel.Controls
- {
- internal class SettingsVM : ViewModelBase
- {
- private bool _isRunAtStartup = Map.Get<IApplicationSettings>().RunAtStartup;
- private bool _isAutoLogin = Map.Get<IApplicationSettings>().IsAutoLogin;
- private bool _isHttpUsed = Map.Get<IApplicationSettings>().IsHttpUsed;
- private Visibility _languageSelectedVisibility = Visibility.Hidden;
- private Visibility _visibleHttpWarning = Visibility.Hidden;
- private LocalizationObject _selectedLanguage;
- private bool _isCheckHttpPing;
- public bool IsRunAtStartup
- {
- get
- {
- return this._isRunAtStartup;
- }
- set
- {
- this._isRunAtStartup = value;
- Map.Get<IApplicationSettings>().SetRunAtStartup(this._isRunAtStartup);
- this.OnPropertyChanged("IsRunAtStartup");
- }
- }
- public bool IsAutoLogin
- {
- get
- {
- return this._isAutoLogin;
- }
- set
- {
- this._isAutoLogin = value;
- Map.Get<IApplicationSettings>().SetIsAutoLogin(this._isAutoLogin);
- this.OnPropertyChanged("IsAutoLogin");
- }
- }
- public bool IsCheckHttpPing
- {
- get
- {
- this._isCheckHttpPing = Map.Get<IApplicationSettings>().IsHttpUsed;
- return this._isCheckHttpPing;
- }
- set
- {
- this._isCheckHttpPing = value;
- NetworkMonitor.SetPingThrough(this._isCheckHttpPing);
- Map.Get<IApplicationSettings>().SetHttpPingUsed(this._isCheckHttpPing);
- this.OnPropertyChanged("IsCheckHttpPing");
- this.OnPropertyChanged("IsCheckIcmpPing");
- this.OnPropertyChanged("VisibleHttpWarning");
- }
- }
- public bool IsCheckIcmpPing
- {
- get
- {
- return !this.IsCheckHttpPing;
- }
- set
- {
- this.IsCheckHttpPing = false;
- }
- }
- public Visibility VisibleHttpWarning
- {
- get
- {
- return !this.IsCheckHttpPing ? Visibility.Hidden : Visibility.Visible;
- }
- set
- {
- this.OnPropertyChanged("VisibleHttpWarning");
- }
- }
- public bool IsAutoLoginEnabled
- {
- get
- {
- return Map.Get<IApplicationSettings>().IsRemeberMe;
- }
- }
- public ObservableCollection<LocalizationObject> LanguagesCollection
- {
- get
- {
- return Map.Get<ILocalizationManager>().LanguagesCollection;
- }
- }
- public LocalizationObject SelectedLanguage
- {
- get
- {
- return this._selectedLanguage;
- }
- set
- {
- this._selectedLanguage = value;
- if (this._selectedLanguage == null)
- return;
- Map.Get<IApplicationSettings>().SetLocalization(this._selectedLanguage);
- this.LanguageSelectedVisibility = Visibility.Visible;
- this.OnPropertyChanged("SelectedLanguage");
- }
- }
- public Visibility LanguageSelectedVisibility
- {
- get
- {
- return this._languageSelectedVisibility;
- }
- set
- {
- this._languageSelectedVisibility = value;
- this.OnPropertyChanged("LanguageSelectedVisibility");
- }
- }
- public ICommand RestartCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.RestartCommand), new Action(this.Restart));
- }
- }
- internal SettingsVM()
- {
- this.IsRunAtStartup = Map.Get<IApplicationSettings>().RunAtStartup;
- this._selectedLanguage = Map.Get<IApplicationSettings>().GetLocalizationObject();
- }
- private void Restart()
- {
- Logger.WriteInfo(typeof (SettingsVM), "Restart()", "???????????? ??????????...");
- Process.Start(Application.ResourceAssembly.Location);
- Application.Current.Shutdown();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.Controls.CaptionListVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Linq.Expressions;
- using System.Windows.Input;
- using WinApp.Managers.Interfaces;
- using WinApp.ViewModel.Base;
- using WinApp.ViewModel.MainMenu;
- namespace WinApp.ViewModel.Controls
- {
- internal class CaptionListVM : ViewModelBase
- {
- public CaptionMenuItem MenuItem { get; set; }
- public ICommand OpenCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((Expression<Func<ICommand>>) (() => this.OpenCommand), new Action<object>(this.OpenTab));
- }
- }
- public CaptionListVM(CaptionMenuItem menuItem)
- {
- this.MenuItem = menuItem;
- }
- private void OpenTab(object obj)
- {
- MainMenuItem menuItem = obj as MainMenuItem;
- if (menuItem == null)
- return;
- Logger.WriteInfo(typeof (CaptionListVM), "OpenTab()", string.Format("??????????? ??????? ?? ???????? '{0}'...", (object) menuItem.Name));
- Map.Get<IScreenManager>().MainView.ViewModel.SwithToMenuItem(menuItem);
- Logger.WriteInfo(typeof (CaptionListVM), "OpenTab()", string.Format("??????? ?? ???????? '{0}' ???????? ???????", (object) menuItem.Name));
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.MainViewVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet;
- using KairosPlanet.Properties;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Documents;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using WinApp.Managers.Interfaces;
- using WinApp.View;
- using WinApp.ViewModel.Base;
- using WinApp.ViewModel.MainMenu;
- namespace WinApp.ViewModel
- {
- internal class MainViewVM : ViewModelBase
- {
- private readonly Stack<Control> _controlsHistory = new Stack<Control>();
- private readonly MainMenuCollection _menu = new MainMenuCollection();
- private Visibility _visiblityErrorBlock = Visibility.Collapsed;
- private Visibility _visibilityStatusBlock = Visibility.Collapsed;
- private Visibility _isStatusInProgress = Visibility.Collapsed;
- private FlowDocument _errorDocument = new FlowDocument();
- private MainMenuItem _selectedMenuItem;
- private Control _content;
- private string _messageErrorBlock;
- private string _statusMessage;
- private MainViewUC _mainView;
- public MainMenuCollection MenuItems
- {
- get
- {
- return this._menu;
- }
- }
- public MainMenuItem SelectedMenuItem
- {
- get
- {
- return this._selectedMenuItem;
- }
- set
- {
- this._selectedMenuItem = value;
- if (!object.Equals((object) this.Content, (object) this._selectedMenuItem.Control))
- this.SwithToMenuItem(this._selectedMenuItem);
- this.OnPropertyChanged("SelectedMenuItem");
- }
- }
- public Control Content
- {
- get
- {
- return this._content;
- }
- set
- {
- this._content = value;
- this.OnPropertyChanged("Content");
- }
- }
- public Visibility VisiblityErrorBlock
- {
- get
- {
- return this._visiblityErrorBlock;
- }
- set
- {
- this._visiblityErrorBlock = value;
- this.OnPropertyChanged("VisiblityErrorBlock");
- }
- }
- public FlowDocument ErrorDocument
- {
- get
- {
- return this._errorDocument;
- }
- set
- {
- this._errorDocument = value;
- this.OnPropertyChanged("ErrorDocument");
- }
- }
- public string MessageErrorBlock
- {
- get
- {
- return this._messageErrorBlock;
- }
- set
- {
- this._messageErrorBlock = value;
- this.OnPropertyChanged("MessageErrorBlock");
- }
- }
- public string StatusMessage
- {
- get
- {
- return this._statusMessage;
- }
- set
- {
- this._statusMessage = value;
- this.VisibilityStatusBlock = !string.IsNullOrEmpty(this.StatusMessage) || this._isStatusInProgress == Visibility.Visible ? Visibility.Visible : Visibility.Collapsed;
- this.OnPropertyChanged("StatusMessage");
- }
- }
- public Visibility VisibilityStatusBlock
- {
- get
- {
- return this._visibilityStatusBlock;
- }
- set
- {
- this._visibilityStatusBlock = value;
- this.OnPropertyChanged("VisibilityStatusBlock");
- }
- }
- public Visibility IsStatusInProgress
- {
- get
- {
- return this._isStatusInProgress;
- }
- set
- {
- this._isStatusInProgress = value;
- this.VisibilityStatusBlock = !string.IsNullOrEmpty(this.StatusMessage) || this._isStatusInProgress == Visibility.Visible ? Visibility.Visible : Visibility.Collapsed;
- this.OnPropertyChanged("IsStatusInProgress");
- }
- }
- public MainViewVM(MainViewUC mainViewUc)
- {
- this._mainView = mainViewUc;
- this._menu.Services.IsSelected = true;
- AppVM.Instance.ErrorStateChanged += new EventHandler(this.OnErrorStateChanged);
- this.ErorStateRefresh();
- }
- ~MainViewVM()
- {
- AppVM.Instance.ErrorStateChanged -= new EventHandler(this.OnErrorStateChanged);
- }
- public void SwithToMenuItem(MainMenuItem menuItem)
- {
- Logger.WriteInfo(typeof (MainViewVM), "SwithToMenuItem()", string.Format("??????? ?? ???????? '{0}'", (object) menuItem.Name));
- this._controlsHistory.Clear();
- this.SwithTo(menuItem.Control, true);
- MainMenuItem mainMenuItem1;
- if (menuItem is CaptionMenuItem)
- {
- menuItem.IsExpanded = true;
- mainMenuItem1 = menuItem;
- }
- else
- mainMenuItem1 = menuItem.Parent;
- foreach (MainMenuItem mainMenuItem2 in Enumerable.Except<MainMenuItem>((IEnumerable<MainMenuItem>) this.MenuItems, (IEnumerable<MainMenuItem>) new MainMenuItem[1]
- {
- mainMenuItem1
- }))
- mainMenuItem2.IsExpanded = false;
- if (menuItem.IsSelected)
- return;
- menuItem.IsSelected = true;
- }
- public void SwitchBack()
- {
- if (!this.CanSwitchBack())
- return;
- this._controlsHistory.Pop();
- this.Content = this._controlsHistory.Peek();
- }
- public bool CanSwitchBack()
- {
- return this._controlsHistory.Count > 1;
- }
- private void OnErrorStateChanged(object sender, EventArgs eventArgs)
- {
- this.ErorStateRefresh();
- }
- private void ErorStateRefresh()
- {
- switch (AppVM.Instance.ModuleErrorState)
- {
- case ModuleErrorState.NoError:
- this._visiblityErrorBlock = Visibility.Collapsed;
- this._messageErrorBlock = string.Empty;
- break;
- case ModuleErrorState.CrashOrNotFoundMainFile:
- this.ShowError(Resources.Tray_ModuleCrashOrNotFoundMainFiledMessage);
- break;
- case ModuleErrorState.ModuleNotInstalledMessage:
- this.ShowError(Resources.Tray_ModuleNotInstalledMessage);
- break;
- }
- this.OnPropertyChanged("VisiblityErrorBlock");
- this.OnPropertyChanged("MessageErrorBlock");
- this.OnPropertyChanged("ErrorDocument");
- }
- private void SwithTo(Control control, bool pushToHistory = true)
- {
- this.Content = control;
- if (!pushToHistory)
- return;
- this._controlsHistory.Push(control);
- }
- private void ShowError(string message)
- {
- this._messageErrorBlock = message;
- this._visiblityErrorBlock = Visibility.Visible;
- Map.Get<IScreenManager>().DoVisualSafe((Action) (() => this.ErrorDocument = this.CreateFlowDocument(message)));
- }
- private FlowDocument CreateFlowDocument(string message)
- {
- FlowDocument flowDocument = new FlowDocument()
- {
- PagePadding = new Thickness(0.0)
- };
- Paragraph paragraph = new Paragraph();
- BitmapImage bitmapImage = new BitmapImage();
- bitmapImage.BeginInit();
- bitmapImage.UriSource = new Uri("pack://application:,,,/KairosPlanet;component/Assets/Images/Offline.ico", UriKind.Absolute);
- bitmapImage.EndInit();
- Image image = new Image();
- image.Source = (ImageSource) bitmapImage;
- image.Height = 40.0;
- image.Width = 40.0;
- BlockUIContainer blockUiContainer = new BlockUIContainer((UIElement) image);
- blockUiContainer.Margin = new Thickness(0.0);
- Figure figure1 = new Figure((Block) blockUiContainer);
- figure1.HorizontalAnchor = FigureHorizontalAnchor.PageLeft;
- figure1.Width = new FigureLength(40.0);
- figure1.Margin = new Thickness(0.0, 0.0, 10.0, 0.0);
- figure1.Padding = new Thickness(0.0);
- Figure figure2 = figure1;
- paragraph.Inlines.Add((Inline) figure2);
- paragraph.Margin = new Thickness(0.0);
- paragraph.Padding = new Thickness(0.0);
- paragraph.LineHeight = 0.6;
- paragraph.TextAlignment = TextAlignment.Justify;
- paragraph.Foreground = (Brush) new SolidColorBrush(Color.FromRgb((byte) 102, (byte) 102, (byte) 102));
- paragraph.FontFamily = (FontFamily) this._mainView.FindResource((object) "OpenSans");
- paragraph.Inlines.Add(message);
- flowDocument.Blocks.Add((Block) paragraph);
- return flowDocument;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.LoginBaseVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet.Properties;
- using System;
- using System.Windows;
- using System.Windows.Input;
- using WinApp.Data.Helpers;
- using WinApp.Managers.Interfaces;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel
- {
- internal abstract class LoginBaseVM : ViewModelBase
- {
- private Visibility _screenVisibility = Visibility.Hidden;
- private Visibility _emailErrorVisibility = Visibility.Hidden;
- private Visibility _passwordErrorVisibility = Visibility.Hidden;
- private bool _emailEditable = true;
- private string _email;
- private string _password;
- private string _emailError;
- private string _passwordError;
- public string Password
- {
- get
- {
- return this._password;
- }
- set
- {
- this._password = value;
- this.OnPropertyChanged("Password");
- }
- }
- public string Email
- {
- get
- {
- return this._email;
- }
- set
- {
- this._email = value;
- this.OnPropertyChanged("Email");
- }
- }
- public Visibility ScreenVisibility
- {
- get
- {
- return this._screenVisibility;
- }
- set
- {
- this._screenVisibility = value;
- this.OnPropertyChanged("ScreenVisibility");
- }
- }
- public Visibility EmailErrorVisibility
- {
- get
- {
- return this._emailErrorVisibility;
- }
- set
- {
- this._emailErrorVisibility = value;
- this.OnPropertyChanged("EmailErrorVisibility");
- }
- }
- public Visibility PasswordErrorVisibility
- {
- get
- {
- return this._passwordErrorVisibility;
- }
- set
- {
- this._passwordErrorVisibility = value;
- this.OnPropertyChanged("PasswordErrorVisibility");
- }
- }
- public string EmailError
- {
- get
- {
- return this._emailError;
- }
- set
- {
- this._emailError = value;
- this.OnPropertyChanged("EmailError");
- }
- }
- public string PasswordError
- {
- get
- {
- return this._passwordError;
- }
- set
- {
- this._passwordError = value;
- this.OnPropertyChanged("PasswordError");
- }
- }
- public bool EmailEditable
- {
- get
- {
- return this._emailEditable;
- }
- set
- {
- this._emailEditable = value;
- this.OnPropertyChanged("EmailEditable");
- }
- }
- public ICommand DoLogin
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.DoLogin), (Action) (() => this.ExecuteLogin(false)));
- }
- }
- protected LoginBaseVM(string email, string password)
- {
- this.Email = email;
- this.Password = password;
- }
- protected LoginBaseVM()
- {
- }
- protected void ExecuteLogin(bool autoLogin = false)
- {
- Logger.WriteInfo(typeof (LoginBaseVM), "ExecuteLogin()", "??????? ????? ? ??????? ?????????????...");
- if (!autoLogin)
- {
- if (this.HasAnyError())
- {
- Logger.WriteWarning(typeof (LoginBaseVM), "ExecuteLogin()", "?????? ??? ?????????? ?????? ??? ????? ? ???????");
- return;
- }
- }
- try
- {
- switch (this.RequestLogin(this.Email, this.Password).Result)
- {
- case LoginResult.NoResponce:
- this.HideAllErrors();
- Logger.WriteWarning(typeof (LoginBaseVM), "ExecuteLogin()", "?????? ??? ????? ???????????? ? ???????. ?? ??????? ??????????? ? ???????????? ???????");
- this.ShowConnectionError();
- break;
- case LoginResult.WrongInput:
- this.EmailErrorVisibility = Visibility.Visible;
- this.PasswordErrorVisibility = Visibility.Visible;
- this.EmailError = Resources.Error_PasswordOrEmailInvalid;
- Logger.WriteWarning(typeof (LoginBaseVM), "ExecuteLogin()", "?????? ??? ????? ???????????? ? ???????. ???????? ???? ??????");
- break;
- case LoginResult.UserDeleted:
- Logger.WriteWarning(typeof (LoginBaseVM), "ExecuteLogin()", "?????? ??? ????? ???????????? ? ???????. ??????? ??????");
- this.ShowUserDeletedError();
- break;
- case LoginResult.Pass:
- this.PassAction(autoLogin);
- Logger.WriteInfo(typeof (LoginBaseVM), "ExecuteLogin()", "???? ??????? ????????");
- break;
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "ExecuteLogin()", "?????? ??? ???????? ?????? ? ???????: " + ex.Message);
- }
- }
- protected abstract void PassAction(bool isAutoLogin);
- protected abstract LoginResponce RequestLogin(string email, string password);
- private bool HasAnyError()
- {
- this.HideAllErrors();
- bool flag = false;
- if (StringUtil.IsNullOrWhiteSpace(this.Email))
- {
- this.ShowEmailEmptyError();
- flag = true;
- }
- if (StringUtil.IsNullOrWhiteSpace(this.Password))
- {
- this.ShowPasswordEmptyError();
- flag = true;
- }
- return flag;
- }
- private void HideAllErrors()
- {
- this.EmailError = string.Empty;
- this.PasswordError = string.Empty;
- this.EmailErrorVisibility = Visibility.Hidden;
- this.PasswordErrorVisibility = Visibility.Hidden;
- }
- private void ShowPasswordEmptyError()
- {
- this.PasswordErrorVisibility = Visibility.Visible;
- this.PasswordError = Resources.Error_PasswordIsEmpty;
- }
- private void ShowEmailEmptyError()
- {
- this.EmailErrorVisibility = Visibility.Visible;
- this.EmailError = Resources.Error_EmailIsEmpty;
- }
- private void ShowUserDeletedError()
- {
- Map.Get<IScreenManager>().ShowAlert(Resources.Error_UserDeletedError, Resources.Error);
- }
- private void ShowConnectionError()
- {
- Map.Get<IScreenManager>().ShowAlert(Resources.Error_ConnectionError, Resources.Error);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.AppVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using KairosPlanet;
- using KairosPlanet.Managers.Network;
- using System;
- using System.Configuration;
- using System.Reflection;
- using System.Windows;
- using Telerik.Windows.Controls;
- using WinApp;
- using WinApp.Managers.Interfaces;
- using WinApp.Managers.Localization;
- using WinApp.Managers.Network;
- using WinApp.Service.Core;
- using WinApp.View.Helpers;
- namespace WinApp.ViewModel
- {
- internal class AppVM
- {
- private static readonly object _createLock = new object();
- private static AppVM _instance;
- private NetworkState _networkState;
- private ModuleErrorState _moduleErrorState;
- private long? _activePackageId;
- private double _activePackagePrice;
- private bool _isLoadedPackageId;
- private bool _isHttpUsed;
- public static AppVM Instance
- {
- get
- {
- if (AppVM._instance == null)
- AppVM.InitializeAppVM();
- return AppVM._instance;
- }
- }
- public NetworkState NetworkState
- {
- get
- {
- return this._networkState;
- }
- set
- {
- if (this._networkState == value)
- return;
- this._networkState = value;
- try
- {
- Map.Get<IAppTray>().Refresh();
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- }
- public ModuleErrorState ModuleErrorState
- {
- get
- {
- return this._moduleErrorState;
- }
- set
- {
- if (this._moduleErrorState == value)
- return;
- Logger.WriteWarning((object) this, "ModuleErrorState", "ModuleErrorState changed from '" + (object) this._moduleErrorState + "' on '" + (string) (object) value + "'");
- this._moduleErrorState = value;
- if (this.ErrorStateChanged == null)
- return;
- this.ErrorStateChanged((object) this, new EventArgs());
- }
- }
- public LoginState LoginState { get; private set; }
- public long? ActivePackageId
- {
- get
- {
- if (!this._isLoadedPackageId)
- {
- this._activePackageId = new long?(Map.Get<IApplicationSettings>().ActiveProductId);
- this._isLoadedPackageId = true;
- }
- return this._activePackageId;
- }
- set
- {
- this._activePackageId = value;
- }
- }
- public bool IsHttpUsed
- {
- get
- {
- this._isHttpUsed = Map.Get<IApplicationSettings>().IsHttpUsed;
- return this._isHttpUsed;
- }
- set
- {
- this._isHttpUsed = value;
- }
- }
- public double ActivePackagePrice
- {
- get
- {
- return this._activePackagePrice;
- }
- set
- {
- this._activePackagePrice = value;
- }
- }
- internal event EventHandler ErrorStateChanged;
- private AppVM()
- {
- }
- public static void Initialize()
- {
- try
- {
- Logger.WriteInfo(typeof (AppVM), "Initialize()", "????????????? ??????????...");
- AppVM.InitializeAppVM();
- AppDomain.CurrentDomain.AppendPrivatePath("Modules\\Rent module");
- Logger.WriteInfo((object) typeof (AppVM), "Initialize()", "???????? ????????????? ??????????", "??????? ?????? ?????????? - " + AppVM.Instance.GetCurrentAppVersion().ToString());
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (AppVM), "Initialize()", "?????? ??? ????????????? ??????????", ex);
- }
- }
- public void OnStartUp()
- {
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "????? ??????????. ????????????? ???????????...");
- Bootstrapper.Bootstrap();
- TelerikThemeManager.ApplyTheme();
- Map.Get<ILocalizationManager>().ApplyLocalization();
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "ApplyLocalization executed");
- NetworkMonitor.NetworkStateChanged += new EventHandler<NetworkStateEventArgs>(this.OnNetworkStateChanged);
- NetworkMonitor.StartNetworkMonitoring();
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "NetworkMonitor started");
- try
- {
- Map.Get<IMainWindow>().Show();
- IMainWindow mainWindow = Map.Get<IMainWindow>();
- mainWindow.Show();
- ((UIElement) (mainWindow as RadWindow)).Focus();
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "MainWindow Show executed");
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "MainWindow Show executed");
- }
- catch (Exception ex)
- {
- throw;
- }
- DatabaseInitializer.Initialize();
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "DatabaseInitializer initialized");
- Map.Get<IScreenManager>().SwitchToLogin();
- Logger.WriteInfo(typeof (AppVM), "OnStartUp()", "?????????? ????????. ?????????? ????????????????");
- }
- public void LogIn()
- {
- Logger.WriteInfo(typeof (AppVM), "LogOut()", "???? ????????????...");
- this.LoginState = LoginState.Done;
- if (this.IsNewAppVersionAvailable())
- return;
- this.ShowMainWindow();
- }
- public void ShowMainWindow()
- {
- Map.Get<IScreenManager>().SwitchToMain();
- Map.Get<IAppTray>().Refresh();
- }
- public void ProcedeLogOut()
- {
- Logger.WriteInfo(typeof (AppVM), "LogOut()", "????? ???????? ????????????...");
- this.LoginState = LoginState.NoLogin;
- Map.Get<ISessionManager>().CloseSession();
- Map.Get<IScreenManager>().SwitchToLogin();
- Map.Get<IAppTray>().Refresh();
- }
- internal void SetActivePackage(long productId)
- {
- this._activePackageId = new long?(productId);
- IApplicationSettings applicationSettings = Map.Get<IApplicationSettings>();
- applicationSettings.ActiveProductId = productId;
- applicationSettings.Save();
- SessionMonitor.Instance.SetSessionStateToLogon();
- }
- internal Version GetCurrentAppVersion()
- {
- return Assembly.GetAssembly(this.GetType()).GetName().Version;
- }
- private static void InitializeAppVM()
- {
- lock (AppVM._createLock)
- {
- if (AppVM._instance != null)
- return;
- AppVM._instance = new AppVM();
- }
- }
- private void OnNetworkStateChanged(object sender, NetworkStateEventArgs e)
- {
- Application.Current.Dispatcher.Invoke((Delegate) (() => AppVM.Instance.NetworkState = e.State));
- }
- private bool IsNewAppVersionAvailable()
- {
- try
- {
- string appVersion = Map.Get<ISessionManager>().GetAppVersion();
- if (string.IsNullOrEmpty(appVersion))
- {
- Logger.WriteError((object) this, "IsNewAppVersionAvailable()", "Empty app version from site");
- return false;
- }
- Version appVersionOnSite = new Version(appVersion);
- Version currentAppVersion = this.GetCurrentAppVersion();
- bool isShowVersionPage = this.GetIsShowVersionPage();
- if (!(currentAppVersion != appVersionOnSite))
- {
- if (!isShowVersionPage)
- goto label_6;
- }
- Map.Get<IScreenManager>().SwitchToNewVersionAvailableWindow(appVersionOnSite, currentAppVersion);
- return true;
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "CheckAppVersion()", "Error: ", ex);
- }
- label_6:
- return false;
- }
- private bool GetIsShowVersionPage()
- {
- string str = ConfigurationManager.AppSettings["ShowVersionPage"];
- bool result;
- if (string.IsNullOrEmpty(str) || !bool.TryParse(str, out result))
- return false;
- return result;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.MainMenu.MainMenuItem
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Windows.Controls;
- using Telerik.Windows.Controls;
- namespace WinApp.ViewModel.MainMenu
- {
- public class MainMenuItem : ViewModelBase
- {
- private Control _control;
- private Func<Control> _createControl;
- private string _name;
- private bool _isSelected;
- private bool _isExpanded;
- public string Name
- {
- get
- {
- return this._name;
- }
- private set
- {
- this._name = value;
- this.OnPropertyChanged("Name");
- }
- }
- public Control Control
- {
- get
- {
- return this._control ?? (this._control = this._createControl());
- }
- protected set
- {
- this._control = value;
- this.OnPropertyChanged("Control");
- }
- }
- public bool IsSelected
- {
- get
- {
- return this._isSelected;
- }
- set
- {
- this._isSelected = value;
- this.OnPropertyChanged("IsSelected");
- }
- }
- public bool IsExpanded
- {
- get
- {
- return this._isExpanded;
- }
- set
- {
- this._isExpanded = value;
- this.OnPropertyChanged("IsExpanded");
- }
- }
- public MainMenuItem Parent { get; set; }
- public MainMenuItem(string name, Func<Control> createControl)
- {
- this.\u002Ector();
- this._name = name;
- this._createControl = createControl;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.MainMenu.CaptionMenuItem
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Windows.Controls;
- namespace WinApp.ViewModel.MainMenu
- {
- internal class CaptionMenuItem : MainMenuItem, IEnumerable<MainMenuItem>, IEnumerable
- {
- private readonly List<MainMenuItem> _children = new List<MainMenuItem>();
- private string _icon;
- public string Icon
- {
- get
- {
- return this._icon;
- }
- private set
- {
- this._icon = value;
- this.OnPropertyChanged("Icon");
- }
- }
- public List<MainMenuItem> Children
- {
- get
- {
- return this._children;
- }
- }
- public CaptionMenuItem(string icon, string name, Func<Control> control)
- : base(name, control)
- {
- this._icon = icon;
- }
- public void Add(MainMenuItem item)
- {
- item.Parent = (MainMenuItem) this;
- this._children.Add(item);
- }
- public IEnumerator<MainMenuItem> GetEnumerator()
- {
- return (IEnumerator<MainMenuItem>) this._children.GetEnumerator();
- }
- IEnumerator IEnumerable.GetEnumerator()
- {
- return (IEnumerator) this.GetEnumerator();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.MainMenu.MainMenuCollection
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using KairosPlanet.Properties;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Windows.Controls;
- using WinApp.View;
- namespace WinApp.ViewModel.MainMenu
- {
- internal class MainMenuCollection : IEnumerable<MainMenuItem>, IEnumerable
- {
- private readonly CaptionMenuItem _services = new CaptionMenuItem("\xF108", Resources.MainMenu_Services, (Func<Control>) (() => (Control) new ServicesUC()));
- private readonly CaptionMenuItem _statistics = new CaptionMenuItem("\xF080", Resources.MainMenu_Statistics, (Func<Control>) (() => (Control) new SessionStatisticsUC()))
- {
- new MainMenuItem(Resources.MainMenu_SessionHistory, (Func<Control>) (() => (Control) new SessionHistoryUC()))
- };
- private readonly CaptionMenuItem _profile = new CaptionMenuItem("\xF007", Resources.MainMenu_Profile, (Func<Control>) (() => (Control) new PersonalInformationUC()))
- {
- new MainMenuItem(Resources.MainMenu_ProfileContact, (Func<Control>) (() => (Control) new ContactInformationUC()))
- };
- private readonly CaptionMenuItem _settings = new CaptionMenuItem("\xF013", Resources.MainMenu_Settings, (Func<Control>) (() => (Control) new SettingsUC()));
- private readonly IEnumerable<MainMenuItem> _items;
- public CaptionMenuItem Services
- {
- get
- {
- return this._services;
- }
- }
- public CaptionMenuItem Statistics
- {
- get
- {
- return this._statistics;
- }
- }
- public CaptionMenuItem Profile
- {
- get
- {
- return this._profile;
- }
- }
- public CaptionMenuItem Settings
- {
- get
- {
- return this._settings;
- }
- }
- public MainMenuCollection()
- {
- this._items = (IEnumerable<MainMenuItem>) new MainMenuItem[4]
- {
- (MainMenuItem) this.Services,
- (MainMenuItem) this.Statistics,
- (MainMenuItem) this.Profile,
- (MainMenuItem) this.Settings
- };
- }
- public IEnumerator<MainMenuItem> GetEnumerator()
- {
- return this._items.GetEnumerator();
- }
- IEnumerator IEnumerable.GetEnumerator()
- {
- return (IEnumerator) this.GetEnumerator();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.SessionRecordVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using WinApp.Api.Data;
- namespace WinApp.ViewModel
- {
- public class SessionRecordVM
- {
- private readonly Statistic _model;
- public DateTime StartTime
- {
- get
- {
- return this._model.CreatedDate;
- }
- }
- public DateTime? EndTime
- {
- get
- {
- return new DateTime?(this._model.CreatedDate + this.Lifetime);
- }
- }
- public TimeSpan Lifetime
- {
- get
- {
- return TimeSpan.FromSeconds((double) this._model.Lifetime);
- }
- }
- public bool Actual
- {
- get
- {
- return this._model.Actual;
- }
- }
- public string DateString
- {
- get
- {
- return this.StartTime.ToShortDateString();
- }
- }
- public string StartTimeString
- {
- get
- {
- return this.StartTime.ToShortDateString() + " " + this.StartTime.ToShortTimeString();
- }
- }
- public string EndTimeString
- {
- get
- {
- if (this.EndTime.HasValue)
- return this.EndTime.Value.ToShortDateString() + " " + this.EndTime.Value.ToShortTimeString();
- return string.Empty;
- }
- }
- public string DurationString
- {
- get
- {
- return string.Format("{0:HH:mm:ss}", (object) (DateTime.Today + this.Lifetime));
- }
- }
- public SessionRecordVM(Statistic model)
- {
- this._model = model;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.ViewModel.MainWindowVM
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using Inc.Logging;
- using IncMap;
- using System;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Threading;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using System.Windows.Interop;
- using System.Windows.Media;
- using WinApp.Managers.Interfaces;
- using WinApp.View;
- using WinApp.ViewModel.Base;
- namespace WinApp.ViewModel
- {
- internal class MainWindowVM : ViewModelBase
- {
- private static int _messageCloseAppCode = 170;
- private string _header = "KairosPlanet";
- private UserControl _content;
- private MainWindow _mainWindow;
- private HwndSource _source;
- public string Header
- {
- get
- {
- return this._header;
- }
- set
- {
- this._header = value;
- this.OnPropertyChanged("Header");
- }
- }
- public UserControl Content
- {
- get
- {
- return this._content;
- }
- set
- {
- this._content = value;
- this.OnPropertyChanged("Content");
- }
- }
- public ICommand LogOutCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.LogOutCommand), new Action(this.LogOut));
- }
- }
- public ICommand ExitCommand
- {
- get
- {
- return this.Commands.GetOrCreateCommand<ICommand>((System.Linq.Expressions.Expression<Func<ICommand>>) (() => this.ExitCommand), new Action(this.Exit));
- }
- }
- public MainWindowVM(MainWindow mainWindow)
- {
- this._mainWindow = mainWindow;
- this._header = "KairosPlanet. " + (object) AppVM.Instance.GetCurrentAppVersion();
- }
- public void Exit()
- {
- Logger.WriteInfo(typeof (MainWindowVM), "Exit()", "???????? ??????????...");
- Map.Get<IMainWindow>().CloseToTray = false;
- Map.Get<ISessionManager>().CloseSession();
- Application.Current.Shutdown();
- this.CloseProcess();
- }
- internal void MainWindowLoaded()
- {
- this._source = PresentationSource.FromVisual((Visual) this._mainWindow) as HwndSource;
- this._source.AddHook(new HwndSourceHook(this.WndProc));
- }
- [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
- private static extern uint RegisterWindowMessage(string lpString);
- private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
- {
- uint num = MainWindowVM.RegisterWindowMessage("KairosPlanetMessage");
- if ((long) msg == (long) num)
- {
- Marshal.PtrToStringAuto(wParam);
- if (wParam == new IntPtr(MainWindowVM._messageCloseAppCode))
- {
- this.Exit();
- return IntPtr.Zero;
- }
- Map.Get<IMainWindow>().Open();
- }
- return IntPtr.Zero;
- }
- private void CloseProcess()
- {
- new Thread(new ThreadStart(this.CloseProcessThread))
- {
- IsBackground = true
- }.Start();
- }
- private void CloseProcessThread()
- {
- Thread.Sleep(400);
- Process.GetCurrentProcess().Kill();
- }
- private void LogOut()
- {
- AppVM.Instance.ProcedeLogOut();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.NetworkState
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- namespace WinApp
- {
- internal enum NetworkState
- {
- None,
- NetworkNotFound,
- ServerNotFound,
- ServerOnline,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: XamlGeneratedNamespace.GeneratedInternalTypeHelper
- // Assembly: KairosPlanet, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 11FB976C-FCD4-4E7B-A3A4-41527B84CA9B
- // Assembly location: C:\Program Files (x86)\KairosPlanet\KairosPlanet.exe
- using System;
- using System.CodeDom.Compiler;
- using System.ComponentModel;
- using System.Diagnostics;
- using System.Globalization;
- using System.Reflection;
- using System.Windows.Markup;
- namespace XamlGeneratedNamespace
- {
- [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- [DebuggerNonUserCode]
- public sealed class GeneratedInternalTypeHelper : InternalTypeHelper
- {
- protected override object CreateInstance(Type type, CultureInfo culture)
- {
- return Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, (Binder) null, (object[]) null, culture);
- }
- protected override object GetPropertyValue(PropertyInfo propertyInfo, object target, CultureInfo culture)
- {
- return propertyInfo.GetValue(target, BindingFlags.Default, (Binder) null, (object[]) null, culture);
- }
- protected override void SetPropertyValue(PropertyInfo propertyInfo, object target, object value, CultureInfo culture)
- {
- propertyInfo.SetValue(target, value, BindingFlags.Default, (Binder) null, (object[]) null, culture);
- }
- protected override Delegate CreateDelegate(Type delegateType, object target, string handler)
- {
- return (Delegate) target.GetType().InvokeMember("_CreateDelegate", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod, (Binder) null, target, new object[2]
- {
- (object) delegateType,
- (object) handler
- }, (CultureInfo) null);
- }
- protected override void AddEventHandler(EventInfo eventInfo, object target, Delegate handler)
- {
- eventInfo.AddEventHandler(target, handler);
- }
- }
- }
- ?using System;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Windows;
- [assembly: Extension]
- [assembly: AssemblyTitle("KairosPlanet")]
- [assembly: AssemblyDescription("")]
- [assembly: AssemblyProduct("KairosPlanet")]
- [assembly: InternalsVisibleTo("KairosPlanet.Tests")]
- [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
- [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
- [assembly: AssemblyConfiguration("")]
- [assembly: AssemblyCompany("Kairos Technologies Ltd")]
- [assembly: AssemblyCopyright("Copyright © Kairos Technologies 2014")]
- [assembly: AssemblyTrademark("")]
- [assembly: ComVisible(false)]
- [assembly: CLSCompliant(false)]
- [assembly: AssemblyFileVersion("1.0.18.651")]
- [assembly: AssemblyInformationalVersion("1.0.18.651")]
- [assembly: AssemblyVersion("1.0.18.651")]
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.LoginResponce
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using WinApp.Data.Model;
- namespace WinApp.Data.Helpers
- {
- public struct LoginResponce
- {
- public static LoginResponce NoResponce = new LoginResponce(LoginResult.NoResponce, (Man) null);
- public static LoginResponce WrongInput = new LoginResponce(LoginResult.WrongInput, (Man) null);
- public static LoginResponce UserDeleted = new LoginResponce(LoginResult.UserDeleted, (Man) null);
- public Man UserInfo { get; private set; }
- public LoginResult Result { get; private set; }
- private LoginResponce(LoginResult result, Man userInfo = null)
- {
- this = new LoginResponce();
- this.Result = result;
- this.UserInfo = userInfo;
- }
- public static LoginResponce Pass(Man user)
- {
- return new LoginResponce(LoginResult.Pass, user);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.DateTimeExtention
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System;
- namespace WinApp.Data.Helpers
- {
- public static class DateTimeExtention
- {
- public static DateTime ToDateTime(this long ticks)
- {
- return new DateTime(ticks);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.LoginResult
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- namespace WinApp.Data.Helpers
- {
- public enum LoginResult
- {
- NoResponce,
- WrongInput,
- UserDeleted,
- Pass,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.StringUtil
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- namespace WinApp.Data.Helpers
- {
- public static class StringUtil
- {
- public static bool IsNullOrWhiteSpace(this string str)
- {
- return str == null || str.Trim().Length == 0;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.TimeSpanExtention
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System;
- namespace WinApp.Data.Helpers
- {
- public static class TimeSpanExtention
- {
- public static TimeSpan TrimToSeconds(this TimeSpan span)
- {
- return TimeSpan.FromSeconds((double) (span.Ticks / 10000000L));
- }
- public static TimeSpan ToTimeSpan(this long ticks)
- {
- return new TimeSpan(ticks);
- }
- public static string TotalTimeString(this TimeSpan timeSpan, string format)
- {
- long num1 = (long) timeSpan.TotalHours;
- long num2 = (long) timeSpan.TotalMinutes - num1 * 60L;
- long num3 = (long) timeSpan.TotalSeconds - num1 * 3600L - num2 * 60L;
- return string.Format(format, (object) num1, (object) num2, (object) num3);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Helpers.AppData
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System;
- using System.IO;
- namespace WinApp.Data.Helpers
- {
- public static class AppData
- {
- public static string Path
- {
- get
- {
- DirectoryInfo directoryInfo = new DirectoryInfo(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "WinApp"));
- if (!directoryInfo.Exists)
- {
- directoryInfo.Create();
- directoryInfo.Refresh();
- }
- return directoryInfo.FullName;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Security.Cryptography
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using Inc.Logging;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Security.Cryptography;
- using System.Text;
- namespace WinApp.Data.Security
- {
- public static class Cryptography
- {
- private static readonly byte[] _entropy = Encoding.Unicode.GetBytes("WinApp Cryptography Data Salt");
- public static byte[] GetSha1Hash(this string message)
- {
- return new SHA1CryptoServiceProvider().ComputeHash(Encoding.UTF8.GetBytes(message));
- }
- public static bool CheckHash(this byte[] h1, byte[] h2)
- {
- return Enumerable.SequenceEqual<byte>((IEnumerable<byte>) h1, (IEnumerable<byte>) h2);
- }
- public static string GetSha1HashText(this string message, int length)
- {
- return Convert.ToBase64String(Cryptography.GetSha1Hash(message)).Substring(0, length);
- }
- public static string ProtectedUserData(string data)
- {
- if (string.IsNullOrEmpty(data))
- return string.Empty;
- return Convert.ToBase64String(ProtectedData.Protect(Encoding.Unicode.GetBytes(data), Cryptography._entropy, DataProtectionScope.CurrentUser));
- }
- public static string UnprotectUserData(string protectedData)
- {
- try
- {
- if (string.IsNullOrEmpty(protectedData))
- return string.Empty;
- return Encoding.Unicode.GetString(ProtectedData.Unprotect(Convert.FromBase64String(protectedData), Cryptography._entropy, DataProtectionScope.CurrentUser));
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (Cryptography), "UnprotectUserData", "?? ??????? ????????????? ?????? ???????? ????????????", ex);
- return (string) null;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.Man
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System.Runtime.Serialization;
- namespace WinApp.Data.Model
- {
- [DataContract]
- public class Man
- {
- [DataMember(Name = "user_id")]
- public long Id { get; set; }
- [DataMember(Name = "user_name")]
- public string Name { get; set; }
- [DataMember(Name = "country")]
- public string Country { get; set; }
- [DataMember(Name = "email")]
- public string Email { get; set; }
- [DataMember(Name = "gender_id")]
- public int Gender { get; set; }
- [DataMember(Name = "birth_date")]
- public string BirthDate { get; set; }
- [DataMember(Name = "created_date")]
- public string CreatedDate { get; set; }
- [DataMember(Name = "phone_number_main")]
- public string PhoneNumber { get; set; }
- [DataMember(Name = "user_status_id")]
- public int UserStatus { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.ProductAttributes
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System.Runtime.Serialization;
- namespace WinApp.Data.Model
- {
- [DataContract]
- public class ProductAttributes
- {
- [DataMember(Name = "discSpace")]
- public int DiscSpace { get; set; }
- [DataMember(Name = "timeOnline")]
- public string TimeOnline { get; set; }
- [DataMember(Name = "basicIncome")]
- public string BasicIncome { get; set; }
- [DataMember(Name = "basicIncomePeriod")]
- public string BasicIncomePeriod { get; set; }
- [DataMember(Name = "profit")]
- public string Profit { get; set; }
- [DataMember(Name = "investmentPeriod")]
- public string InvestmentPeriod { get; set; }
- [DataMember(Name = "available")]
- public string Available { get; set; }
- [DataMember(Name = "start")]
- public string Start { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.SessionRecord
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using NPoco;
- using System;
- namespace WinApp.Data.Model
- {
- [TableName("SessionRecord")]
- public class SessionRecord : Entity
- {
- [Ignore]
- public DateTime StartTime { get; set; }
- public long StartInt
- {
- get
- {
- return this.StartTime.Ticks;
- }
- set
- {
- this.StartTime = new DateTime(value);
- }
- }
- [Ignore]
- public DateTime EndTime { get; set; }
- public long EndInt
- {
- get
- {
- return this.EndTime.Ticks;
- }
- set
- {
- this.EndTime = new DateTime(value);
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.ModuleState
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- namespace WinApp.Data.Model
- {
- public enum ModuleState
- {
- Buy,
- Install,
- Installed,
- InstalledAndActivated,
- ValidityCompleted,
- Blocked,
- Order,
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.Purchase
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System;
- using System.Runtime.Serialization;
- namespace WinApp.Data.Model
- {
- [DataContract]
- public class Purchase
- {
- private string _dateString;
- [DataMember(Name = "id")]
- public long Id { get; set; }
- [DataMember(Name = "buyer_user_id")]
- public long BuyerUserId { get; set; }
- [DataMember(Name = "product_id")]
- public long ProductId { get; set; }
- [DataMember(Name = "price")]
- public double Price { get; set; }
- [DataMember(Name = "status")]
- public int Status { get; set; }
- [DataMember(Name = "terms")]
- public string Terms { get; set; }
- [DataMember(Name = "package_status")]
- public int PackageStatus { get; set; }
- public DateTime? Date { get; set; }
- [DataMember(Name = "date")]
- public string DateString
- {
- get
- {
- return this._dateString;
- }
- set
- {
- this._dateString = value;
- this.Date = this._dateString == null ? new DateTime?() : new DateTime?(DateTime.Parse(this._dateString));
- }
- }
- public override bool Equals(object purchase)
- {
- return this.Id == ((Purchase) purchase).Id;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.Entity
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using NPoco;
- namespace WinApp.Data.Model
- {
- [PrimaryKey("Id", AutoIncrement = true)]
- public class Entity
- {
- private long _id;
- [Ignore]
- public bool IsNew { get; protected set; }
- public long Id
- {
- get
- {
- return this._id;
- }
- set
- {
- this._id = value;
- this.IsNew = false;
- }
- }
- protected Entity()
- {
- this.IsNew = true;
- }
- public virtual Entity Clone()
- {
- return (Entity) this.MemberwiseClone();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.ModuleInfo
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System.Runtime.Serialization;
- namespace WinApp.Data.Model
- {
- [DataContract]
- public class ModuleInfo
- {
- [DataMember]
- public long Id { get; set; }
- [DataMember]
- public long ProductId { get; set; }
- [DataMember]
- public string Title { get; set; }
- [DataMember]
- public string Version { get; set; }
- [DataMember]
- public string Description { get; set; }
- [DataMember]
- public string Filename { get; set; }
- [DataMember]
- public string Url { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.Module
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using NPoco;
- namespace WinApp.Data.Model
- {
- [TableName("Module")]
- public class Module : Entity
- {
- public int State { get; set; }
- public long ProductId { get; set; }
- [Ignore]
- public ModuleState StateEnum
- {
- get
- {
- return (ModuleState) this.State;
- }
- set
- {
- this.State = (int) value;
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Data.Model.Product
- // Assembly: KairosPlanet.Data, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: 146F38A9-3288-4859-BC9A-322D8E703D1E
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Data.dll
- using System.Runtime.Serialization;
- namespace WinApp.Data.Model
- {
- [DataContract]
- public class Product
- {
- [DataMember(Name = "category_id")]
- public long CategoryId { get; set; }
- [DataMember(Name = "created_date")]
- public string CreatedDate { get; set; }
- [DataMember(Name = "creator_id")]
- public long CreatorId { get; set; }
- [DataMember(Name = "description")]
- public string Description { get; set; }
- [DataMember(Name = "id")]
- public long Id { get; set; }
- [DataMember(Name = "image_url")]
- public string ImageUrl { get; set; }
- [DataMember(Name = "price")]
- public double Price { get; set; }
- [DataMember(Name = "product_url")]
- public string ProductUrl { get; set; }
- [DataMember(Name = "status")]
- public int Status { get; set; }
- [DataMember(Name = "title")]
- public string Title { get; set; }
- [DataMember(Name = "type")]
- public int Type { get; set; }
- [DataMember(Name = "attributes")]
- public ProductAttributes Attributes { get; set; }
- }
- }
- ?using System;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- [assembly: AssemblyInformationalVersion("1.0.18.651")]
- [assembly: AssemblyFileVersion("1.0.18.651")]
- [assembly: AssemblyProduct("KairosPlanet.Data")]
- [assembly: InternalsVisibleTo("KairosPlanet")]
- [assembly: CLSCompliant(false)]
- [assembly: Extension]
- [assembly: AssemblyTitle("KairosPlanet.Data")]
- [assembly: AssemblyDescription("")]
- [assembly: AssemblyConfiguration("")]
- [assembly: ComVisible(false)]
- [assembly: InternalsVisibleTo("KairosPlanet.Tests")]
- [assembly: Guid("6e9f63c9-13ed-4f02-acb0-f8bf5302b813")]
- [assembly: InternalsVisibleTo("KairosPlanet.Service")]
- [assembly: AssemblyCompany("Kairos Technologies Ltd")]
- [assembly: AssemblyCopyright("Copyright © Kairos Technologies 2014")]
- [assembly: AssemblyTrademark("")]
- [assembly: AssemblyVersion("1.0.18.651")]
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.ServiceBootstrapper
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using Inc.Logging;
- using IncMap;
- using WinApp.Data.Helpers;
- using WinApp.Data.Model;
- using WinApp.Service.Core;
- using WinApp.Service.Repository;
- using WinApp.Service.Repository.Interface;
- namespace WinApp.Service
- {
- public class ServiceBootstrapper
- {
- public static void Bootstrap()
- {
- Logger.WriteInfo(typeof (ServiceBootstrapper), "Bootstrap()", "????????????? ?????????? Bootstrapper...");
- Map.Inject<IDatabaseManager>((IDatabaseManager) new SQLiteDatabaseManager(AppData.Path + "\\KairosPlanet.db"));
- ServiceBootstrapper.MapEntityServices<SessionRecord, ISessionRecordRepository>((ISessionRecordRepository) new SessionRecordRepository());
- ServiceBootstrapper.MapEntityServices<Module, IModuleRepository>((IModuleRepository) new ModuleRepository());
- Logger.WriteInfo(typeof (ServiceBootstrapper), "Bootstrap()", "????????? Bootstrapper ??????? ???????????????");
- }
- private static void MapEntityServices<T, TRepo>(TRepo repository) where T : Entity where TRepo : class, IRepository<T>
- {
- Map.Inject<TRepo>(repository);
- Map.Route<IRepository<T>, TRepo>();
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Core.DatabaseInitializer
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using Inc.Logging;
- using IncMap;
- using NPoco;
- using System;
- using System.Data;
- using System.Data.SQLite;
- using System.IO;
- namespace WinApp.Service.Core
- {
- public class DatabaseInitializer : SqlDatabaseInitializer
- {
- private static readonly object _dbLockObj = new object();
- private static readonly DatabaseInitializer _instance = new DatabaseInitializer();
- private readonly SqlDatabaseInitializer.DbUpdate _u0 = new SqlDatabaseInitializer.DbUpdate(1L)
- {
- Comment = "Initial update",
- Sql = "\r\n CREATE TABLE [SessionRecord](\r\n [Id] [integer] PRIMARY KEY AUTOINCREMENT,\r\n [StartInt] [integer] NOT NULL,\r\n [EndInt] [integer] NOT NULL\r\n );"
- };
- private readonly SqlDatabaseInitializer.DbUpdate _u1 = new SqlDatabaseInitializer.DbUpdate(2L)
- {
- Comment = "Initial update 2",
- Sql = "\r\n CREATE TABLE [Module](\r\n [Id] [integer] PRIMARY KEY,\r\n [ProductId] [integer] NOT NULL,\r\n [State] [integer] NOT NULL DEFAULT 0\r\n );"
- };
- public static int UpdateCount
- {
- get
- {
- return DatabaseInitializer._instance.UpdateSequence.Length;
- }
- }
- protected override Database Database
- {
- get
- {
- return new Database((IDbConnection) new SQLiteConnection(Map.Get<IDatabaseManager>().ConnectionString), DatabaseType.SQLite);
- }
- }
- protected override SqlDatabaseInitializer.DbUpdate[] UpdateSequence
- {
- get
- {
- return new SqlDatabaseInitializer.DbUpdate[2]
- {
- this._u0,
- this._u1
- };
- }
- }
- private DatabaseInitializer()
- {
- }
- public static void Initialize()
- {
- lock (DatabaseInitializer._dbLockObj)
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "Initialize()", "????????????? ???? ??????...");
- try
- {
- DatabaseInitializer.CreateDatabase();
- DatabaseInitializer.CreateDatabaseSystemTable();
- DatabaseInitializer.MakeDatabaseChanges();
- Logger.WriteInfo(typeof (DatabaseInitializer), "Initialize()", "???? ?????? ??????? ????????????????");
- }
- catch (Exception exception_0)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "Initialize()", "?????? ??? ????????????? ???? ??????", exception_0);
- }
- }
- }
- public static void CreateDatabase()
- {
- lock (DatabaseInitializer._dbLockObj)
- {
- try
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???????? ??????? ????? ???? ??????...");
- if (File.Exists(Map.Get<IDatabaseManager>().DbPath))
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???? ???? ?????? ??????");
- }
- else
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???? ???? ?????? ?? ??????. ??????? ???? ??????...");
- Map.Get<IDatabaseManager>().CreateDatabase();
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???? ?????? ??????? ???????!");
- }
- }
- catch (Exception exception_0)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "CreateDatabase()", "?????? ??? ???????? ???? ??????", exception_0);
- }
- }
- }
- private static void CreateDatabaseSystemTable()
- {
- lock (DatabaseInitializer._dbLockObj)
- {
- try
- {
- DatabaseInitializer._instance.CreateSystemTable();
- }
- catch (Exception exception_0)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "CreateDatabaseSystemTable()", "?????? ??? ???????? ????????? ??????? ???? ??????", exception_0);
- }
- }
- }
- private static void MakeDatabaseChanges()
- {
- lock (DatabaseInitializer._dbLockObj)
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "MakeDatabaseChanges()", "?????????? ???? ??????...");
- try
- {
- DatabaseInitializer._instance.MakeChanges();
- Logger.WriteInfo(typeof (DatabaseInitializer), "MakeDatabaseChanges()", "?????????? ???? ?????? ?????? ???????");
- }
- catch (Exception exception_0)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "MakeDatabaseChanges()", "?????? ??? ?????????? ?????????? ? ???? ??????", exception_0);
- }
- }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Core.SqlDatabaseInitializer
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using Inc.Logging;
- using NPoco;
- using System;
- using System.Collections.Generic;
- using System.Data.Common;
- using System.Linq;
- namespace WinApp.Service.Core
- {
- public abstract class SqlDatabaseInitializer
- {
- private const string SYSTEM_TABLE_NAME = "_systemInfo";
- protected abstract Database Database { get; }
- protected abstract SqlDatabaseInitializer.DbUpdate[] UpdateSequence { get; }
- internal static string GetCreateSystemTableSqlCommand()
- {
- return string.Format("\r\n CREATE TABLE [{0}](\r\n [id] [integer] NOT NULL,\r\n [Date] [integer] NOT NULL,\r\n [Description] [text] NULL\r\n );\r\n ", (object) "_systemInfo");
- }
- protected virtual void MakeChanges()
- {
- using (Database database = this.Database)
- {
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", "????????? ??????? ?????? ???? ??????...");
- IEnumerable<long> source;
- try
- {
- source = (IEnumerable<long>) Enumerable.ToArray<long>(Enumerable.Select<SqlDatabaseInitializer.IdContainer, long>((IEnumerable<SqlDatabaseInitializer.IdContainer>) database.Fetch<SqlDatabaseInitializer.IdContainer>(string.Format("SELECT [Id] FROM [{0}];", (object) "_systemInfo"), new object[0]), (Func<SqlDatabaseInitializer.IdContainer, long>) (x => x.Id)));
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", "?????? ???? ?????? ???????? ???????");
- }
- catch (DbException ex)
- {
- Logger.WriteWarning(typeof (SqlDatabaseInitializer), "MakeChanges()", "?????? ??? ????????? ?????? ???? ??????. ???????? ????????? ??????? ???????????");
- source = (IEnumerable<long>) new long[0];
- }
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", "??????? ?????? ???? ?????? ????? ?????????? ??????????: " + (object) Enumerable.Count<long>(source));
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", "???????? ? ?????????? ?????????? ???? ??????...");
- foreach (SqlDatabaseInitializer.DbUpdate dbUpdate in this.UpdateSequence)
- {
- SqlDatabaseInitializer.DbUpdate update = dbUpdate;
- if (Enumerable.All<long>(source, (Func<long, bool>) (x => x != update.Id)))
- {
- if (update.DropAll)
- {
- Logger.WriteWarning(typeof (SqlDatabaseInitializer), "MakeChanges()", string.Format("??? ?????????? '{0}' ?????????? ???????? ???? ??????"));
- this.DropTables(database);
- this.CreateSystemTable();
- }
- database.BeginTransaction();
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", string.Format("?????????? ?????????? ?? ??????: {0} ({1})", (object) update.Id, (object) update.Comment));
- this.Execute(database, update.Sql);
- this.CommitVersion(database, update);
- database.CompleteTransaction();
- this.OnUpdate(update);
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "MakeChanges()", string.Format("??????? ????????? ?????????? ???? ?????? ?? ??????: {0} ({1})", (object) update.Id, (object) update.Comment));
- }
- }
- }
- }
- protected virtual void Execute(Database db, string command)
- {
- try
- {
- db.Execute(command, new object[0]);
- }
- catch (DbException ex)
- {
- Logger.WriteError(typeof (SqlDatabaseInitializer), "Execute()", "?????? ??? ?????????? SQL ???????", (Exception) ex);
- }
- }
- protected virtual void OnUpdate(SqlDatabaseInitializer.DbUpdate update)
- {
- }
- protected void CreateSystemTable()
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateSystemTable()", "???????? ????????? ??????? ? ???? ??????...");
- this.Execute(this.Database, SqlDatabaseInitializer.GetCreateSystemTableSqlCommand());
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateSystemTable()", "????????? ??????? ??????? ???????!");
- }
- private void CommitVersion(Database db, SqlDatabaseInitializer.DbUpdate update)
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CommitVersion()", "?????????? ?????? ???? ??????...");
- db.Execute(new Sql(string.Format("INSERT INTO [{0}] ([Id], [Date], [Description]) VALUES (@0, @1, @2);", (object) "_systemInfo"), new object[3]
- {
- (object) update.Id,
- (object) DateTime.Now.ToBinary(),
- (object) update.Comment
- }));
- Logger.WriteInfo(typeof (DatabaseInitializer), "CommitVersion()", "?????? ???? ?????? ??????? ?????????");
- }
- private void DropTables(Database db)
- {
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "DropTables()", "???????? ???? ??????...");
- db.Execute("DROP TABLE [SessionRecords]", new object[0]);
- Logger.WriteInfo(typeof (SqlDatabaseInitializer), "DropTables()", "??? ??????? ???????");
- }
- protected class DbUpdate
- {
- public long Id { get; private set; }
- public bool DropAll { get; set; }
- public string Sql { get; set; }
- public string Comment { get; set; }
- public string Hash { get; set; }
- public DbUpdate(long id)
- {
- this.Id = id;
- }
- }
- private class IdContainer
- {
- public long Id { get; set; }
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Core.IDatabaseManager
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using System.Data;
- namespace WinApp.Service.Core
- {
- public interface IDatabaseManager
- {
- string DbPath { get; }
- string ConnectionString { get; }
- IDbConnection GetNewDbConnection();
- void CreateDatabase();
- void DeleteDatabase();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Core.SQLiteDatabaseManager
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using Inc.Logging;
- using System;
- using System.Data;
- using System.Data.SQLite;
- using System.IO;
- namespace WinApp.Service.Core
- {
- public class SQLiteDatabaseManager : IDatabaseManager
- {
- private string _connectionStringTemplate = "Data Source={0};Version=3;";
- private string _dbPath;
- private string _connectionString;
- public string DbPath
- {
- get
- {
- return this._dbPath;
- }
- }
- public string ConnectionString
- {
- get
- {
- return this._connectionString ?? (this._connectionString = string.Format(this._connectionStringTemplate, (object) this._dbPath));
- }
- }
- public SQLiteDatabaseManager(string path)
- {
- this._dbPath = path;
- }
- public IDbConnection GetNewDbConnection()
- {
- return (IDbConnection) new SQLiteConnection(this.ConnectionString);
- }
- public void CreateDatabase()
- {
- if (File.Exists(this.DbPath))
- return;
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???????? ???? ??????...");
- try
- {
- string directoryName = Path.GetDirectoryName(this.DbPath);
- if (directoryName != null)
- {
- if (!Directory.Exists(directoryName))
- Directory.CreateDirectory(directoryName);
- }
- try
- {
- SQLiteConnection.CreateFile(this.DbPath);
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???? ?????? ??????? ???????");
- }
- catch (Exception ex)
- {
- Logger.WriteWarning(typeof (DatabaseInitializer), "CreateDatabase()", "?????? ??? ???????? ???? ??????");
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???????? SqlLite Pool...");
- SQLiteConnection.ClearAllPools();
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "SqlLite Pool ??????");
- SQLiteConnection.CreateFile(this.DbPath);
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???? ?????? ??????? ???????");
- }
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "CreateDatabase()", "?????? ??? ???????? ???? ??????", ex);
- }
- }
- public void DeleteDatabase()
- {
- if (!File.Exists(this.DbPath))
- return;
- Logger.WriteInfo(typeof (DatabaseInitializer), "DeleteDatabase()", "???????? ???? ??????...");
- try
- {
- Logger.WriteInfo(typeof (DatabaseInitializer), "CreateDatabase()", "???????? SqlLite Pool...");
- SQLiteConnection.ClearAllPools();
- Logger.WriteInfo(typeof (DatabaseInitializer), "DeleteDatabase()", "SqlLite Pool ??????");
- this.DeleteDatabaseFiles();
- }
- catch (Exception ex)
- {
- Logger.WriteError(typeof (DatabaseInitializer), "DeleteDatabase()", "?? ??????? ??????? ???? ??????", ex);
- }
- }
- private void DeleteDatabaseFiles()
- {
- File.Delete(this.DbPath);
- string path = Path.Combine(Path.GetDirectoryName(this.DbPath), Path.GetFileNameWithoutExtension(this.DbPath) + "_log.ldf");
- if (File.Exists(path))
- File.Delete(path);
- Logger.WriteInfo(typeof (DatabaseInitializer), "DeleteDatabaseFiles()", "???? ?????? ??????? ???????");
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.Repository`1
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using IncMap;
- using NPoco;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SQLite;
- using System.Linq;
- using WinApp.Data.Model;
- using WinApp.Service.Core;
- using WinApp.Service.Repository.Interface;
- namespace WinApp.Service.Repository
- {
- public class Repository<T> : IRepository<T> where T : Entity
- {
- protected Database Database
- {
- get
- {
- return new Database((IDbConnection) new SQLiteConnection(Map.Get<IDatabaseManager>().ConnectionString));
- }
- }
- protected string TableName { get; private set; }
- protected Repository(string tableName)
- {
- this.TableName = tableName;
- }
- public void Insert(T entity)
- {
- this.Database.Insert<T>(this.TableName, "Id", true, entity);
- }
- public void Update(T entity)
- {
- this.Database.Update(this.TableName, "Id", (object) entity);
- }
- public void Update(T entity, string[] fields)
- {
- this.Database.Update(this.TableName, "Id", (object) entity, (IEnumerable<string>) fields);
- }
- public virtual T[] FindAll()
- {
- return this.Database.Fetch<T>(string.Format("SELECT * FROM [{0}];", (object) this.TableName), new object[0]).ToArray();
- }
- public virtual T FindById(long id)
- {
- return Enumerable.SingleOrDefault<T>((IEnumerable<T>) this.Database.Fetch<T>(string.Format("SELECT * FROM [{0}] WHERE Id = @0", (object) this.TableName), new object[1]
- {
- (object) id
- }));
- }
- public virtual T Save(T entity)
- {
- if (entity.IsNew)
- this.Insert(entity);
- else
- this.Update(entity);
- return entity;
- }
- public virtual void Delete(T entity)
- {
- this.Database.Delete((object) entity);
- }
- protected void BulkInsertRecords(IEnumerable<T> collection)
- {
- Database database = this.Database;
- foreach (T poco in collection)
- database.Insert<T>(poco);
- }
- protected IEnumerable<T> FindBy(string whereClause, params object[] parameters)
- {
- return (IEnumerable<T>) this.Database.Fetch<T>(string.Format("SELECT * FROM [{0}] WHERE {1}", (object) this.TableName, (object) whereClause), parameters);
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.Interface.ISessionRecordRepository
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using System;
- using WinApp.Data.Model;
- namespace WinApp.Service.Repository.Interface
- {
- public interface ISessionRecordRepository : IRepository<SessionRecord>
- {
- long GetTotalTime();
- long GetTotalTimeByPeriod(DateTime periodStart, DateTime periodEnd);
- SessionRecord[] GetByPeriod(DateTime periodStart, DateTime periodEnd);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.Interface.IRepository`1
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using WinApp.Data.Model;
- namespace WinApp.Service.Repository.Interface
- {
- public interface IRepository<T> where T : Entity
- {
- T[] FindAll();
- T FindById(long id);
- void Insert(T entity);
- void Update(T entity);
- void Update(T entity, string[] fields);
- T Save(T entity);
- void Delete(T entity);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.Interface.IModuleRepository
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using WinApp.Data.Model;
- namespace WinApp.Service.Repository.Interface
- {
- public interface IModuleRepository : IRepository<Module>
- {
- bool IsInstalled(long productId);
- bool IsInstalledAndActivated(long productId);
- Module GetModuleByProductId(long productId);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.ModuleRepository
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using System.Linq;
- using WinApp.Data.Model;
- using WinApp.Service.Repository.Interface;
- namespace WinApp.Service.Repository
- {
- public class ModuleRepository : Repository<Module>, IModuleRepository, IRepository<Module>
- {
- public ModuleRepository()
- : base("Module")
- {
- }
- public bool IsInstalled(long productId)
- {
- Module module = Enumerable.SingleOrDefault<Module>(this.FindBy("ProductId = @0", (object) productId));
- if (module == null)
- return false;
- return module.State == 2;
- }
- public bool IsInstalledAndActivated(long productId)
- {
- Module module = Enumerable.SingleOrDefault<Module>(this.FindBy("ProductId = @0", (object) productId));
- if (module == null)
- return false;
- return module.State == 3;
- }
- public Module GetModuleByProductId(long productId)
- {
- return Enumerable.SingleOrDefault<Module>(this.FindBy("ProductId = @0", (object) productId)) ?? (Module) null;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Service.Repository.SessionRecordRepository
- // Assembly: KairosPlanet.Service, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: C598B940-0130-4846-9EFD-92647F3BFA24
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.Service.dll
- using System;
- using System.Linq;
- using WinApp.Data.Model;
- using WinApp.Service.Repository.Interface;
- namespace WinApp.Service.Repository
- {
- public class SessionRecordRepository : Repository<SessionRecord>, ISessionRecordRepository, IRepository<SessionRecord>
- {
- public SessionRecordRepository()
- : base("SessionRecord")
- {
- }
- public long GetTotalTime()
- {
- return this.Database.ExecuteScalar<long>("SELECT SUM([EndInt] - [StartInt]) FROM [SessionRecord]", new object[0]);
- }
- public long GetTotalTimeByPeriod(DateTime periodStart, DateTime periodEnd)
- {
- if (periodEnd.Subtract(periodStart) < TimeSpan.Zero)
- return 0;
- return this.Database.ExecuteScalar<long>("SELECT SUM([EndInt] - [StartInt])\r\n FROM [SessionRecord]\r\n WHERE [StartInt] >= @0 AND [EndInt] <= @1", (object) periodStart.Ticks, (object) periodEnd.Ticks);
- }
- public SessionRecord[] GetByPeriod(DateTime periodStart, DateTime periodEnd)
- {
- return Enumerable.ToArray<SessionRecord>(this.FindBy("[StartInt] >= @0 AND [EndInt] <= @1", (object) periodStart.Ticks, (object) periodEnd.Ticks));
- }
- }
- }
- ?using System;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- [assembly: InternalsVisibleTo("KairosPlanet.Tests")]
- [assembly: AssemblyTitle("KairosPlanet.Service")]
- [assembly: AssemblyDescription("")]
- [assembly: AssemblyProduct("KairosPlanet.Service")]
- [assembly: InternalsVisibleTo("KairosPlanet")]
- [assembly: AssemblyConfiguration("")]
- [assembly: AssemblyCompany("Kairos Technologies Ltd")]
- [assembly: AssemblyCopyright("Copyright © Kairos Technologies 2014")]
- [assembly: AssemblyTrademark("")]
- [assembly: ComVisible(false)]
- [assembly: CLSCompliant(false)]
- [assembly: AssemblyFileVersion("1.0.18.651")]
- [assembly: AssemblyInformationalVersion("1.0.18.651")]
- [assembly: AssemblyVersion("1.0.18.651")]
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.ApiClientFactory
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using Inc.Logging;
- using KairosPlanet.WebServiceManager;
- using System;
- using System.Net;
- using System.Net.Security;
- using System.Security.Cryptography.X509Certificates;
- using System.ServiceModel;
- using System.ServiceModel.Channels;
- using System.ServiceModel.Description;
- using WinApp.Api.Interfaces;
- namespace WinApp.Api
- {
- public class ApiClientFactory : IClientFactory
- {
- private string _userAgent;
- public IAuthApi CreateChannel(string login, string password, string endpoingUri, string userAgent)
- {
- this._userAgent = userAgent;
- if (endpoingUri.ToUpper().StartsWith("HTTPS://"))
- return this.CreateChannelHttps(login.ToLower(), password, endpoingUri);
- return this.CreateChannelHttp(login.ToLower(), password, endpoingUri);
- }
- public void SetUserAgent(string userAgent)
- {
- if (string.IsNullOrEmpty(userAgent))
- return;
- this._userAgent = userAgent;
- }
- private IAuthApi CreateChannelHttps(string login, string password, string endpoingUri)
- {
- CheckPoint checkPoint = Logger.CheckPointStart("ClientFactory.CreateChannel HTTPS");
- ApiAccess apiAccess;
- try
- {
- WebHttpBinding webHttpBinding = new WebHttpBinding();
- EndpointAddress remoteAddress = new EndpointAddress(endpoingUri);
- webHttpBinding.UseDefaultWebProxy = true;
- webHttpBinding.Security.Mode = WebHttpSecurityMode.Transport;
- webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
- webHttpBinding.OpenTimeout = new TimeSpan(0, 0, 3, 0, 0);
- webHttpBinding.SendTimeout = new TimeSpan(0, 0, 3, 0, 0);
- webHttpBinding.MaxReceivedMessageSize = (long) int.MaxValue;
- webHttpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
- webHttpBinding.AllowCookies = true;
- apiAccess = new ApiAccess((Binding) webHttpBinding, remoteAddress);
- apiAccess.SetUserData(login, password);
- apiAccess.Endpoint.Behaviors.Add((IEndpointBehavior) new WebHttpBehavior());
- apiAccess.Endpoint.Behaviors.Add((IEndpointBehavior) new HttpKairosEndpointBehavior(this._userAgent, login, password));
- ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(this.ValidateRemoteCertificate);
- }
- finally
- {
- checkPoint.Close();
- }
- return (IAuthApi) apiAccess;
- }
- private IAuthApi CreateChannelHttp(string login, string password, string endpoingUri)
- {
- CheckPoint checkPoint = Logger.CheckPointStart("ClientFactory.CreateChannel HTTP");
- ApiAccess apiAccess;
- try
- {
- WebHttpBinding webHttpBinding = new WebHttpBinding();
- EndpointAddress remoteAddress = new EndpointAddress(endpoingUri);
- webHttpBinding.Security.Mode = WebHttpSecurityMode.TransportCredentialOnly;
- webHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
- webHttpBinding.OpenTimeout = new TimeSpan(0, 0, 3, 0, 0);
- webHttpBinding.SendTimeout = new TimeSpan(0, 0, 3, 0, 0);
- webHttpBinding.MaxReceivedMessageSize = (long) int.MaxValue;
- webHttpBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
- webHttpBinding.AllowCookies = true;
- apiAccess = new ApiAccess((Binding) webHttpBinding, remoteAddress);
- apiAccess.SetUserData(login, password);
- apiAccess.Endpoint.Behaviors.Add((IEndpointBehavior) new WebHttpBehavior());
- apiAccess.Endpoint.Behaviors.Add((IEndpointBehavior) new HttpKairosEndpointBehavior(this._userAgent, login, password));
- }
- finally
- {
- checkPoint.Close();
- }
- return (IAuthApi) apiAccess;
- }
- private bool ValidateRemoteCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors policyErrors)
- {
- return cert.Subject.ToUpper().Contains("staging.xmlm.t4web.com.ua".ToUpper()) || cert.Subject.ToUpper().Contains("cabinet.kairosplanet.com".ToUpper());
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.ModuleContentResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class ModuleContentResponse
- {
- [DataMember(Name = "source")]
- public string Source { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.StatisticsResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class StatisticsResponse
- {
- [DataMember(Name = "sessions")]
- public Statistic[] Statistics { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.PurchaseResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- using WinApp.Data.Model;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class PurchaseResponse
- {
- [DataMember(Name = "purchases")]
- public Purchase[] Purchases { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.PingResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class PingResponse
- {
- [DataMember(Name = "lifetime")]
- public long Lifetime { get; set; }
- public long ErrorText { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.ActivationRequest
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class ActivationRequest
- {
- [DataMember(Name = "purchase_id")]
- public long PurchaseId { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.AppVersionResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class AppVersionResponse
- {
- [DataMember(Name = "id")]
- public long Id { get; set; }
- [DataMember(Name = "version")]
- public string Version { get; set; }
- [DataMember(Name = "file_name")]
- public string FileName { get; set; }
- [DataMember(Name = "path")]
- public string Path { get; set; }
- [DataMember(Name = "status")]
- public bool Status { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.Statistic
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System;
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class Statistic
- {
- private string _created;
- private string _closed;
- [DataMember(Name = "id")]
- public long Id { get; set; }
- [DataMember(Name = "actual")]
- public bool Actual { get; set; }
- [DataMember(Name = "created")]
- public string Created
- {
- get
- {
- return this._created;
- }
- set
- {
- this._created = value;
- this.CreatedDate = DateTime.Parse(this._created);
- }
- }
- public DateTime CreatedDate { get; private set; }
- [DataMember(Name = "lifetime")]
- public long Lifetime { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.ModuleInfoResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class ModuleInfoResponse
- {
- [DataMember(Name = "id")]
- public long Id { get; set; }
- [DataMember(Name = "product_id")]
- public long ProductId { get; set; }
- [DataMember(Name = "title")]
- public string Title { get; set; }
- [DataMember(Name = "version")]
- public string Version { get; set; }
- [DataMember(Name = "description")]
- public string Description { get; set; }
- [DataMember(Name = "filename")]
- public string Filename { get; set; }
- [DataMember(Name = "url")]
- public string Url { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.ActivationResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class ActivationResponse
- {
- [DataMember(Name = "packagesecurekey")]
- public string PackageSecureKey { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Data.UserResponse
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.Runtime.Serialization;
- using WinApp.Data.Model;
- namespace WinApp.Api.Data
- {
- [DataContract]
- public class UserResponse
- {
- [DataMember(Name = "user")]
- public Man User { get; set; }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.WebServiceManager.HttpKairosEndpointBehavior
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.ServiceModel.Channels;
- using System.ServiceModel.Description;
- using System.ServiceModel.Dispatcher;
- namespace KairosPlanet.WebServiceManager
- {
- public class HttpKairosEndpointBehavior : IEndpointBehavior
- {
- private readonly string _userAgent;
- private readonly string _login;
- private readonly string _password;
- public HttpKairosEndpointBehavior(string userAgent, string login = "", string password = "")
- {
- this._userAgent = userAgent;
- this._login = login.ToLower();
- this._password = password;
- }
- public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
- {
- }
- public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
- {
- HttpKairosMessageInspector messageInspector = new HttpKairosMessageInspector(this._userAgent, this._login, this._password);
- clientRuntime.MessageInspectors.Add((IClientMessageInspector) messageInspector);
- }
- public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
- {
- }
- public void Validate(ServiceEndpoint endpoint)
- {
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: KairosPlanet.WebServiceManager.HttpKairosMessageInspector
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.ServiceModel;
- using System.ServiceModel.Channels;
- using System.ServiceModel.Dispatcher;
- using System.Text;
- namespace KairosPlanet.WebServiceManager
- {
- public class HttpKairosMessageInspector : IClientMessageInspector
- {
- private static readonly HashSet<string> _requiredAuth = new HashSet<string>()
- {
- "/users/api/desktop/get-user/",
- "/users/api/desktop/get-purchases/",
- "/users/api/desktop/get-statistic/",
- "/application/api/desktop/get-module-info/",
- "/application/api/desktop/get-module-content/",
- "/application/api/desktop/get-application-info/"
- };
- private readonly string _userAgent;
- private readonly string _login;
- private readonly string _password;
- public HttpKairosMessageInspector(string userAgent, string login = "", string password = "")
- {
- this._userAgent = userAgent;
- this._login = login;
- this._password = password;
- }
- public void AfterReceiveReply(ref Message reply, object correlationState)
- {
- }
- public object BeforeSendRequest(ref Message request, IClientChannel channel)
- {
- object obj;
- if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out obj))
- {
- HttpRequestMessageProperty requestMessageProperty = obj as HttpRequestMessageProperty;
- if (requestMessageProperty != null)
- {
- if (!string.IsNullOrEmpty(this._login) && !string.IsNullOrEmpty(this._password))
- {
- string path = request.Headers.To.AbsolutePath;
- if (Enumerable.Any<string>((IEnumerable<string>) HttpKairosMessageInspector._requiredAuth, (Func<string, bool>) (x => path == x)))
- requestMessageProperty.Headers[HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(this._login + ":" + this._password));
- }
- if (string.IsNullOrEmpty(requestMessageProperty.Headers[HttpRequestHeader.UserAgent]))
- requestMessageProperty.Headers[HttpRequestHeader.UserAgent] = this._userAgent;
- else
- request.Properties.Add(HttpRequestMessageProperty.Name, (object) new HttpRequestMessageProperty()
- {
- Headers = {
- {
- HttpRequestHeader.UserAgent,
- this._userAgent
- }
- }
- });
- }
- }
- return (object) null;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.ApiException
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System;
- using System.Net;
- namespace WinApp.Api
- {
- public class ApiException : Exception
- {
- public HttpStatusCode ErrorCode { get; set; }
- public string StatusDescription { get; set; }
- public ApiException(string message, HttpStatusCode errorCode, string statusDescription = "")
- : base(message)
- {
- this.ErrorCode = errorCode;
- this.StatusDescription = statusDescription;
- }
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IClientFactory
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- namespace WinApp.Api.Interfaces
- {
- public interface IClientFactory
- {
- IAuthApi CreateChannel(string login, string password, string endpoingUri, string userAgent);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IApi
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.ServiceModel;
- namespace WinApp.Api.Interfaces
- {
- [ServiceContract]
- public interface IApi : IProductsApi
- {
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IUsersApi
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System;
- using System.ServiceModel;
- using System.ServiceModel.Web;
- using WinApp.Api.Data;
- namespace WinApp.Api.Interfaces
- {
- [ServiceContract]
- public interface IUsersApi
- {
- [OperationContract]
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/get-user/")]
- UserResponse GetUser();
- [OperationContract]
- [WebInvoke(BodyStyle = WebMessageBodyStyle.Bare, Method = "POST", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/ping/?packagesecurekey={packagesecurekey}")]
- PingResponse Ping(string packagesecurekey);
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/get-statistic/")]
- [OperationContract]
- StatisticsResponse GetStatistics();
- [OperationContract(Name = "GetStatisticsExt")]
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/get-statistic/?dateFrom={dateFrom}&dateTo={dateTo}")]
- StatisticsResponse GetStatistics(DateTime dateFrom, DateTime dateTo);
- [OperationContract]
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/get-purchases/")]
- PurchaseResponse GetPurchases();
- [OperationContract]
- [WebInvoke(Method = "PUT", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/users/api/desktop/activation/")]
- ActivationResponse Activation(ActivationRequest activationRequest);
- void SetUserData(string username, string password);
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/application/api/desktop/get-application-info/")]
- [OperationContract]
- AppVersionResponse GetAppVersion();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IProductsApi
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.ServiceModel;
- using System.ServiceModel.Web;
- using WinApp.Data.Model;
- namespace WinApp.Api.Interfaces
- {
- [ServiceContract]
- public interface IProductsApi
- {
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/products/api/products/")]
- [OperationContract]
- Product[] GetProducts();
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/products/api/products/?limit={limit}&offset={offset}")]
- [OperationContract(Name = "GetProductsByOffset")]
- Product[] GetProducts(int limit, int offset);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IAppApi
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.ServiceModel;
- using System.ServiceModel.Web;
- using WinApp.Api.Data;
- namespace WinApp.Api.Interfaces
- {
- [ServiceContract]
- public interface IAppApi
- {
- [OperationContract]
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/application/api/desktop/get-module-info/?product_id={productId}")]
- ModuleInfoResponse GetModuleInfo(long productId);
- [WebGet(BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json, UriTemplate = "/application/api/desktop/get-module-content/?product_id={productId}")]
- [OperationContract]
- ModuleContentResponse GetModuleContent(long productId);
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.Interfaces.IAuthApi
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using System.ServiceModel;
- namespace WinApp.Api.Interfaces
- {
- [ServiceContract]
- public interface IAuthApi : IUsersApi, IApi, IProductsApi, IAppApi
- {
- void Close();
- }
- }
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.ApiAccess
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using Inc.Logging;
- using System;
- using System.Net;
- using System.ServiceModel;
- using System.ServiceModel.Channels;
- using WinApp.Api.Data;
- using WinApp.Api.Interfaces;
- using WinApp.Data.Model;
- namespace WinApp.Api
- {
- public class ApiAccess : ClientBase<IAuthApi>, IAuthApi, IUsersApi, IApi, IProductsApi, IAppApi
- {
- public ApiAccess(Binding binding, EndpointAddress remoteAddress)
- : base(binding, remoteAddress)
- {
- }
- public ModuleInfoResponse GetModuleInfo(long productId)
- {
- return this.HandleResponse<ModuleInfoResponse>((Func<IAuthApi, ModuleInfoResponse>) (x => x.GetModuleInfo(productId)));
- }
- public ModuleContentResponse GetModuleContent(long productId)
- {
- return this.HandleResponse<ModuleContentResponse>((Func<IAuthApi, ModuleContentResponse>) (x => x.GetModuleContent(productId)));
- }
- public void SetUserData(string username, string password)
- {
- this.ClientCredentials.UserName.UserName = username.ToLower();
- this.ClientCredentials.UserName.Password = password;
- }
- public StatisticsResponse GetStatistics()
- {
- return this.HandleResponse<StatisticsResponse>((Func<IAuthApi, StatisticsResponse>) (x => x.GetStatistics()));
- }
- public StatisticsResponse GetStatistics(DateTime dateFrom, DateTime dateTo)
- {
- return this.HandleResponse<StatisticsResponse>((Func<IAuthApi, StatisticsResponse>) (x => x.GetStatistics(dateFrom, dateTo)));
- }
- public UserResponse GetUser()
- {
- return this.HandleResponse<UserResponse>((Func<IAuthApi, UserResponse>) (x => x.GetUser()));
- }
- public PingResponse Ping(string packageSecureKey)
- {
- return this.HandleResponse<PingResponse>((Func<IAuthApi, PingResponse>) (x => x.Ping(packageSecureKey)));
- }
- public Product[] GetProducts()
- {
- return this.HandleResponse<Product[]>((Func<IAuthApi, Product[]>) (x => x.GetProducts()));
- }
- public Product[] GetProducts(int limit, int offset)
- {
- return this.HandleResponse<Product[]>((Func<IAuthApi, Product[]>) (x => x.GetProducts(limit, offset)));
- }
- public PurchaseResponse GetPurchases()
- {
- return this.HandleResponse<PurchaseResponse>((Func<IAuthApi, PurchaseResponse>) (x => x.GetPurchases()));
- }
- public ActivationResponse Activation(ActivationRequest activationRequest)
- {
- return this.HandleResponse<ActivationResponse>((Func<IAuthApi, ActivationResponse>) (x => x.Activation(activationRequest)));
- }
- public AppVersionResponse GetAppVersion()
- {
- return this.HandleResponse<AppVersionResponse>((Func<IAuthApi, AppVersionResponse>) (x => x.GetAppVersion()));
- }
- private T HandleResponse<T>(Func<IAuthApi, T> func)
- {
- try
- {
- return func(this.Channel);
- }
- catch (Exception ex)
- {
- Logger.WriteError((object) this, "HandleResponse<T>", "Method: '" + func.Method.Name + "'. Error: " + ex.Message);
- WebException webException = ex.InnerException as WebException;
- if (webException != null && webException.Response != null)
- {
- HttpWebResponse httpWebResponse = (HttpWebResponse) webException.Response;
- throw new ApiException(webException.Message, httpWebResponse.StatusCode, httpWebResponse.StatusDescription);
- }
- throw;
- }
- }
- }
- }
- ?using System;
- using System.Reflection;
- using System.Runtime.InteropServices;
- [assembly: AssemblyTitle("KairosPlanet.WebServiceManager")]
- [assembly: AssemblyDescription("")]
- [assembly: AssemblyInformationalVersion("1.0.18.651")]
- [assembly: Guid("7aa12bcc-c133-487c-b901-bb1afd1f652b")]
- [assembly: AssemblyFileVersion("1.0.18.651")]
- [assembly: AssemblyProduct("KairosPlanet.WebServiceManager")]
- [assembly: AssemblyConfiguration("")]
- [assembly: AssemblyCompany("Kairos Technologies Ltd")]
- [assembly: AssemblyCopyright("Copyright © Kairos Technologies 2014")]
- [assembly: AssemblyTrademark("")]
- [assembly: ComVisible(false)]
- [assembly: CLSCompliant(false)]
- [assembly: AssemblyVersion("1.0.18.651")]
- ?// Decompiled with JetBrains decompiler
- // Type: WinApp.Api.ApiBootstrapper
- // Assembly: KairosPlanet.WebServiceManager, Version=1.0.18.651, Culture=neutral, PublicKeyToken=null
- // MVID: F6F5C251-9F2C-4C96-A6DF-4DB3276EDED0
- // Assembly location: C:\Program Files (x86)\KairosPlanet\Bin\KairosPlanet.WebServiceManager.dll
- using IncMap;
- using WinApp.Api.Interfaces;
- namespace WinApp.Api
- {
- public class ApiBootstrapper
- {
- public static void Bootstrap()
- {
- Map.Inject<IClientFactory>((IClientFactory) new ApiClientFactory());
- }
- }
- }
Add Comment
Please, Sign In to add comment