Ejemplo n.º 1
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (ReferenceObject.Expression != null)
            {
                targetCommand.AddParameter("ReferenceObject", ReferenceObject.Get(context));
            }

            if (DifferenceObject.Expression != null)
            {
                targetCommand.AddParameter("DifferenceObject", DifferenceObject.Get(context));
            }

            if (SyncWindow.Expression != null)
            {
                targetCommand.AddParameter("SyncWindow", SyncWindow.Get(context));
            }

            if (Property.Expression != null)
            {
                targetCommand.AddParameter("Property", Property.Get(context));
            }

            if (ExcludeDifferent.Expression != null)
            {
                targetCommand.AddParameter("ExcludeDifferent", ExcludeDifferent.Get(context));
            }

            if (IncludeEqual.Expression != null)
            {
                targetCommand.AddParameter("IncludeEqual", IncludeEqual.Get(context));
            }

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (Culture.Expression != null)
            {
                targetCommand.AddParameter("Culture", Culture.Get(context));
            }

            if (CaseSensitive.Expression != null)
            {
                targetCommand.AddParameter("CaseSensitive", CaseSensitive.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Ejemplo n.º 2
0
        public MainWindowPage()
        {
            InitializeComponent();

            _timer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(500)
            };
            _timer.Tick += TimerOnTick;

            BackgroundWorker workerTimer = new BackgroundWorker();

            workerTimer.WorkerSupportsCancellation = true;
            workerTimer.DoWork += workerTimer_DoWork;
            workerTimer.RunWorkerAsync();

            Messenger.Default.Register <OpenWindowMessage>(
                this,
                message => {
                if (message.Type == WindowType.AddAppWindow)
                {
                    var addAppWindow = new AddAppWindow();
                    addAppWindow.ShowDialog();
                }
                if (message.Type == WindowType.AddAboutAppointmentWindow && message.Argument == "Load this appointment")
                {
                    var addAboutWindow = new AboutAppWindow();
                    // send initialize information after create, but before show window!
                    // send this message => initialize new check at this cycle
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.None, Argument = message.Argument, Appointment = message.Appointment
                    });
                    addAboutWindow.ShowDialog();
                }
                if (message.Type == WindowType.AddAllAppByLocationWindow)
                {
                    var addAllAppWindow = new AllAppByLocation();
                    // send initialize information after create, but before show window!
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.LoadLocations, Argument = message.Argument
                    });
                    addAllAppWindow.ShowDialog();
                }
                if (message.Type == WindowType.Sync && message.User != null)
                {
                    var addSync = new SyncWindow();
                    Messenger.Default.Send(new OpenWindowMessage {
                        Type = WindowType.None, User = message.User, Argument = message.Argument
                    });
                    addSync.ShowDialog();
                }
                if (message.Type == WindowType.CalendarFrame)
                {
                    var calendarFrameWindow = new CalendarFrame();
                    calendarFrameWindow.ShowDialog();
                }
            });
            Messenger.Default.Register <NotificationMessage>(this, message =>
            {
                if (message.Notification.Equals("CreateGroup"))
                {
                    var addGroupWindow = new AddGroupWindow();
                    addGroupWindow.ShowDialog();
                }
            });
        }
Ejemplo n.º 3
0
        public void ShowCmdWindow(string cmd, int LscId, string LscName, string LscIP, int LscPort, string LscUID, string LscPwd, int BeatInterval, int BeatDelay, string DBServer, int DBPort, string DBName, string DBUID, string DBPwd, string HisDBServer, int HisDBPort, string HisDBName, string HisDBUID, string HisDBPwd, bool Enabled)
        {
            switch (cmd)
            {
            case "Edit":
                LSCWindow.Icon      = Icon.ChartOrganisation;
                LSCWindow.Title     = "编辑信息";
                LSCIDField.Disabled = true;
                LSCStatusBar.ClearStatus();
                SaveBtn.Hide();
                EditBtn.Show();
                LSCIDField.Number        = LscId;
                LSCNameField.Text        = LscName;
                LSCIPField.Text          = LscIP;
                LSCPortField.Number      = LscPort;
                LSCUIDField.Text         = LscUID;
                LSCPwdField.Text         = LscPwd;
                BeatIntervalField.Number = BeatInterval;
                BeatDelayField.Number    = BeatDelay;
                DBIPField.Text           = DBServer;
                DBPortField.Number       = DBPort;
                DBNameField.Text         = DBName;
                DBUIDField.Text          = DBUID;
                DBPwdField.Text          = DBPwd;
                HisDBIPField.Text        = HisDBServer;
                HisDBPortField.Number    = HisDBPort;
                HisDBNameField.Text      = HisDBName;
                HisDBUIDField.Text       = HisDBUID;
                HisDBPwdField.Text       = HisDBPwd;
                EnabledCheckbox.Checked  = Enabled;
                LSCWindow.Show();
                break;

            case "Del":
                X.Msg.Confirm("确认对话框", "本操作将删除与Lsc有关的所有数据!您确定要删除吗?", new MessageBoxButtonsConfig {
                    Yes = new MessageBoxButtonConfig {
                        Handler = String.Format(@"
                            X.LSCManager.DelLsc({0},{{
                            success: function(result) {{
                                LSCPagingToolbar.doRefresh();
                            }},
                            eventMask: {{
                                showMask: true,
                                target: 'customtarget',
                                msg: '正在删除中...',
                                customTarget: LSCPanel.body.up('div')
                            }}}});", LscId),
                        Text    = "确定"
                    },
                    No = new MessageBoxButtonConfig {
                        Text = "取消"
                    }
                }).Show();
                break;

            case "Add":
                LSCWindow.Icon          = Icon.ChartOrganisationAdd;
                LSCWindow.Title         = "新增信息";
                EnabledCheckbox.Checked = false;
                LSCIDField.Disabled     = false;
                LSCStatusBar.ClearStatus();
                SaveBtn.Show();
                EditBtn.Hide();
                LSCIDField.Clear();
                LSCNameField.Clear();
                LSCIPField.Clear();
                LSCPortField.Number = LscPort;
                LSCUIDField.Clear();
                LSCPwdField.Clear();
                BeatIntervalField.Number = BeatInterval;
                BeatDelayField.Number    = BeatDelay;
                DBIPField.Clear();
                DBPortField.Number = DBPort;
                DBNameField.Clear();
                DBUIDField.Clear();
                DBPwdField.Clear();
                HisDBIPField.Clear();
                HisDBPortField.Number = HisDBPort;
                HisDBNameField.Clear();
                HisDBUIDField.Clear();
                HisDBPwdField.Clear();
                EnabledCheckbox.Checked = Enabled;
                LSCWindow.Show();
                break;

            case "Sync":
                SyncWindow.Icon   = Icon.DatabaseRefresh;
                SyncWindow.Title  = String.Format("数据同步[{0}]", LscName);
                STRadio.Checked   = true;
                SyncWindowHF.Text = LscId.ToString();
                SyncWindow.Show();
                break;

            default:
                break;
            }
        }