示例#1
0
        private void ServiceCommand(string serviceName, ServiceCommandType commandType)
        {
            Console.WriteLine(String.Format("ServiceCommand: {0}, CommandType: {1}", serviceName, commandType.ToString()));

            if (Utilities.IsInstalledWindowsService(serviceName))
            {
                ServiceController       service = new ServiceController(serviceName);
                ServiceControllerStatus stat    = ServiceControllerStatus.Running;
                try
                {
                    stat = service.Status;
                }
                catch (Exception ex)
                {
                    LogWriter.WriteLogEntry(ex);
                }

                if (commandType == ServiceCommandType.Stop)
                {
                    if (stat != ServiceControllerStatus.Stopped)
                    {
                        try
                        {
                            if (service.CanStop)
                            {
                                service.Stop();
                            }
                        }
                        catch (Exception ex)
                        {
                            LogWriter.WriteLogEntry(ex);
                        }
                    }
                }
                else if (commandType == ServiceCommandType.Start)
                {
                    if (stat != ServiceControllerStatus.Running)
                    {
                        try
                        {
                            service.Start();
                        }
                        catch (Exception ex)
                        {
                            LogWriter.WriteLogEntry(ex);
                        }
                    }
                }
            }
        }
示例#2
0
        private void ServiceCommand(ServiceCommandType commandType)
        {
            Console.WriteLine(String.Format("ServiceCommand: {0}", commandType.ToString()));
            LogWriter.WriteLogEntry(String.Format("ServiceCommand: {0}", commandType.ToString()));

            if (commandType == ServiceCommandType.Start)
            {
                StartService();
            }
            else if (commandType == ServiceCommandType.Stop)
            {
                StopService();
            }
            else if (commandType == ServiceCommandType.Restart)
            {
                StopService();
                StartService();
            }
        }
		protected virtual void ExecuteServiceCommand(MdxQueryArgs query_args, ServiceCommandType actionType)
		{
			if (query_args != null)
			{
				IsWaiting = true;
				LogManager.LogInformation(this, this.Name + " - Service command: " + actionType.ToString());
				OlapDataLoader.LoadData(query_args, actionType);
			}
		}
		private void RunServiceCommand(ServiceCommandType actionType)
		{
			if (actionType == ServiceCommandType.Refresh)
				ExportSizeInfo();

			if (DataManager != null)
			{
				switch (actionType)
				{
					case ServiceCommandType.GetDataSourceInfo:
						break;
					default:
						String query = DataManager.PerformServiceCommand(actionType);
						PivotGrid.AxisIsRotated = DataManager.CurrentHistoryItem.RotateAxes;
						if (RotateAxesButton.IsChecked != PivotGrid.AxisIsRotated)
						{
							RotateAxesButton.IsChecked = PivotGrid.AxisIsRotated;
						}
						if (!String.IsNullOrEmpty(query))
						{
							MdxQueryArgs query_args = CommandHelper.CreateMdxQueryArgs(Connection, query);
							// Export to Excel execute on server
							if (actionType == ServiceCommandType.ExportToExcel)
							{
								query_args.ActionType = OlapActionTypes.ExportToExcel;
							}

							if (actionType == ServiceCommandType.RotateAxes || actionType == ServiceCommandType.NormalAxes)
							{
								if (m_CellSetProvider != null)
									m_CellSetProvider.RotateSortInfo();
							}
							ExecuteServiceCommand(query_args, actionType);
						}
						break;
				}
			}
			//OlapDataLoader.LoadData(args, args);
		}
		protected virtual void ServiceCommandCompleted(ServiceCommandType commandType)
		{

		}
        public String PerformServiceCommand(ServiceCommandType actionType)
        {
            try
            {
                switch (actionType)
                {
                    case ServiceCommandType.Forward:
                        History.MoveNext();
                        break;
                    case ServiceCommandType.Back:
                        History.MoveBack();
                        break;
                    case ServiceCommandType.ToBegin:
                        History.ToBegin();
                        break;
                    case ServiceCommandType.ToEnd:
                        History.ToEnd();
                        break;
                    case ServiceCommandType.HideEmptyColumns:
                        HideEmptyColumns = true;
                        break;
                    case ServiceCommandType.ShowEmptyColumns:
                        HideEmptyColumns = false;
                        break;
                    case ServiceCommandType.RotateAxes:
                        RotateAxes = true;
                        break;
                    case ServiceCommandType.NormalAxes:
                        RotateAxes = false;
                        break;
                    case ServiceCommandType.HideEmptyRows:
                        HideEmptyRows = true;
                        break;
                    case ServiceCommandType.ShowEmptyRows:
                        HideEmptyRows = false;
                        break;
                    case ServiceCommandType.ExportToExcel:
                        break;
                    case ServiceCommandType.GetDataSourceInfo:
                        break;
                    default:
                        break;
                }

            }
            catch (Exception)
            {
                throw;
            }

            return RefreshQuery();
        }
 public ServiceCommandArgs(ServiceCommandType command, UpdateEntry userData) 
     : this(command)
 {
     UserData = userData;
 }
 public ServiceCommandArgs(ServiceCommandType command)
     :this()
 {
     Command = command;
 }
        public String PerformServiceCommand(ServiceCommandType actionType)
        {
            try
            {
                switch (actionType)
                {
                case ServiceCommandType.Forward:
                    History.MoveNext();
                    break;

                case ServiceCommandType.Back:
                    History.MoveBack();
                    break;

                case ServiceCommandType.ToBegin:
                    History.ToBegin();
                    break;

                case ServiceCommandType.ToEnd:
                    History.ToEnd();
                    break;

                case ServiceCommandType.HideEmptyColumns:
                    HideEmptyColumns = true;
                    break;

                case ServiceCommandType.ShowEmptyColumns:
                    HideEmptyColumns = false;
                    break;

                case ServiceCommandType.RotateAxes:
                    RotateAxes = true;
                    break;

                case ServiceCommandType.NormalAxes:
                    RotateAxes = false;
                    break;

                case ServiceCommandType.HideEmptyRows:
                    HideEmptyRows = true;
                    break;

                case ServiceCommandType.ShowEmptyRows:
                    HideEmptyRows = false;
                    break;

                case ServiceCommandType.ExportToExcel:
                    break;

                case ServiceCommandType.GetDataSourceInfo:
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(RefreshQuery());
        }
示例#10
0
        public String PerformServiceCommand(ServiceCommandType actionType)
        {
            try
            {
                switch (actionType)
                {
                case ServiceCommandType.HideEmptyColumns:
                case ServiceCommandType.ShowEmptyColumns:
                case ServiceCommandType.RotateAxes:
                case ServiceCommandType.NormalAxes:
                case ServiceCommandType.HideEmptyRows:
                case ServiceCommandType.ShowEmptyRows:
                    AddCurrentStateToHistory();
                    break;

                default:
                    break;
                }

                switch (actionType)
                {
                case ServiceCommandType.Forward:
                    this.MoveNext();
                    break;

                case ServiceCommandType.Back:
                    this.MoveBack();
                    break;

                case ServiceCommandType.ToBegin:
                    this.ToBegin();
                    break;

                case ServiceCommandType.ToEnd:
                    this.ToEnd();
                    break;

                case ServiceCommandType.HideEmptyColumns:
                    this.CurrentHistoryItem.ColumnsActionChain.HideEmpty = true;
                    break;

                case ServiceCommandType.ShowEmptyColumns:
                    this.CurrentHistoryItem.ColumnsActionChain.HideEmpty = false;
                    break;

                case ServiceCommandType.RotateAxes:
                    this.CurrentHistoryItem.RotateAxes = true;
                    break;

                case ServiceCommandType.NormalAxes:
                    this.CurrentHistoryItem.RotateAxes = false;
                    break;

                case ServiceCommandType.HideEmptyRows:
                    this.CurrentHistoryItem.RowsActionChain.HideEmpty = true;
                    break;

                case ServiceCommandType.ShowEmptyRows:
                    this.CurrentHistoryItem.RowsActionChain.HideEmpty = false;
                    break;

                case ServiceCommandType.ExportToExcel:
                    break;

                case ServiceCommandType.GetDataSourceInfo:
                    break;

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(RefreshQuery());
        }
        private void RunServiceCommand(ServiceCommandType actionType)
        {
            //NEW!!! if (UseChangesCashe && PivotGrid.LocalChanges.CellChanges.Count > 0)
            //{
            //    MessageBox.Show(Localization.PivotGrid_SaveCachedChanges, Localization.MessageBox_Warning, MessageBoxButton.OK);
            //    //PopUpQuestionDialog dlg = SaveChangesDlg;
            //    //dlg.DialogClosed += new EventHandler<Ranet.AgOlap.Controls.Forms.DialogResultArgs>(RunService_SaveChanges_DialogClosed);
            //    //dlg.Tag = actionType;
            //    //dlg.Show();
            //    return;
            //}

            if (actionType == ServiceCommandType.Refresh)
                ExportSizeInfo();

            if (DataManager != null)
            {
                switch (actionType)
                {
                    case ServiceCommandType.GetDataSourceInfo:
                        break;
                    default:
                        String query = DataManager.PerformServiceCommand(actionType);
                        if (!String.IsNullOrEmpty(query))
                        {
                            MdxQueryArgs query_args = CommandHelper.CreateMdxQueryArgs(Connection, query);
                            // Export to Excel execute on server
                            if (actionType == ServiceCommandType.ExportToExcel)
                            {
                                query_args.ActionType = OlapActionTypes.ExportToExcel;
                            }

                            ExecuteServiceCommand(query_args, actionType);
                        }
                        break;
                }
            }
            //OlapDataLoader.LoadData(args, args);
        }
 public ServiceCommandArgs(ServiceCommandType command, UpdateEntry userData)
     : this(command)
 {
     UserData = userData;
 }
 public ServiceCommandArgs(ServiceCommandType command)
     : this()
 {
     Command = command;
 }
示例#14
0
        public void CommandArgs(string[] args)
        {
            for (int idx = 0; idx < args.Length; idx++)
            {
                if (args[idx].ToUpper().Contains(CommandType.SETTING.ToString()))
                {
                    Setting();
                }
                else if (args[idx].ToUpper().Contains(CommandType.MANUAL.ToString()))
                {
                    Manual();
                }
                else if (args[idx].ToUpper().Contains(CommandType.INFO.ToString()))
                {
                    SystemInformations();
                }
                else if (args[idx].ToUpper().Contains(CommandType.UNINSTALL.ToString()))
                {
                    TaskKill();
                    UnReg();
                    RemoveAllFiles();
                }
                else if (args[idx].ToUpper().Contains(CommandType.INSTALL.ToString()))
                {
                    Reg();

                    if (_VMSType.ToUpper() == VMSType.INCON.ToString() || _VMSType.ToUpper() == ("TRIUM i").ToUpper())
                    {
                        SetSkin("2");
                    }
                    else if (_VMSType.ToUpper() == VMSType.WatzEyeVMS.ToString())
                    {
                        SetSkin("4");
                    }

                    StartInstallSundance();
                    LogWriter.WriteLogEntry(CommandType.INSTALL.ToString());
                }
                else if (args[idx].ToUpper().Contains(CommandType.REG.ToString()))
                {
                    Reg();
                    LogWriter.WriteLogEntry(CommandType.REG.ToString());
                }
                else if (args[idx].ToUpper().Contains(CommandType.UNREG.ToString()))
                {
                    UnReg();
                    LogWriter.WriteLogEntry(CommandType.UNREG.ToString());
                }
                else if (args[idx].ToUpper().Contains(CommandType.TASKKILL.ToString()))
                {
                    TaskKill();
                    LogWriter.WriteLogEntry(CommandType.TASKKILL.ToString());
                }
                else if (args[idx].ToUpper().Contains(CommandType.SHORCUTSERVER.ToString()))
                {
                    ShorCutServer();
                    LogWriter.WriteLogEntry(CommandType.SHORCUTSERVER.ToString());
                }
                else if (args[idx].ToUpper().Contains(CommandType.GETSKIN.ToString()))
                {
                    GetSkin();
                }
                else if (args[idx].ToUpper().Contains(CommandType.SETSKIN.ToString()))
                {
                    if (idx == 0 && args.Length > 1)
                    {
                        SetSkin(args[1]);
                        LogWriter.WriteLogEntry(CommandType.SETSKIN.ToString());
                    }
                }
                else if (args[idx].ToUpper().Contains(CommandType.HELP.ToString()) || args[idx].ToUpper().Contains("?"))
                {
                    Info();
                }
                else if (args[idx].ToUpper().Contains(CommandType.SERVICE.ToString()))
                {
                    if (idx == 0 && args.Length > 1)
                    {
                        ServiceCommandType commandType = ServiceCommandType.Start;
                        if (args[1].ToUpper() == ServiceCommandType.Restart.ToString().ToUpper())
                        {
                            commandType = ServiceCommandType.Restart;
                        }
                        else if (args[1].ToUpper() == ServiceCommandType.Stop.ToString().ToUpper())
                        {
                            commandType = ServiceCommandType.Stop;
                        }
                        ServiceCommand(commandType);
                    }
                }
            }
        }