Exemple #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (!(ckbUpdate.Checked && ckbUpdate1.Checked))
        {
            return;
        }

        //1. проверка на возможность обновления
        //var compareCodeInf = UpdaterService.CompareCodeVersions();
        //if (!string.IsNullOrEmpty(compareCodeInf))
        //{
        //    // вывести отличия
        //    return;
        //}
        //var compareBaseInf = UpdaterService.CompareBaseVersions();
        //if (!string.IsNullOrEmpty(compareBaseInf))
        //{
        //    // вывести отличия
        //    return;
        //}

        //2. Создание бэкапов
        UpdaterService.CreateAdvantshopBackups();

        //3. скачваем последнюю версию двига и обновляем
        UpdaterService.UpdateAvantshop();
    }
        protected override void OnLoad(EventArgs e)
        {
            try
            {
                this.disableUpdateCheckToolStripMenuItem.Text = Settings.Default.EnableAutoUpdate ? "Disable Auto Update" : "Enable Auto Update";

                // Check for update if it's been more than one full day since the last update check.
                if ((DateTime.Today - Settings.Default.LastUpdateCheckDate).TotalMinutes >= 1440)
                {
                    UpdaterService service = new UpdaterService();
                    service.UpdateAvailable += new EventHandler <UpdateReaultEventArgs>(this.Service_UpdateAvailable);
                    service.CheckForUpdatesAsync();

                    Settings.Default.LastUpdateCheckDate = DateTime.Today;
                    Settings.Default.Save();
                }

                this.EventReceiverFilterToolStripComboBox.SelectedIndex = 0;

                Utility.GetSitesOnLocalServer(this.SiteComboBox.Items);
            }
            catch (UnauthorizedAccessException)
            {
                MessageBox.Show(this, "You do not have permission to access the selected site.", "Unauthorized Access", MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
            }
            catch (Exception ex)
            {
                this.HandleException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemple #3
0
        public void GetLatestVersion()
        {
            var update  = new UpdaterService("Nala.Worker");
            var version = update.GetLatestVersion();

            Assert.IsNotNull(version);
        }
Exemple #4
0
        protected override async Task OnInitializedAsync()
        {
            Telemetry.TrackPageView(new PageViewTelemetry("Updater page")
            {
                Url = new Uri("/Updater/Manage", UriKind.Relative)
            });

            await base.OnInitializedAsync().ConfigureAwait(false);

            UpdaterService.OnDownloadProgress += UpdaterService_OnDownloadProgressAsync;

            UpdaterService.OnDownloadStart += UpdaterService_OnDownloadStart;

            UpdaterService.OndownloadComplete += UpdaterService_OndownloadComplete;

            UpdaterService.OnReleasesDownloadCompleted += UpdaterService_OnReleasesDownloadCompleted;

            try
            {
                UpdaterService.LoadReleases();
            }
            catch (Exception e)
            {
                Logger.LogError("Impossible de charger la liste des releases.", e);
                Telemetry.TrackException(e);

                await ShowErrorToastAsync("Release", $"Impossible d'obtenir la liste des release.");
            }
        }
Exemple #5
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var hero = new Hero();

            var heroService      = new UpdaterService();
            var removerService   = new RemoverService();
            var drawerService    = new DrawerService((int)Width, (int)Height);
            var contrllerService = new KeyboardControllerService {
                Controllable = hero
            };

            var world = World.Instance;

            world.OnUpdate = () => Application.Current.Dispatcher.Invoke(() => MainScreen.Source = drawerService.DrawableBytes.ToBitmapSource());
            world.AddService(heroService);
            world.AddService(removerService);
            world.AddService(drawerService);
            world.AddService(contrllerService);
            world.AddEntity(hero);
            world.Start();

//            var client = new RoverClient("localhost", 12321) {
//                OnMapMessage = message => Application.Current.Dispatcher.Invoke(() => MainScreen.Source = message.DrawableBytes.ToBitmapSource())
//            };
//
//            client.ControllerService = new KeyboardControllerService {Controllable = new HeroAdapter(client)};
        }
        public static string btnCompareBase_OnClick(bool updateMasks)
        {
            var report = UpdaterService.CompareBaseVersions(updateMasks);

            return(!string.IsNullOrEmpty(report)
                       ? report
                       : "<span style=\"color:green;\">Versions of the database are the same</span>");
        }
Exemple #7
0
        public UpdaterServiceTests()
        {
            _hostedUpdaterMock = new Mock <IHostedService>();
            _progressMock      = new Mock <IUpdatingProgress>();
            _dataProcessorMock = new Mock <IDataProcessor>();

            _service = new UpdaterService(_hostedUpdaterMock.Object, _progressMock.Object, _dataProcessorMock.Object);
        }
Exemple #8
0
 protected void lnkFileCode_Click(object sender, EventArgs e)
 {
     UpdaterService.CreateCodeMaskFile();
     Page.Response.Clear();
     Page.Response.AppendHeader("content-disposition", "attachment; filename=\"adv_code_mask.txt\"");
     Page.Response.TransmitFile(ShopCodeMaskFile);
     Page.Response.Flush();
     Page.Response.End();
 }
 public SettingsViewModel(MainWindowViewModel mainVm)
 {
     this.mainVm    = mainVm;
     this.Settings  = mainVm.Repository.GetSettings();
     BundledTheme   = Application.Current.Resources.MergedDictionaries.OfType <BundledTheme>().First();
     UpdaterService = new UpdaterService(this.mainVm.Repository.GetLiteRepository());
     GoBack         = new RelayCommand(_ => mainVm.GoBack());
     DownloadUpdate = new RelayCommand(ExecuteDownloadUpdate);
 }
Exemple #10
0
        protected void btnCompareBase_OnClick(object sender, EventArgs e)
        {
            var report = UpdaterService.CompareBaseVersions(ckbUpdateMasks.Checked);

            ltrlReport.InnerHtml = !string.IsNullOrEmpty(report) ? report : "<span style=\"color:green;\">Versions of the code are the same</span>";

            if (File.Exists(ShopBaseMaskFile))
            {
                lnkFileSql.Text = @"base mask (" + new FileInfo(ShopBaseMaskFile).LastWriteTime + @")";
            }
        }
Exemple #11
0
        static void Main(string[] args)
        {
            string errorMessage;

            ConfigurationVO cvo;

            // Check if PresentationID was passed
            if (args.Length != 3)
            {
                Console.Write(USAGE);
                Console.ReadLine();
                return;
            }

            // Check if command line parms are proper
            if (!checkCmdLineVars(args, out errorMessage))
            {
                Console.Write(errorMessage);
                Console.ReadLine();
                return;
            }

            // Check if config file is proper
            if (!tryConfiguration(out cvo))
            {
                Console.WriteLine("Some important configuration values are missing.");
                return;
            }

            cvo.PresentationID = presentationID;
            cvo.DemoPath       = demoPath;
            cvo.ExportPath     = outputPath;

            Utility.Log(cvo.LogFile, String.Concat("args: [", String.Join("], [", args), "]"));

            Boolean         bSuccess = true;
            MediaFileMerger sm       = new MediaFileMerger(cvo);

            try
            {
                sm.Process();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception in Program.cs: [{0}] {1}", e.GetType(), e.Message);
                bSuccess = false;
            }
            finally
            {
                UpdaterService us = new UpdaterService(cvo.UpdateServiceUrl);
                us.Update("MediaFileMerger", cvo.PresentationID.ToString(), bSuccess);
            }
        }
Exemple #12
0
        private void FormUpdater_Load(object sender, System.EventArgs e)
        {
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            MaterialSkinManager skinManager = MaterialSkinManager.Instance;

            skinManager.AddFormToManage(this);
            skinManager.Theme       = MaterialSkinManager.Themes.DARK;
            skinManager.ColorScheme = new ColorScheme(MaterialSkin.Primary.Purple300, MaterialSkin.Primary.BlueGrey900, MaterialSkin.Primary.Green100, Accent.Blue200, TextShade.WHITE);

            UpdaterService updaterService = new UpdaterService(labelStatus, materialProgressBarDownload, buttonUpdate, labelCurrentVersionNumber, labelNewVersionNumber);

            updaterService.PrimitiveCheck();
        }
        public async Task Should_unpack_update()
        {
            var unpacker = new Mock <IUnpacker>();

            unpacker.Setup(p => p.UnpackUpdateAsync(It.IsAny <string>())).Returns(Task.FromResult("test"));
            var preferencesService = new Mock <IPreferencesService>();

            SetupMocks(preferencesService);

            var service = new UpdaterService(unpacker.Object, preferencesService.Object, new Mock <IStorageProvider>().Object, new Mock <IMapper>().Object);
            var result  = await service.UnpackUpdateAsync("path");

            result.Should().Be("test");
        }
Exemple #14
0
        public UpdaterForm()
        {
            _updater = new UpdaterService();

            InitializeComponent();

            _updater.OnCheckingForUpdates   += OnCheckingForUpdates;
            _updater.OnUpdateAvailable      += OnUpdateAvailable;
            _updater.OnDownloadingInstaller += OnDownloadingInstaller;
            _updater.OnInstallerDownloaded  += OnInstallerDownloaded;
            _updater.OnUpToDate             += OnUpToDate;

            this.Shown += UpdaterForm_OnShown;
        }
Exemple #15
0
 private static void Update(string updateDir, string axtoolsDir)
 {
     while (Process.GetProcessesByName(nameof(AxTools)).Length > 1)
     {
         log.Info("Waiting for parent AxTools process...");
         Thread.Sleep(500);
     }
     UpdaterService.ApplyUpdate(updateDir, axtoolsDir);
     Process.Start(new ProcessStartInfo
     {
         FileName         = Path.Combine(axtoolsDir, "AxTools.exe"),
         WorkingDirectory = axtoolsDir,
         Arguments        = "-update-plugins",
     });
 }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var versInf = UpdaterService.GetLastVersionInformation();

            lblLastVersion.Text = versInf.lastVersion;

            if (!string.IsNullOrEmpty(versInf.versionHistory))
            {
                lblVersionInformation.InnerHtml = versInf.versionHistory;
            }
            else
            {
                lblVersionInformation.InnerHtml = "No information";
                divMoreInf.Visible = false;
            }
        }
        public void Should_save_updater_settings()
        {
            var unpacker           = new Mock <IUnpacker>();
            var preferencesService = new Mock <IPreferencesService>();

            SetupMocks(preferencesService);

            var service = new UpdaterService(unpacker.Object, preferencesService.Object, new Mock <IStorageProvider>().Object, new Mock <IMapper>().Object);
            var result  = service.Save(new UpdateSettings()
            {
                CheckForPrerelease = true,
                AutoUpdates        = false
            });

            result.Should().Be(true);
        }
Exemple #18
0
 private async void ExecuteDownloadUpdate(object o)
 {
     IsDownloading   = true;
     DownloadMessage = "0%";
     if (await UpdaterService.DownloadUpdate(p =>
     {
         this.DownloadingProgress = p;
         this.DownloadMessage = p.ToString("P");
     }))
     {
         UpdaterService.StartUpdater();
         Application.Current.Shutdown();
     }
     else
     {
         IsDownloading        = false;
         this.DownloadMessage = "Update";
     }
 }
Exemple #19
0
        public static string btnUpdate_Click(bool updateMasks)
        {
            UpdaterStatus.IsProcess = true;

            //1. проверка на возможность обновления
            UpdaterStatus.Status = "Check source ...";
            //System.Threading.Thread.Sleep(2000);
            var compareCodeInf = UpdaterService.CompareCodeVersions(updateMasks);

            if (!string.IsNullOrEmpty(compareCodeInf))
            {
                UpdaterStatus.Status = "Not completed";
                return(compareCodeInf);
            }

            UpdaterStatus.Status = "Check database ...";
            //System.Threading.Thread.Sleep(2000);
            var compareBaseInf = UpdaterService.CompareBaseVersions(updateMasks);

            if (!string.IsNullOrEmpty(compareBaseInf))
            {
                UpdaterStatus.Status = "Not completed";
                return(compareBaseInf);
            }

            //2. Создание бэкапов
            UpdaterStatus.Status = "Create database backup ...";
            //System.Threading.Thread.Sleep(2000);
            UpdaterService.CreateBaseBackup();

            UpdaterStatus.Status = "Create source backup ...";
            //System.Threading.Thread.Sleep(2000);
            UpdaterService.CreateCodeBackup();

            //3. скачваем последнюю версию двига и обновляем
            UpdaterStatus.Status = "Create source backup ...";
            //System.Threading.Thread.Sleep(2000);
            UpdaterService.UpdateAvantshop();


            UpdaterStatus.IsProcess = false;
            return(string.Empty);
        }
        public void Should_return_updater_settings()
        {
            var unpacker           = new Mock <IUnpacker>();
            var mapper             = new Mock <IMapper>();
            var preferencesService = new Mock <IPreferencesService>();

            mapper.Setup(s => s.Map <IUpdateSettings>(It.IsAny <IPreferences>())).Returns((IPreferences o) =>
            {
                return(new UpdateSettings()
                {
                    AutoUpdates = o.AutoUpdates,
                    CheckForPrerelease = o.CheckForPrerelease
                });
            });
            SetupMocks(preferencesService);

            var service = new UpdaterService(unpacker.Object, preferencesService.Object, new Mock <IStorageProvider>().Object, mapper.Object);
            var result  = service.Get();

            result.CheckForPrerelease.Should().BeFalse();
            result.AutoUpdates.Should().BeTrue();
        }
Exemple #21
0
        public static void CheckForUpdates(bool forceInstallUpdate)
        {
            try
            {
                bool ignoreUpdates = Environment.GetCommandLineArgs().Contains(UpdaterService.IgnoreUpdatesArg);
                if (!ignoreUpdates)
                {
                    if ((!forceInstallUpdate) && (Settings.UpdatingMode == Settings.UpdatingModeType.Disabled))
                    {
                        return;
                    }

                    // Necessary to stablish SSL connection with Github API
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls |
                                                           (SecurityProtocolType)768 | (SecurityProtocolType)3072;

                    // We will only show one error even if it cannot check the two updates
                    WebException webException = null;

                    UpdaterService.GithubRelease release = null;
                    bool hasProgramUpdate = false;
                    try
                    {
                        hasProgramUpdate = UpdaterService.HasProgramUpdate(out release);
                    }
                    catch (WebException ex)
                    {
                        webException = ex;
                    }
                    catch (Exception ex)
                    {
                        MessageDisplay.ShowException(ex);
                        return;
                    }

                    if (hasProgramUpdate)
                    {
                        bool update = true;
                        if ((!forceInstallUpdate) && (Settings.UpdatingMode == Settings.UpdatingModeType.AutoCheck))
                        {
                            update = MessageBox.Show(Settings.GetLanguageString("UpdateAvailableText"),
                                                     Settings.GetLanguageString("UpdateAvailableTitle"), MessageBoxButton.YesNo) == MessageBoxResult.Yes;
                        }

                        if (update)
                        {
                            string updaterPath            = Path.Combine(Settings.TempFolderPath, "SporeModManagerSetup.exe");
                            bool   updateDownloadFinished = false;

                            /*while ((!File.Exists(updaterPath)) || Permissions.IsFileLocked(updaterPath) || (!updateDownloadFinished))
                             * { }*/

                            var progressDialog = GetProgressDialog(Settings.GetLanguageString("UpdatingProgressText"), (s, e) =>
                            {
                                /*Thread prgThread = new Thread(() =>
                                 * {*/
                                updateDownloadFinished = UpdaterService.UpdateProgram(release, (s_, e_) =>
                                {
                                    (s as BackgroundWorker).ReportProgress(e_.ProgressPercentage);
                                });

                                /*});
                                 * prgThread.Start();*/
                            });
                            progressDialog.ShowDialog();

                            if (progressDialog.Error != null)
                            {
                                MessageDisplay.ShowException(progressDialog.Error);
                                return;
                            }

                            while (Permissions.IsFileLocked(updaterPath))
                            {
                            }
                            Process.Start(updaterPath, "--update \"" + Path.GetDirectoryName(Process.GetCurrentProcess().GetExecutablePath()) + "\" \"" + Process.GetCurrentProcess().GetExecutablePath() + "\" --lang:" + Settings.CurrentLanguageCode);
                            Process.GetCurrentProcess().Kill();
                        }
                    }

                    //TODO remember to restore this
                    webException = null;

                    bool hasDllsUpdate = false;
                    try
                    {
                        hasDllsUpdate = UpdaterService.HasDllsUpdate(out release);
                    }
                    catch (WebException ex)
                    {
                        webException = ex;
                    }
                    catch (Exception ex)
                    {
                        MessageDisplay.ShowException(ex);
                        return;
                    }

                    if (webException != null)
                    {
                        MessageBox.Show(Settings.GetLanguageString("Error_CannotCheckForUpdates") + "\n" + webException.ToString(), Settings.GetLanguageString("Error_CannotCheckForUpdatesTitle"));
                        return;
                    }

                    if (hasDllsUpdate)
                    {
                        // If we reach this point with a program update available, it means it didn't update
                        // (as the update restarts the program), so we cannot continue
                        if (hasProgramUpdate)
                        {
                            MessageBox.Show(Settings.GetLanguageString("Error_UpdateAvailableDlls"),
                                            Settings.GetLanguageString("Error_UpdateAvailableDllsTitle"));
                        }
                        else
                        {
                            bool update = true;
                            if (Settings.UpdatingMode == Settings.UpdatingModeType.AutoCheck)
                            {
                                update = MessageBox.Show(Settings.GetLanguageString("UpdateAvailableDllsText"),
                                                         Settings.GetLanguageString("UpdateAvailableDllsTitle"), MessageBoxButton.YesNo) == MessageBoxResult.Yes;
                            }

                            if (update)
                            {
                                var progressDialog = GetProgressDialog(Settings.GetLanguageString("UpdatingProgressDllsText"), (s, e) =>
                                {
                                    UpdaterService.UpdateDlls(release, (s_, e_) =>
                                    {
                                        (s as BackgroundWorker).ReportProgress(e_.ProgressPercentage);
                                    });
                                });
                                progressDialog.ShowDialog();

                                if (progressDialog.Error != null)
                                {
                                    MessageDisplay.ShowException(progressDialog.Error);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ShowExceptionNoExit(ex);
            }
        }
Exemple #22
0
        public Client(Guid sessionid, ClientAppHostEnvironment host, UpdaterService updater)
        {
            if (Interactive.Client.CommandLineTool.TestDriver.ShouldRun)
            {
                return;
            }

            PreferenceStore.Default.Subscribe(ObservePreferenceChange);

            try {
                if (!Prefs.Telemetry.Enabled.GetValue())
                {
                    Log.Info(TAG, "Telemetry is disabled");
                    return;
                }

                // InMemoryChannel is the default channel, but we set it up manually here so we can tweak several
                // default settings that are undesirable for desktop apps.
                channel = new InMemoryChannel {
                    // Defaults to 30s, but since we are changing buffer.Capacity to 1, we can make this infinite and
                    // avoid pointlessly waking up InMemoryTransmitter's Runner.
                    SendingInterval = Timeout.InfiniteTimeSpan,
                };

                // There is no reasonable public API for changing the buffer capacity at this time.
                // You can achieve it by turning on DeveloperMode, but that has other consequences.
                // So we reflect.
                //
                // The default Capacity is 500, which is far too large for us (and perhaps most non-server apps).
                // We want to avoid having to perform a blocking Flush call on the UI thread, and since our events
                // are currently few and far between, we set Capacity to 1 to essentially get auto-flush.
                var channelBuffer = typeof(InMemoryChannel)
                                    .GetField("buffer", BindingFlags.NonPublic | BindingFlags.Instance)
                                    .GetValue(channel);
                channelBuffer
                .GetType()
                .GetProperty("Capacity", BindingFlags.Public | BindingFlags.Instance)
                .SetValue(channelBuffer, 1);

                var config = new TelemetryConfiguration("@TELEMETRY_INSTRUMENTATION_KEY@", channel);

                appInsightsClient = new TelemetryClient(config);

                appInsightsClient.Context.Session.Id             = sessionid.ToString();
                appInsightsClient.Context.Device.OperatingSystem = host.OSName.ToString();

                // TODO: Make these GlobalProperties when we bump to 2.7.0-beta3 or later
                var globalProperties = appInsightsClient.Context.Properties;
                globalProperties.Add(
                    "Product Version",
                    BuildInfo.VersionString);
                globalProperties.Add(
                    "Build Hash",
                    BuildInfo.Hash);
                globalProperties.Add(
                    "OS Platform",
                    Runtime.CurrentProcessRuntime.OSPlatform.ToString());
                globalProperties.Add(
                    "OS Architecture",
                    RuntimeInformation.OSArchitecture.ToString());
                globalProperties.Add(
                    "Process Architecture",
                    Runtime.CurrentProcessRuntime.Architecture.ToString());
                globalProperties.Add(
                    "Runtime Identifier",
                    Runtime.CurrentProcessRuntime.RuntimeIdentifier);
                globalProperties.Add(
                    "OS Version",
                    host.OSVersion.ToString());
                globalProperties.Add(
                    "Release Candidate Level",
                    ((byte)BuildInfo.Version.CandidateLevel).ToString());
                globalProperties.Add(
                    "Release Candidate Level Name",
                    BuildInfo.Version.CandidateLevel.ToString().ToLowerInvariant());
                globalProperties.Add(
                    "Machine ID",
                    Sha256Hasher.Hash(MacAddressGetter.GetMacAddress()));
                globalProperties.Add(
                    "Update Channel", updater.UpdateChannel);

                enabled = true;
            } catch (Exception e) {
                LogErrorWithoutTelemetry(e, "Unable to create AppInsights client for telemetry");
            }
        }
Exemple #23
0
    protected void btnCompareBase_OnClick(object sender, EventArgs e)
    {
        var report = UpdaterService.CompareBaseVersions();

        ltrlReport.Text = !string.IsNullOrEmpty(report) ? report : "Versions of the base are the same";
    }
        public AlohaService()
        {
            LogHelper.Configure();
            log = LogHelper.GetLogger();
            if (!MapperInited)
            {
                try
                {
                    Mapper.Initialize(cfg =>
                    {
                        //cfg.CreateMap<ServiceDataContracts.Dish, Entities.Dish>().ReverseMap();
                        cfg.CreateMap <ServiceDataContracts.Dish, Entities.Dish>().ReverseMap();
                        cfg.CreateMap <ServiceDataContracts.DishPackageToGoOrder, Entities.DishPackageToGoOrder>()
                        .ForMember(m => m.Dish, opt => opt.Ignore())
                        .ForMember(m => m.OrderToGo, opt => opt.Ignore());

                        cfg.CreateMap <Entities.DishPackageToGoOrder, ServiceDataContracts.DishPackageToGoOrder>()
                        .ForMember(m => m.Dish, opt => opt.Ignore())
                        .ForMember(m => m.OrderToGo, opt => opt.Ignore());


                        cfg.CreateMap <ServiceDataContracts.DishPackageFlightOrder, Entities.DishPackageFlightOrder>()
                        .ForMember(m => m.Dish, opt => opt.Ignore())
                        .ForMember(m => m.OrderFlight, opt => opt.Ignore())
                        .ReverseMap();

                        cfg.CreateMap <ServiceDataContracts.User, Entities.User>()
                        .ForMember(m => m.UserRole, opt => opt.Ignore())
                        //.ForMember(m => m.OrderFlight, opt => opt.Ignore())
                        .ReverseMap();

                        /*
                         * cfg.CreateMap<ServiceDataContracts.OrderToGo, Entities.OrderToGo>()
                         * //.ForMember(m => m., opt => opt.Ignore())
                         * //.ForMember(m => m.OrderFlight, opt => opt.Ignore())
                         * .ReverseMap();
                         */
                        cfg.CreateMap <ServiceDataContracts.Driver, Entities.Driver>()
                        .ReverseMap();


                        cfg.CreateMap <ServiceDataContracts.OrderFlight, Entities.OrderFlight>()
                        .ForMember(m => m.AirCompany, opt => opt.Ignore())
                        .ForMember(m => m.ContactPerson, opt => opt.Ignore())
                        .ForMember(m => m.CreatedBy, opt => opt.Ignore())
                        .ForMember(m => m.DeliveryPlace, opt => opt.Ignore())
                        .ForMember(m => m.PaymentType, opt => opt.Ignore())
                        .ForMember(m => m.SendBy, opt => opt.Ignore())
                        .ForMember(m => m.WhoDeliveredPersonPerson, opt => opt.Ignore())
                        .ReverseMap();

                        cfg.CreateMap <ServiceDataContracts.OrderToGo, Entities.OrderToGo>()
                        .ForMember(m => m.DishPackages, opt => opt.MapFrom(a => a.DishPackages.ToList()))

                        //.ForMember(m => m.DishPackages, a=> a.MapFrom<List<Entities.DishPackageToGoOrder>, List<ServiceDataContracts.DishPackageToGoOrder>>(a.))
                        .ReverseMap();


                        cfg.CreateMap <ServiceDataContracts.OrderCustomer, Entities.OrderCustomer>()
                        .ReverseMap();
                        cfg.CreateMap <ServiceDataContracts.OrderCustomerPhone, Entities.OrderCustomerPhone>()
                        .ReverseMap();
                        cfg.CreateMap <ServiceDataContracts.OrderCustomerAddress, Entities.OrderCustomerAddress>()
                        .ReverseMap();
                        cfg.CreateMap <ServiceDataContracts.OrderCustomerInfo, Entities.OrderCustomerInfo>()
                        .ReverseMap();
                    });

                    //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.DishPackageFlightOrder, Entities.DishPackageFlightOrder>().ReverseMap());
                    //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.DishPackageToGoOrder, Entities.DishPackageToGoOrder>().ReverseMap());

                    //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.Dish, Entities.Dish>().ReverseMap());
                    //Mapper.Initialize(cfg => cfg.CreateMap<Entities.Dish, ServiceDataContracts.Dish>());

                    MapperInited = true;
                    log.Debug("Mapper.Initialize ok");
                }
                catch (Exception e)
                {
                    log.Error("Mapper.Initialize error " + e.Message);
                }
            }
            userService          = new UserService(new AlohaDb());
            orderService         = new OrderService(new AlohaDb());
            airCompanyService    = new AirCompanyService(new AlohaDb());
            userGroupService     = new UserGroupService(new AlohaDb());
            contactPersonService = new ContactPersonService(new AlohaDb());

            curierService                 = new CurierService(new AlohaDb());
            deliveryPersonService         = new DeliveryPersonService(new AlohaDb());
            deliveryPlaceService          = new DeliveryPlaceService(new AlohaDb());
            marketingChannelService       = new MarketingChannelService(new AlohaDb());
            dishPackageFlightOrderService = new DishPackageFlightOrderService(new AlohaDb());
            dishPackageToGoOrderService   = new DishPackageToGoOrderService(new AlohaDb());
            dishService                 = new DishService(new AlohaDb());
            driverService               = new DriverService(new AlohaDb());
            itemLabelInfoService        = new ItemLabelInfoService(new AlohaDb());
            orderCustomerService        = new OrderCustomerService(new AlohaDb());
            orderFlightService          = new OrderFlightService(new AlohaDb());
            orderToGoService            = new OrderToGoService(new AlohaDb());
            discountService             = new DiscountService(new AlohaDb());
            alertService                = new AlertService(new AlohaDb());
            paymentService              = new PaymentService(new AlohaDb());
            paymentGroupService         = new PaymentGroupService(new AlohaDb());
            dishLogicGroupService       = new DishLogicGroupService(new AlohaDb());
            dishKitchenGroupService     = new DishKitchenGroupService(new AlohaDb());
            logItemService              = new LogItemService(new AlohaDb());
            orderCustomerAddressService = new OrderCustomerAddressService(new AlohaDb());
            orderCustomerPhoneService   = new OrderCustomerPhoneService(new AlohaDb());
            updaterService              = new UpdaterService(new AlohaDb());
        }
Exemple #25
0
 private Release LoadLastRelease() => UpdaterService.GetLastRelease();
Exemple #26
0
 public UpdaterViewModel(UpdaterService updaterService)
 {
     // Events
     updaterService.ProgressChanged += (sender, args) => Progress = args.Progress;
 }
Exemple #27
0
 public bool IsCurrentRelease() => UpdaterService.IsCurrent(InstallerModel.LastRelease);