예제 #1
0
        private void miCreateExe_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                foreach (var oItem in lvSW.SelectedItems)
                {
                    try
                    {
                        SWUpdate oSW = null;
                        if (oItem.GetType() == typeof(GetSoftware))
                        {
                            GetSoftware dgr = oItem as GetSoftware;
                            //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
                            oSW = new SWUpdate(dgr.ProductName, dgr.ProductVersion, dgr.Manufacturer);
                        }

                        if (oItem.GetType() == typeof(AddSoftware))
                        {
                            AddSoftware dgr = oItem as AddSoftware;
                            //sPS = GetSWInstallPS(dgr.ProductName, dgr.ProductVersion, "");
                            oSW = new SWUpdate(dgr);
                        }

                        CreateExe oExe = new CreateExe(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, oSW.SW.ShortName + "_setup.exe"));

                        //Get Icon if missing
                        if (oSW.SW.Image == null)
                        {
                            oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash);
                        }

                        oExe.Icon = oSW.SW.Image;
                        oExe.Sources.Add(Properties.Resources.Source.Replace("RZRZRZ", oSW.SW.ShortName));
                        oExe.Sources.Add(Properties.Resources.RZUpdate);
                        oExe.Sources.Add(Properties.Resources.RZRestApi);
                        oExe.Sources.Add(Properties.Resources.Assembly.Replace("RZRZRZ", oSW.SW.ShortName));

                        if (!oExe.Compile())
                        {
                            MessageBox.Show("Failed to create .Exe", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                        else
                        {
                            MessageBox.Show(oSW.SW.ShortName + "_setup.exe" + " created in: " + AppDomain.CurrentDomain.BaseDirectory, "EXE created", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                    catch { }
                }
            }
            finally
            {
                Mouse.OverrideCursor = null;
            }
        }
예제 #2
0
        void oInstPanel_onEdit(object sender, EventArgs e)
        {
            AnonymousDelegate update = delegate()
            {
                try
                {
                    bool bNoPreReqCheck = false;
                    if (sender.GetType() == typeof(GetSoftware))
                    {
                        GetSoftware oSelectedItem = (GetSoftware)sender;

                        //Ignore PreRequisites if SHIFT is pressed
                        if (Keyboard.Modifiers == ModifierKeys.Shift)
                        {
                            bNoPreReqCheck = true;
                        }

                        //Load Software details for a valid DeploymentType...
                        SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);

                        //get Icon
                        if (oSW.SW != null)
                        {
                            oSW.SW.Image = RZRestAPIv2.GetIcon(oSW.SW.IconHash);

                            oNewPanel.OpenXML(oSW.SW);
                        }
                        tabNewSWSMI.Tag        = tabWizard.SelectedItem;
                        tabWizard.SelectedItem = tabNewSWSMI;
                    }

                    if (sender.GetType() == typeof(AddSoftware))
                    {
                        AddSoftware oSelectedItem = (AddSoftware)sender;

                        //Ignore PreRequisites if SHIFT is pressed
                        if (Keyboard.Modifiers == ModifierKeys.Shift)
                        {
                            bNoPreReqCheck = true;
                        }

                        //Load Software details for a valid DeploymentType...
                        SWUpdate oSW = new SWUpdate(oSelectedItem.ProductName, oSelectedItem.ProductVersion, oSelectedItem.Manufacturer, bNoPreReqCheck);

                        oNewPanel.OpenXML(oSW.SW);

                        tabNewSWSMI.Tag        = tabWizard.SelectedItem;
                        tabWizard.SelectedItem = tabNewSWSMI;
                    }
                }
                catch { }
            };

            Dispatcher.Invoke(update);
        }