Ejemplo n.º 1
0
        /// <summary>
        /// Saves all assemblies and returns true if all assemblies were saved to disk
        /// </summary>
        /// <param name="asms">All assemblies to save</param>
        /// <returns></returns>
        public static bool SaveAssemblies(IEnumerable<LoadedAssembly> asms)
        {
            var asmsAry = asms.ToArray();
            if (asmsAry.Length == 0)
                return true;

            if (asmsAry.Length == 1) {
                var optsData = new SaveModuleOptionsVM(asmsAry[0].ModuleDefinition);
                var optsWin = new SaveModuleOptions();
                optsWin.Owner = MainWindow.Instance;
                optsWin.DataContext = optsData;
                var res = optsWin.ShowDialog();
                if (res != true)
                    return false;

                var data = new SaveMultiModuleVM(optsData);
                var win = new SaveSingleModule();
                win.Owner = MainWindow.Instance;
                win.DataContext = data;
                data.Save();
                win.ShowDialog();
                return MarkAsSaved(data, asmsAry);
            }
            else {
                var data = new SaveMultiModuleVM(asmsAry.Select(a => a.ModuleDefinition));
                var win = new SaveMultiModule();
                win.Owner = MainWindow.Instance;
                win.DataContext = data;
                win.ShowDialog();
                return MarkAsSaved(data, asmsAry);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Saves all assemblies and returns true if all assemblies were saved to disk
        /// </summary>
        /// <param name="asms">All assemblies to save</param>
        /// <returns></returns>
        public static bool SaveAssemblies(IEnumerable <LoadedAssembly> asms)
        {
            var asmsAry = asms.ToArray();

            if (asmsAry.Length == 0)
            {
                return(true);
            }

            if (asmsAry.Length == 1)
            {
                var optsData = new SaveModuleOptionsVM(asmsAry[0].ModuleDefinition);
                var optsWin  = new SaveModuleOptions();
                optsWin.Owner       = MainWindow.Instance;
                optsWin.DataContext = optsData;
                var res = optsWin.ShowDialog();
                if (res != true)
                {
                    return(false);
                }

                var data = new SaveMultiModuleVM(optsData);
                var win  = new SaveSingleModule();
                win.Owner       = MainWindow.Instance;
                win.DataContext = data;
                data.Save();
                win.ShowDialog();
                return(MarkAsSaved(data, asmsAry));
            }
            else
            {
                var data = new SaveMultiModuleVM(asmsAry.Select(a => a.ModuleDefinition));
                var win  = new SaveMultiModule();
                win.Owner       = MainWindow.Instance;
                win.DataContext = data;
                win.ShowDialog();
                return(MarkAsSaved(data, asmsAry));
            }
        }