Esempio n. 1
0
 public FrameworkFormEx()
 {
     Load              += new EventHandler(FormEx_Load);
     m_invoker          = new ControlInvoker(this);
     Usage              = new UsageBuilder(UsageEventName);
     HUsage.ClosingApp += HUsage_ClosingApp;
 }
Esempio n. 2
0
 public virtual void GetUsageParams(UsageBuilder usage)
 {
     usage["args"] = Args.Count.ToString();
     if (Args.Count >= 1)
     {
         usage["objtype0"] = Args[0] != null ? Args[0].GetType().FullName : "null";
         usage["obj0"]     = Args[0].SafeToString();
     }
 }
Esempio n. 3
0
 protected void ReportUnknownType(string dt)
 {
     using (var ub = new UsageBuilder("warning:unknown_db_type"))
     {
         m_conn.FillInfo(ub.Params);
         ub["data_type"] = dt;
         ub["analyser"]  = GetType().FullName;
     }
     Logging.Info("Unknown database type:" + dt);
 }
Esempio n. 4
0
        public static Job FromCommand(JobCommand command, JobProperties jobProps)
        {
            Job res = new Job();

            res.m_jobProps = jobProps;
            res.AddCommand(command);
            using (var ub = new UsageBuilder("create_job:" + command.GetType().FullName))
            {
                command.GetUsageParams(ub);
            }
            return(res);
        }
Esempio n. 5
0
 public ContentFrame()
 {
     Usage              = new UsageBuilder(UsageEventName);
     PersistString      = Guid.NewGuid().ToString();
     m_invoker          = new ControlInvoker(this);
     m_readDetailFrames = new ReadOnlyCollection <ContentFrame>(m_detailFrames);
     ConnPack           = new ConnectionPack(this);
     Disposed          += ContentFrame_Disposed;
     InitializeComponent();
     HConnection.RemoveByKey += HConnection_RemoveByKey;
     HUsage.ClosingApp       += HUsage_ClosingApp;
 }
Esempio n. 6
0
 private void DoRun()
 {
     m_reportEnv.OnStart();
     using (var ub = new UsageBuilder("process"))
     {
         try
         {
             try
             {
                 SetState(ProcessState.Running);
                 ProcessRegister.OnStartedProcess(this);
                 Logging.Debug("Starting process {0}", Title);
                 this.LogMessage("s_process", LogLevel.Info, Texts.Get("s_process_started"));
                 Run();
                 this.LogMessage("s_process", LogLevel.Info, Texts.Get("s_process_finished"));
                 SetState(ProcessState.Finished);
                 Logging.Debug("Process {0} finished succesfully", Title);
             }
             finally
             {
                 m_curWork = "s_finished";
                 HProcess.CallFinishedProcess(this);
                 m_finished   = DateTime.Now;
                 ub["result"] = "ok";
             }
         }
         catch (Exception e)
         {
             m_failError = e;
             this.LogError(e);
             //this.LogMessage("s_process", LogLevel.Error, Errors.ExtractMessage(e));
             this.LogMessage("s_process", LogLevel.Error, Texts.Get("s_process_failed"));
             Logging.Error("Error when running process {0}, process finished abnormally", Title);
             SetState(ProcessState.Error_Finished);
             ub["result"] = "error";
             ub["error"]  = e.Message;
             //Errors.Report(e);
         }
     }
     if (OnFinish != null)
     {
         OnFinish();
     }
     m_reportEnv.OnFinish();
     m_reportEnv.Dispose();
 }
Esempio n. 7
0
        void res_Click(object sender, EventArgs e)
        {
            if (Callable != null)
            {
                using (var ub = new UsageBuilder("popup"))
                {
                    Callable.Call(MultiMode);

                    Callable.GetUsageParams(ub);
                    if (BaseObject != null)
                    {
                        ub["objtype"] = BaseObject.GetType().FullName;
                        ub["baseobj"] = BaseObject.SafeToString();
                    }
                    ub["path"] = Path;
                }
            }
        }
Esempio n. 8
0
        public void OnClickNoArg()
        {
            using (var ub = new UsageBuilder("dragdrop"))
            {
                if (m_baseObject != null)
                {
                    ub["dsttype"] = m_baseObject.GetType().FullName;
                    ub["dstobj"]  = m_baseObject.SafeToString();
                }
                ub["name"]   = m_attr.Name;
                ub["method"] = m_mtd.Name;

                ub["dragargs"] = Args.Count.ToString();
                if (Args.Count >= 1)
                {
                    ub["dragtype0"] = Args[0] != null ? Args[0].GetType().FullName : "null";
                    ub["drag0"]     = Args[0].SafeToString();
                }
            }
            switch (m_attr.MultiMode)
            {
            case MultipleMode.NativeMulti:
                m_mtd.Invoke(m_baseObject, new object[] { Args.ToArray() });
                break;

            case MultipleMode.Sequencable:
            case MultipleMode.SingleOnly:
                foreach (var arg in Args)
                {
                    m_mtd.Invoke(m_baseObject, new object[] { arg });
                    if (m_attr.MultiMode == MultipleMode.SingleOnly)
                    {
                        break;
                    }
                }
                break;
            }
        }
Esempio n. 9
0
 public override void GetUsageParams(UsageBuilder ub)
 {
     ub["src"]         = m_src.SafeToString();
     ub["format_type"] = m_format != null?m_format.GetType().FullName : "";
 }
Esempio n. 10
0
 public override void GetUsageParams(UsageBuilder ub)
 {
     ub["loader"] = m_loader.SafeToString();
     ub["dst"]    = m_dst.SafeToString();
 }
Esempio n. 11
0
 public override void GetUsageParams(UsageBuilder ub)
 {
     ub["backuptype"] = m_backup.SafeToString();
     ub["dst"]        = m_dst.SafeToString();
 }
Esempio n. 12
0
        public virtual void Run(IJobRunEnv env)
        {
            JobReportEnvBase repenv = null;

            if (m_job.Root != this)
            {
                repenv = CreateReportEnv();
            }
            if (repenv != null)
            {
                try
                {
                    env.SetReportEnv(GroupId, repenv);
                    repenv.OnStart();
                }
                catch (Exception err)
                {
                    ProgressInfo.Warning("Error initializing reports:" + err.Message);
                }
            }
            try
            {
                using (var ub = new UsageBuilder(UsageEventName))
                {
                    GetUsageParams(ub);

                    try
                    {
                        if (m_job.m_process != null)
                        {
                            JobCommand oldcmd = m_job.m_process.CurrentCommand;
                            try
                            {
                                m_job.m_process.CurrentCommand = this;
                                DoRun(env);
                            }
                            finally
                            {
                                m_job.m_process.CurrentCommand = oldcmd;
                                // close connections
                                ConnPack = null;
                            }
                        }
                        else
                        {
                            try
                            {
                                DoRun(env);
                            }
                            finally
                            {
                                // close connections
                                ConnPack = null;
                            }
                        }
                        ub["result"] = "ok";
                    }
                    catch (Exception err)
                    {
                        ub["result"] = "error";
                        ub["error"]  = err.Message;
                        throw;
                    }
                }
            }
            finally
            {
                if (repenv != null)
                {
                    try
                    {
                        repenv.OnFinish();
                    }
                    catch (Exception err)
                    {
                        ProgressInfo.Warning("Error finishing reports:" + err.Message);
                    }
                    try
                    {
                        repenv.Dispose();
                    }
                    catch (Exception err)
                    {
                        ProgressInfo.Warning("Error disposing reports:" + err.Message);
                    }
                }
            }
        }
Esempio n. 13
0
 public virtual void GetUsageParams(UsageBuilder ub)
 {
 }
Esempio n. 14
0
 public override void GetUsageParams(UsageBuilder ub)
 {
     ub["src"] = m_source.SafeToString();
     ub["dst"] = m_target.SafeToString();
 }