コード例 #1
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void configToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node;

            if (MouseDownPos == null)
            {
                Point org = new Point(contextMenuLocalFolder.Left, contextMenuLocalFolder.Top);
                Point p   = treeFolders.PointToClient(org);
                node = treeFolders.GetNodeAt(p.X, p.Y);
            }
            else
            {
                node = treeFolders.GetNodeAt(MouseDownPos.X, MouseDownPos.Y);
            }

            SyncFolder sf = null;

            if (node != null)
            {
                sf = li.GetSyncFolder(node.Name);
            }

            if (sf != null)
            {
                SyncFolderForm sff = new SyncFolderForm(sf);
                sff.ShowDialog();
            }
        }
コード例 #2
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void configSetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Point        org = new Point(contextMenuSets.Left, contextMenuSets.Top);
            Point        p   = listSets.PointToClient(org);
            ListViewItem lvi = listSets.GetItemAt(p.X, p.Y);
            SyncFolder   sf  = null;

            if (lvi != null)
            {
                sf = FlickrSync.li.GetSyncFolderBySet(lvi.Name);
            }

            if (sf != null)
            {
                SyncFolderForm sff = new SyncFolderForm(sf);
                sff.ShowDialog();
            }
        }
コード例 #3
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void configToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node;
            if (MouseDownPos == null)
            {
                Point org = new Point(contextMenuLocalFolder.Left, contextMenuLocalFolder.Top);
                Point p = treeFolders.PointToClient(org);
                node = treeFolders.GetNodeAt(p.X, p.Y);
            }
            else
                node = treeFolders.GetNodeAt(MouseDownPos.X, MouseDownPos.Y);

            SyncFolder sf = null;

            if (node != null)
                sf = li.GetSyncFolder(node.Name);

            if (sf != null)
            {
                SyncFolderForm sff = new SyncFolderForm(sf);
                sff.ShowDialog();
            }
        }
コード例 #4
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void configSetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Point org = new Point(contextMenuSets.Left, contextMenuSets.Top);
            Point p = listSets.PointToClient(org);
            ListViewItem lvi = listSets.GetItemAt(p.X, p.Y);
            SyncFolder sf = null;

            if (lvi != null)
                sf = FlickrSync.li.GetSyncFolderBySet(lvi.Name);

            if (sf != null)
            {
                SyncFolderForm sff = new SyncFolderForm(sf);
                sff.ShowDialog();
            }
        }
コード例 #5
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void treeFolders_AfterCheck(object sender, TreeViewEventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            if (e.Node.Checked)
            {
                if (syncprop_status == SyncPropertiesStatus.CancelAll)
                {
                    e.Node.Checked = false;

                    treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                    CalcTooltips();
                    Cursor = Cursors.Default;
                    return;
                }

                SyncFolder sf = new SyncFolder(e.Node.Name);

                //try to match Set name
                foreach (Photoset ps in FlickrSync.ri.GetAllSets())
                {
                    if (ps.Title.Equals(Path.GetFileName(e.Node.Name),StringComparison.CurrentCultureIgnoreCase))
                    {
                        sf.SetId = ps.PhotosetId;
                        break;
                    }
                }
                if (sf.SetId == "")
                    sf.SetTitle = Path.GetFileName(e.Node.Name);

                if (syncprop_status == SyncPropertiesStatus.OKAll)
                {
                    li.Add(sf);
                }
                else
                {
                    SyncFolderForm sff = new SyncFolderForm(sf);
                    if (syncprop_status == SyncPropertiesStatus.MultipleUndef)
                        sff.SetMultiple(true);

                    DialogResult dr=sff.ShowDialog();

                    if (dr == DialogResult.OK || dr==DialogResult.Yes)  //Yes means OK to All
                        li.Add(sf);
                    else
                        e.Node.Checked = false;

                    if (dr == DialogResult.Yes && syncprop_status == SyncPropertiesStatus.MultipleUndef)
                        syncprop_status = SyncPropertiesStatus.OKAll;

                    if (dr == DialogResult.Abort) //CancelAll
                    {
                        syncprop_status = SyncPropertiesStatus.CancelAll;

                        treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                        CalcTooltips();
                        Cursor = Cursors.Default;
                        return;
                    }
                }
            }
            else
                li.Remove(e.Node.Name);

            treeFolders.RefreshTreeNodes(treeFolders.Nodes);
            CalcTooltips();
            Cursor = Cursors.Default;
        }
コード例 #6
0
ファイル: FlickrSync.cs プロジェクト: udif/FlickrSync
        private void treeFolders_AfterCheck(object sender, TreeViewEventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            if (e.Node.Checked)
            {
                if (syncprop_status == SyncPropertiesStatus.CancelAll)
                {
                    e.Node.Checked = false;

                    treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                    CalcTooltips();
                    Cursor = Cursors.Default;
                    return;
                }

                SyncFolder sf       = new SyncFolder(e.Node.Name);
                string     basename = Path.GetFileName(e.Node.Name);

                switch (sf.SetNaming)
                {
                case SyncFolder.SetNamings.NamingDefault:
                    //try to match Set name
                    foreach (Photoset ps in FlickrSync.ri.GetAllSets())
                    {
                        if (ps.Title.Equals(basename, StringComparison.CurrentCultureIgnoreCase))
                        {
                            sf.SetId = ps.PhotosetId;
                            break;
                        }
                    }
                    if (sf.SetId == "")
                    {
                        sf.SetTitle = basename;
                    }
                    break;

                case SyncFolder.SetNamings.NonUniqueSetNames:
                    sf.SetTitle = basename;
                    break;

                case SyncFolder.SetNamings.UniqueSetNames:
                    sf.SetTitle = basename;
                    string re = basename + "(?: \\((\\d+)\\))?$";
                    System.Text.RegularExpressions.Match match;
                    int title_index = 0;
                    int val;
                    foreach (Photoset ps in FlickrSync.ri.GetAllSets())
                    {
                        // match for an existing photoset title with an options " (NNN)" suffix.
                        match = System.Text.RegularExpressions.Regex.Match(ps.Title, re, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        // no match, keep trying
                        if (!match.Success)
                        {
                            continue;
                        }
                        // matched, but without the suffix
                        if (match.Captures.Count == 1)
                        {
                            // create our own suffix with " (1)" unless we already encountered something higher
                            title_index = Math.Max(title_index, 1);
                            continue;
                        }
                        // matched with suffix, set tltle_index to be 1 more than the matched suffix or the current title_index,
                        // whichever is higher
                        title_index = Math.Max(title_index, Int32.Parse(match.Groups[0].Value));
                    }
                    // if title_index is 0, it means we haven't encountered an existing title that matches this one
                    if (title_index > 0)
                    {
                        sf.SetTitle += System.String.Format(" ({0})", title_index);
                    }
                    break;
                }

                if (syncprop_status == SyncPropertiesStatus.OKAll)
                {
                    li.Add(sf);
                }
                else
                {
                    SyncFolderForm sff = new SyncFolderForm(sf);
                    if (syncprop_status == SyncPropertiesStatus.MultipleUndef)
                    {
                        sff.SetMultiple(true);
                    }

                    DialogResult dr = sff.ShowDialog();

                    if (dr == DialogResult.OK || dr == DialogResult.Yes)  //Yes means OK to All
                    {
                        li.Add(sf);
                    }
                    else
                    {
                        e.Node.Checked = false;
                    }

                    if (dr == DialogResult.Yes && syncprop_status == SyncPropertiesStatus.MultipleUndef)
                    {
                        syncprop_status = SyncPropertiesStatus.OKAll;
                    }

                    if (dr == DialogResult.Abort) //CancelAll
                    {
                        syncprop_status = SyncPropertiesStatus.CancelAll;

                        treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                        CalcTooltips();
                        Cursor = Cursors.Default;
                        return;
                    }
                }
            }
            else
            {
                li.Remove(e.Node.Name);
            }

            treeFolders.RefreshTreeNodes(treeFolders.Nodes);
            CalcTooltips();
            Cursor = Cursors.Default;
        }
コード例 #7
0
        private void treeFolders_AfterCheck(object sender, TreeViewEventArgs e)
        {
            Cursor = Cursors.WaitCursor;

            if (e.Node.Checked)
            {
                if (syncprop_status == SyncPropertiesStatus.CancelAll)
                {
                    e.Node.Checked = false;

                    treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                    CalcTooltips();
                    Cursor = Cursors.Default;
                    return;
                }

                SyncFolder sf = new SyncFolder(e.Node.Name);

                //try to match Set name
                foreach (Photoset ps in FlickrSync.ri.GetAllSets())
                {
                    if (ps.Title.Equals(Path.GetFileName(e.Node.Name), StringComparison.CurrentCultureIgnoreCase))
                    {
                        sf.SetId = ps.PhotosetId;
                        break;
                    }
                }
                if (sf.SetId == "")
                {
                    sf.SetTitle = Path.GetFileName(e.Node.Name);
                }

                if (syncprop_status == SyncPropertiesStatus.OKAll)
                {
                    li.Add(sf);
                }
                else
                {
                    SyncFolderForm sff = new SyncFolderForm(sf);
                    if (syncprop_status == SyncPropertiesStatus.MultipleUndef)
                    {
                        sff.SetMultiple(true);
                    }

                    DialogResult dr = sff.ShowDialog();

                    if (dr == DialogResult.OK || dr == DialogResult.Yes)  //Yes means OK to All
                    {
                        li.Add(sf);
                    }
                    else
                    {
                        e.Node.Checked = false;
                    }

                    if (dr == DialogResult.Yes && syncprop_status == SyncPropertiesStatus.MultipleUndef)
                    {
                        syncprop_status = SyncPropertiesStatus.OKAll;
                    }

                    if (dr == DialogResult.Abort) //CancelAll
                    {
                        syncprop_status = SyncPropertiesStatus.CancelAll;

                        treeFolders.RefreshTreeNodes(treeFolders.Nodes);
                        CalcTooltips();
                        Cursor = Cursors.Default;
                        return;
                    }
                }
            }
            else
            {
                li.Remove(e.Node.Name);
            }

            treeFolders.RefreshTreeNodes(treeFolders.Nodes);
            CalcTooltips();
            Cursor = Cursors.Default;
        }