Esempio n. 1
0
        public void DragDrop_CopyDatabase(AppObject draggingObject)
        {
            var conn = this.FindServerConnection();

            if (draggingObject is DatabaseAppObject)
            {
                try
                {
                    IDatabaseSource dsource = ((DatabaseAppObject)draggingObject).FindDatabaseConnection();
                    var             dbprops = new DatabaseProperties();
                    dbprops.Name = dsource.DatabaseName;
                    DatabasePropertiesForm.Run(dbprops, new GenericDatabaseSource(conn, conn.Connection, null), false);
                    //string newname = InputBox.Run(Texts.Get("s_name_of_new_database"), dsource.DatabaseName);
                    //if (newname == null) return;
                    if (ArrayTool.Contains(conn.Databases, dbprops.Name))
                    {
                        StdDialog.ShowError(Texts.Get("s_database_allready_exists"));
                        return;
                    }
                    IDatabaseSource newdb = conn.CreateDatabase(dbprops.Name, dbprops.SpecificData);
                    CopyDbWizard.Run(dsource.CloneSource(), newdb.CloneSource());
                    //CopyDbProcess.StartProcess(dsource.CloneSource(), newdb.CloneSource(), null);
                }
                catch (Exception e)
                {
                    Errors.Report(e);
                }
            }
        }
Esempio n. 2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int itwi = Width / TargetCount;

            for (int i = 0; i < TargetCount; i++)
            {
                GraphicsState       oldstate = e.Graphics.Save();
                DragObjectContainer obj      = m_memory[i];
                int x0 = itwi * i;
                e.Graphics.Clip = new Region(new Rectangle(x0, 0, itwi, Height));
                e.Graphics.DrawRectangle(Pens.Black, x0 + 2, 2, itwi - 4, Height - 4);
                if (obj != null)
                {
                    int imwi = 0;
                    if (obj.Image != null)
                    {
                        e.Graphics.DrawImage(obj.Image, x0 + 3, 3);
                        imwi = obj.Image.Width;
                    }
                    if (obj.Title != null)
                    {
                        e.Graphics.DrawString(obj.Title, Font, Brushes.Black, x0 + imwi + 4, 4);
                    }
                }
                else
                {
                    e.Graphics.DrawString(Texts.Get("s_drag_and_drop_here"), Font, Brushes.Black, x0 + 4, 4);
                }
                e.Graphics.Restore(oldstate);
            }
        }
Esempio n. 3
0
        public static bool RunLoop(Form win, AddToFavoritesFrame frame, Action updateFavorite)
        {
            for (; ;)
            {
                if (win.ShowDialogEx() == DialogResult.OK)
                {
                    if (updateFavorite != null)
                    {
                        updateFavorite();
                    }
                    var fh = frame.GetHolder();
                    if (File.Exists(fh.File))
                    {
                        var res = MessageBox.Show(Texts.Get("s_favorite_allready_exists_overwrite"), VersionInfo.ProgramTitle, MessageBoxButtons.YesNoCancel);
                        if (res == DialogResult.Yes)
                        {
                            File.Delete(fh.File);
                        }
                        else if (res == DialogResult.No)
                        {
                            return(false);
                        }
                        else
                        {
                            continue;
                        }
                    }

                    Favorites.AddLast(fh);
                    Favorites.NotifyChanged();
                    return(true);
                }
                return(false);
            }
        }
Esempio n. 4
0
        public override string GetHtml()
        {
            var hg = new HtmlGenerator();

            hg.BeginHtml("s_saved_jobs", HtmlGenerator.HtmlObjectViewStyle);
            hg.Heading("s_saved_jobs", 1);
            foreach (string fn in Directory.GetFiles(Core.JobsDirectory, "*.djb", SearchOption.AllDirectories).Sorted())
            {
                string relfn = IOTool.RelativePathTo(Core.JobsDirectory, fn);
                try
                {
                    Job job = Job.LoadFromFile(fn);
                    hg.Heading(relfn, 2);
                    hg.Write("<a href=\"callback://runjob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_run"));
                    hg.Write(" | <a href=\"callback://deletejob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_delete"));
                    RenderCommand(hg, fn, job.Root);
                    hg.HorizontalRule();
                }
                catch (Exception err)
                {
                    hg.Heading(relfn, 2);
                    hg.Write("{0}:{1}", Texts.Get("s_error"), err.Message);
                }
            }
            hg.EndHtml();
            return(hg.HtmlText);
        }
Esempio n. 5
0
        public static List <string> Run(string caption, string label, IEnumerable <string> lines, bool onlyNotEmpty)
        {
            LinesDialog   win = new LinesDialog();
            List <string> src = new List <string>();

            if (lines != null)
            {
                foreach (string l in lines)
                {
                    src.Add(l);
                }
            }
            win.tbxLines.Lines = src.ToArray();
            win.Text           = Texts.Get(caption);
            win.tbxLabel.Text  = Texts.Get(label);
            if (win.ShowDialogEx() == DialogResult.OK)
            {
                var res = new List <string>();
                foreach (string line in win.tbxLines.Lines)
                {
                    string s = line;
                    if (onlyNotEmpty)
                    {
                        s = s.Trim();
                        if (s == "")
                        {
                            continue;
                        }
                    }
                    res.Add(s);
                }
                return(res);
            }
            return(null);
        }
Esempio n. 6
0
 private void ReloadWindows()
 {
     try
     {
         m_machineChanging = true;
         lsvWindows.BeginUpdate();
         lsvWindows.Items.Clear();
         int index = 1;
         foreach (var cnt in MainWindow.Instance.GetContents())
         {
             if (cnt.ParentFrame != null)
             {
                 continue;                          // don't show child frames
             }
             var item = lsvWindows.Items.Add(Texts.Get(cnt.PageTitle));
             item.SubItems.Add(Texts.Get(cnt.PageTypeTitle));
             item.SubItems.Add(index.ToString());
             item.ImageIndex = m_imgCache.GetImageIndex(cnt.Image);
             item.Tag        = cnt;
             index++;
         }
         lsvWindows.EndUpdate();
     }
     finally
     {
         m_machineChanging = false;
     }
 }
Esempio n. 7
0
        protected override void ShowDataInGui()
        {
            try
            {
                listView1.BeginUpdate();
                listView1.Items.Clear();
                listView1.Columns.Clear();

                if (Columns != null && Columns.Count > 0)
                {
                    listView1.Columns.Clear();
                    foreach (var col in Columns)
                    {
                        var hdr = listView1.Columns.Add(Texts.Get(col.HeaderText));
                        hdr.Width = col.Width;
                    }
                }
                else
                {
                    var hdr = listView1.Columns.Add(Texts.Get("s_name"));
                    hdr.Width = 200;
                }

                ReloadItemsCore();
            }
            finally
            {
                listView1.EndUpdate();
            }
            UpdateEnabling();
        }
Esempio n. 8
0
        public ExpressionConditionNode(ConditionDesigner designer, CompoudConditionNode parent)
            : base(designer, parent)
        {
            LeftExpr = new ConditionExpressionDesigner(this, true);
            m_disposeList.Add(LeftExpr);
            Operator = new ComboBox();
            m_disposeList.Add(Operator);
            Designer.Parent.Controls.Add(Operator);
            string lastgrp = null;

            foreach (var edef in ConditionOperatorDef.CreateConditions(this))
            {
                if (lastgrp == null || edef.Factory.Group != lastgrp)
                {
                    lastgrp = edef.Factory.Group;
                    Operator.Items.Add(Texts.Get(lastgrp));
                }
                Operator.Items.Add(edef);
                m_disposeList.Add(edef);
                edef.Hide();
            }
            Operator.SelectedIndex         = 1;
            Operator.DropDownStyle         = ComboBoxStyle.DropDownList;
            Operator.SelectedIndexChanged += new EventHandler(Operator_SelectedIndexChanged);
        }
Esempio n. 9
0
 public void CancelWithQuery()
 {
     if (MessageBox.Show(Texts.Get("s_really_cancel_process"), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         Cancel();
     }
 }
Esempio n. 10
0
        public override object Rename(object item)
        {
            var    old     = (NamedAddonInstance)item;
            string newname = InputBox.Run(Texts.Get("s_new_name"), old.Name);

            return(new NamedAddonInstance(old.Instance, newname));
        }
Esempio n. 11
0
        public void UpdateRevertMenu(ToolStripDropDownButton button)
        {
            var layout = new DockingDesign();

            SaveLayout(layout);
            var mwids = layout.GetMissingWidgets(m_dashboard.m_design);

            button.Text = Texts.Get("s_revert");
            if (mwids.Count > 0)
            {
                button.Text += " (" + mwids.Count.ToString() + ")";
            }
            button.DropDownItems.Clear();
            var mb = new MenuBuilder();

            mb.AddItem(null, "s_original_design", new MenuItemData {
                Weight = -1, GroupName = "revert", Callable = new ActionCallable(RevertDesign)
            });
            foreach (var wid in mwids)
            {
                mb.AddItem(null, wid.Widget.PageTitle, new MenuItemData {
                    Weight = 1, GroupName = "widget", Callable = new ActionCallable(wid.GetOpenWidgetCallback(this)), Image = wid.Widget.Image
                });
            }
            mb.GetMenuItems(button.DropDownItems);
        }
Esempio n. 12
0
        public override void AddLogicalDependencies(AlterProcessorCaps caps, DbDiffOptions opts, List <AlterOperation> before, List <AlterOperation> after, AlterPlan plan, IDatabaseSource targetDb)
        {
            base.AddLogicalDependencies(caps, opts, before, after, plan, targetDb);

            var pk = OldObject as IPrimaryKey;

            if (pk != null)
            {
                ParentTable.LoadStructure(TableStructureMembers.ReferencedFrom, targetDb);
                foreach (var col in pk.Columns)
                {
                    foreach (ForeignKey fk in ParentTable.GetReferencedFrom())
                    {
                        bool fkdeleted = false;
                        for (int i = 0; i < fk.PrimaryKeyColumns.Count; i++)
                        {
                            if (fk.PrimaryKeyColumns[i].ColumnName == col.ColumnName)
                            {
                                fkdeleted = true;
                                break;
                            }
                        }
                        if (fkdeleted)
                        {
                            opts.AlterLogger.Warning(Texts.Get("s_dropped_reference$table$fk", "table", fk.Table.FullName, "fk", fk.Name));
                            before.Add(new AlterOperation_DropConstraint {
                                ParentTable = ParentTable, OldObject = fk
                            });
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        public override object CreateNew()
        {
            string newname = InputBox.Run(Texts.Get("s_new_name"), "new");

            if (newname == null)
            {
                return(null);
            }
            var obj = CreateNewAddon();

            if (obj == null)
            {
                return(null);
            }
            var    fitem = obj as IFileBasedAddonInstance;
            string dir   = m_adtype.GetDirectory();
            string fn    = Path.Combine(dir, newname + m_adtype.FileExtension);

            if (fitem != null)
            {
                fitem.AddonFileName = fn;
            }
            obj.SaveToFile(fn);
            return(obj);
        }
Esempio n. 14
0
            private void UpdateButton(ToolStripDropDownButton btn)
            {
                btn.DropDownItems.Clear();
                var items = Items;
                var bi    = (ButtonInfo)btn.Tag;

                if (items.Count > 0)
                {
                    btn.Enabled = true;
                    if (bi.ShowText)
                    {
                        btn.Text = String.Format("{0} ({1})", Texts.Get("s_tips"), items.Count);
                    }
                    else
                    {
                        btn.Text = String.Format("({0})", items.Count);
                    }
                    foreach (var item in items)
                    {
                        var it = btn.DropDownItems.Add(item.Title);
                        it.Tag    = item;
                        it.Click += new EventHandler(it_Click);
                    }
                    btn.ToolTipText = Texts.Get("s_online_help");
                }
                else
                {
                    btn.Enabled     = false;
                    btn.Text        = bi.ShowText ? Texts.Get("s_tips") : "";
                    btn.ToolTipText = Texts.Get("s_no_help_available");
                }
            }
Esempio n. 15
0
 public static bool CheckAbsoluteOutputFileName(string fn, string extensions)
 {
     try
     {
         if (!Path.IsPathRooted(fn))
         {
             StdDialog.ShowError("s_please_enter_full_path_to_file");
             return(false);
         }
         string dir = Path.GetDirectoryName(fn);
         if (!Directory.Exists(dir))
         {
             StdDialog.ShowError("s_output_directory_does_not_exist");
             return(false);
         }
         if (!IOTool.FileHasOneOfExtension(fn, extensions))
         {
             StdDialog.ShowError(Texts.Get("s_incorrect_file$extension", "extension", extensions.ToLower()));
             return(false);
         }
     }
     catch (Exception err)
     {
         StdDialog.ShowError(err.Message);
         return(false);
     }
     if (File.Exists(fn) && !StdDialog.ReallyOverwriteFile(fn))
     {
         return(false);
     }
     return(true);
 }
Esempio n. 16
0
 private static void TestAllowCreateStructure()
 {
     if (MessageBox.Show(Texts.Get("s_allow_create_d2dx_structure"), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) != DialogResult.Yes)
     {
         throw new Exception("DAE-00228 " + Texts.Get("s_d2dx_structure_cannot_be_created"));
     }
 }
Esempio n. 17
0
        private void UpdateTitleBar()
        {
            lbtitle.Text = m_selectedObject != null?Texts.Get(m_selectedObject.Title) : "???";

            lbtype.Text       = (m_selectedObject != null ? Texts.Get(m_selectedObject.TypeTitle) : "???") + ":";
            lbtitle.Left      = lbtype.Left + lbtype.Width + 10;
            pictureBox1.Image = m_selectedObject != null ? m_selectedObject.Image : null;

            ITreeNode act = m_selectedObject;
            var       pth = new List <ITreeNode>();

            m_titleBarLabels.DisposeAndClear();
            while (act != null && act.Parent != null)
            {
                pth.Insert(0, act.Parent);
                act = act.Parent;
            }
            if (pth.Count == 0)
            {
                panel1.Height    = hi0 - labPathRoot.Height;
                labPathRoot.Text = "";
            }
            else
            {
                labPathRoot.Text   = Texts.Get(pth[0].Title);
                labPathRoot.Tag    = pth[0].Path;
                labPathRoot.Click += labPathRoot_Click;

                const int LABDIST = 5;

                Label lastlab = labPathRoot;
                for (int i = 1; i < pth.Count; i++)
                {
                    var labsep = new Label();
                    labsep.Text = ">";
                    labPathRoot.Parent.Controls.Add(labsep);
                    labsep.Left     = lastlab.Right + LABDIST;
                    labsep.Top      = labPathRoot.Top;
                    labsep.Font     = labPathRoot.Font;
                    labsep.AutoSize = true;
                    m_titleBarLabels.Add(labsep);
                    lastlab = labsep;

                    var labnode = new LinkLabel();
                    labnode.Text = Texts.Get(pth[i].Title);
                    labnode.Tag  = pth[i].Path;
                    labPathRoot.Parent.Controls.Add(labnode);
                    labnode.Left     = lastlab.Right + LABDIST;
                    labnode.Top      = labPathRoot.Top;
                    labnode.Click   += labPathRoot_Click;
                    labnode.Font     = labPathRoot.Font;
                    labnode.AutoSize = true;
                    m_titleBarLabels.Add(labnode);
                    lastlab = labnode;
                }

                panel1.Height = hi0;
            }
        }
Esempio n. 18
0
        public IRowTransform GetTransform()
        {
            bool ispermute = true;

            for (int i = 0; i < m_combos.Count; i++)
            {
                if (m_checks[i].Checked)
                {
                    continue;
                }
                var c = m_typeCombos[i];
                if (c.SelectedIndex > 0)
                {
                    ispermute = false;
                }
            }
            if (ispermute)
            {
                TableStructure target  = new TableStructure();
                List <int>     indexes = new List <int>();
                for (int i = 0; i < m_combos.Count; i++)
                {
                    if (m_checks[i].Checked)
                    {
                        continue;
                    }
                    var combo = m_combos[i];
                    int idx   = combo.Items.IndexOf(combo.Text);
                    if (idx < 0)
                    {
                        throw new RowTransformError("DAE-00183" + Texts.Get("s_cannot_find$column", "column", combo.Text));
                    }
                    indexes.Add(idx);
                    target._Columns.Add(new ColumnStructure(m_target.Columns[i]));
                }
                return(new PermuteTransform(m_source, target, indexes));
            }
            else
            {
                TableStructure target = new TableStructure();
                List <GenericTransform.ColExpr> cols = new List <GenericTransform.ColExpr>();
                for (int i = 0; i < m_typeCombos.Count; i++)
                {
                    if (m_checks[i].Checked)
                    {
                        continue;
                    }
                    cols.Add(new GenericTransform.ColExpr
                    {
                        Type       = (GenericTransform.ColExprType)m_typeCombos[i].SelectedItem,
                        Expression = m_combos[i].Text,
                        Name       = m_target.Columns[i].ColumnName
                    });
                    target._Columns.Add(new ColumnStructure(m_target.Columns[i]));
                }
                GenericTransform gt = new GenericTransform(m_source, target, cols);
                return(gt);
            }
        }
Esempio n. 19
0
 protected void ShowProgress()
 {
     if (ProgressInfo != null & m_file != null && (DateTime.Now - m_lastinfo).Seconds > 1)
     {
         ProgressInfo.SetCurWork(String.Format("{0} {1} KB/{2}", Texts.Get("s_imported"), m_file.Position / 1000, m_file.Length / 1000));
         m_lastinfo = DateTime.Now;
     }
 }
Esempio n. 20
0
 public override void CheckOutput()
 {
     base.CheckOutput();
     if (!File.Exists(Application))
     {
         throw new CheckConfigError("DAE-00277 " + Texts.Get("s_file_does_not_exist$file", "file", Application));
     }
 }
Esempio n. 21
0
 public RunOrSaveJobForm(JobCommand command, Func <JobCommand, bool> checkConfig, string label)
 {
     InitializeComponent();
     m_command     = command;
     label1.Text   = Texts.Get(label);
     m_checkConfig = checkConfig;
     propertyFrame1.SelectedObject = m_command;
 }
Esempio n. 22
0
        private void RunJob(Dictionary <string, string> args)
        {
            Job job = Job.LoadFromFile(args["job"]);

            if (MessageBox.Show(Texts.Get("s_really_run$job", "job", job), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                job.StartProcess();
            }
        }
Esempio n. 23
0
 public override void GetToolbarItems(string toolbarName, List <ToolStripItem> items)
 {
     if (toolbarName == "main")
     {
         var btn = new ToolStripButton(Texts.Get("s_dashboard"), CoreIcons.dashboard);
         btn.Click += new EventHandler(btn_Click);
         items.Add(btn);
     }
 }
Esempio n. 24
0
 public override bool DoDelete()
 {
     if (MessageBox.Show(Texts.Get("s_really_drop$column", "column", m_column.ColumnName), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         m_conn.Database.DropObject(m_column);
         return(true);
     }
     return(false);
 }
Esempio n. 25
0
        public void Run()
        {
            Job job = Job.FromCommand(m_command, new JobProperties());

            if (MessageBox.Show(Texts.Get("s_really_run$job", "job", job), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                job.StartProcess();
            }
        }
Esempio n. 26
0
        /// <summary>
        /// Gets the description for certaing named value in an Enumeration
        /// </summary>
        /// <param name="value">The type of the Enumeration</param>
        /// <param name="name">The name of the Enumeration value</param>
        /// <returns>The description, if any, else the passed name</returns>
        public static string GetEnumDescription(System.Type value, string name)
        {
            FieldInfo fi = value.GetField(name);

            DescriptionAttribute[] attributes =
                (DescriptionAttribute[])fi.GetCustomAttributes(
                    typeof(DescriptionAttribute), false);
            return((attributes.Length > 0) ? Texts.Get(attributes[0].Description) : name);
        }
Esempio n. 27
0
 private void InitiDialects()
 {
     cbxDialect.Items.Add("(" + Texts.Get("s_default") + ")");
     foreach (var dialect in DialectAddonType.GetAllDialects(false))
     {
         cbxDialect.Items.Add(dialect);
     }
     cbxDialect.SelectedIndex = 0;
 }
Esempio n. 28
0
 private void tbxSearch_Leave(object sender, EventArgs e)
 {
     if (tbxSearch.Text.IsEmpty())
     {
         m_graySearch        = true;
         tbxSearch.Text      = Texts.Get("s_search");
         tbxSearch.ForeColor = SystemColors.GrayText;
     }
 }
Esempio n. 29
0
 private void InitDialects()
 {
     cbxDialect.Items.Add(String.Format("({0})", Texts.Get("s_default")));
     foreach (var item in DialectAddonType.Instance.CommonSpace.GetFilteredAddons(RegisterItemUsage.DirectUse))
     {
         cbxDialect.Items.Add(item);
     }
     cbxDialect.SelectedIndex = 0;
 }
        public ColumnsObjectFilterItemFrame(ColumnsObjectFilterItem item)
        {
            InitializeComponent();
            m_item = item;

            chbEnabled.Text    = Texts.Get(m_item.PropertyTitle);
            chbEnabled.Checked = m_item.Enabled;
            tbxList.Text       = m_item.Columns.CreateDelimitedText("\r\n");
            chbEnabled_CheckedChanged(this, EventArgs.Empty);
        }